Sha256: 29ae648d472a3566b33ac103a31108dfb3f0779e3d3d3ea7b40084d08f082f4d

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require "thor"

module WebpackDriver

    class Configuration

        class Generated < Thor::Group
            include Thor::Actions

            class_option :config

            attr_reader :config_directory, :path, :generated_directory

            def set_variables
                @generated_directory = options[:config].tmp_directory
                @config_directory = options[:config].file.dirname
                @path = generated_directory.join('generated.config.js')
            end

            def self.source_root
                Pathname.new(__FILE__).dirname.join("..","..","..","templates")
            end


            def output
                opts = { verbose: false, force: true }
                template(
                    options[:config].file.relative_path_from(self.class.source_root),
                    options[:config].tmp_directory.join('webpack.config.js'),
                    opts
                )
                template(
                    'generated.config.js',
                    path,
                    opts
                )
            end

        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webpack_driver-0.3.1 lib/webpack_driver/configuration/generated.rb
webpack_driver-0.3.0 lib/webpack_driver/configuration/generated.rb