Class: NPM2Gem::CLI
- Inherits:
-
Object
- Object
- NPM2Gem::CLI
- Defined in:
- lib/npm2gem/cli.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
12 13 14 15 16 |
# File 'lib/npm2gem/cli.rb', line 12 def initialize @config = Config.new @npm_install = NPMInstall.new(@config.package_name) @file_copier = FileCopier.new(@npm_install.path, "vendor/assets") end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/npm2gem/cli.rb', line 10 def config @config end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/npm2gem/cli.rb', line 18 def run if new_version? puts "Current (gem)\t Version: #{gem_version}" puts "New (npm)\t Version: #{npm_version}" if want_to_upgrade? @file_copier.copy(@config.files_to_copy) version = GemVersionUpdater.new.run(npm_version) puts "Done! :) Upgraded to #{version}" else puts "Okay, no problem!" end else puts "There's no new version of #{@config.package_name} "\ "on npm. The current version is #{npm_version}" end # FileUtils.rm_rf("node_modules") end |