Class: WebpackDriver::Configuration::Example
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- WebpackDriver::Configuration::Example
- Includes:
- Thor::Actions
- Defined in:
- lib/webpack_driver/configuration/example.rb
Instance Attribute Summary collapse
-
#yarn ⇒ Object
readonly
Returns the value of attribute yarn.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#yarn ⇒ Object (readonly)
Returns the value of attribute yarn.
13 14 15 |
# File 'lib/webpack_driver/configuration/example.rb', line 13 def yarn @yarn end |
Class Method Details
.source_root ⇒ Object
15 16 17 18 |
# File 'lib/webpack_driver/configuration/example.rb', line 15 def self.source_root Pathname.new(__FILE__) .dirname.join('..', '..', '..', 'templates') end |
Instance Method Details
#generate ⇒ Object
36 37 38 39 |
# File 'lib/webpack_driver/configuration/example.rb', line 36 def generate template("webpack.config.js", verbose: false) template("index.js", verbose: false, force: true) end |
#install_using_yarn ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/webpack_driver/configuration/example.rb', line 25 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 |
#set_destination_root ⇒ Object
20 21 22 23 |
# File 'lib/webpack_driver/configuration/example.rb', line 20 def set_destination_root self.destination_root = [:config].file.dirname @yarn = Knitter::Yarn.new(destination_root) end |