Class: BowerVendor::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- BowerVendor::InstallGenerator
- Defined in:
- lib/generators/bower_vendor/install_generator.rb
Instance Attribute Summary collapse
-
#utils ⇒ Object
Returns the value of attribute utils.
Instance Method Summary collapse
Instance Attribute Details
#utils ⇒ Object
Returns the value of attribute utils.
4 5 6 |
# File 'lib/generators/bower_vendor/install_generator.rb', line 4 def utils @utils end |
Instance Method Details
#bower_install ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/generators/bower_vendor/install_generator.rb', line 12 def bower_install if !.skip_clean? generate .force_clean? ? 'bower_vendor:clean --force' : 'bower_vendor:clean' generate 'bower_vendor:clean --cached' end action = .update? ? 'update' : 'install' action << ' --production' if !.include_dev_dependencies? say_status :run, "bower #{action}" `bower #{action}` @utils = BowerVendor::Utils.new utils.merged_paths.each do |package, paths| append_file '.gitignore', "\n# Vendored bower package '#{package}'\n" if !.skip_git_ignore? case paths when Hash paths.each do |source, dest| vendor_asset(package, utils.prefixed_source(package, source), dest) end when Array paths.each do |source| vendor_asset(package, utils.prefixed_source(package, source)) end when String vendor_asset(package, utils.prefixed_source(package, paths)) else raise Thor::Error, set_color("Paths must be either Hash, Array or String, received: #{paths.class}", :red, :bold) end end end |