Sha256: 07a31ba2e0762795cd891ed99564a495c40d4272532702761a55560e6eccd543

Contents?: true

Size: 1.15 KB

Versions: 13

Compression:

Stored size: 1.15 KB

Contents

require "thor"
require 'knitter'

module WebpackDriver

    class Configuration

        class Example < Thor::Group
            include Thor::Actions

            class_option :config

            attr_reader :yarn

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

            def set_destination_root
                self.destination_root = options[:config].file.dirname
                @yarn = Knitter::Yarn.new(destination_root)
            end

            def install_using_yarn
                yarn.init unless yarn.valid?
                %w(webpack webpack-dev-server).each do |package|
                    package = Knitter::Package.new(package, yarn: yarn)
                    unless package.installed?
                        package.dependency_type = :development
                        package.add
                    end
                end
            end

            def generate
                template("webpack.config.js", verbose: false)
                template("index.js", verbose: false, force: true)
            end
        end
    end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
webpack_driver-0.5.0pre1 lib/webpack_driver/configuration/example.rb
webpack_driver-0.4.1 lib/webpack_driver/configuration/example.rb
webpack_driver-0.4.0 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.7 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.6 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.5 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.4 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.3 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.2 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.1 lib/webpack_driver/configuration/example.rb
webpack_driver-0.3.0 lib/webpack_driver/configuration/example.rb
webpack_driver-0.2.1 lib/webpack_driver/configuration/example.rb
webpack_driver-0.2.0 lib/webpack_driver/configuration/example.rb