Sha256: ac32f1490aa6aa95d854354ea59bbd5b5db978af97a04b22573d5f00a598bdb8
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
require_relative 'configuration/generated' require_relative 'configuration/example' module WebpackDriver class Configuration attr_accessor :port attr_accessor :logger attr_accessor :compile_script attr_accessor :directory attr_accessor :cmd_line_flags attr_writer :environment attr_reader :file attr_reader :generated attr_accessor :logger ROOT = Pathname.new(__FILE__).dirname.join('..', '..') def initialize(file = './webpack.config.js', options = {}) options.each { |k, v| send("#{k}=", v) } @directory ||= '.' @file = Pathname.new(file) @generated = Tempfile.new(['webpack.config', '.js']) Generated.new([], config: self).invoke_all end def generate! Example.new([], config: self).invoke_all end def present? file.exist? end def path @generated.path end def gem_root ROOT end def environment @environment ||= { NODE_ENV: 'development' } end def flags opts = ['--config', path] opts += ['--port', port] if port opts += cmd_line_flags if cmd_line_flags opts end def logger @logger ||= Logger.new(STDOUT) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webpack_driver-0.2.0 | lib/webpack_driver/configuration.rb |