Class: Plunger::Command::Upgrade
- Inherits:
-
Object
- Object
- Plunger::Command::Upgrade
- Defined in:
- lib/plunger/command/upgrade.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.autorun? ⇒ Boolean
15 16 17 |
# File 'lib/plunger/command/upgrade.rb', line 15 def autorun? true end |
.command ⇒ Object
7 8 9 |
# File 'lib/plunger/command/upgrade.rb', line 7 def command 'upgrade' end |
.description ⇒ Object
11 12 13 |
# File 'lib/plunger/command/upgrade.rb', line 11 def description 'Upgrade plunger gem' end |
Instance Method Details
#run(options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/plunger/command/upgrade.rb', line 20 def run() Command.ui.say("Checking plunger update ...") req = Gem::Requirement.new(">#{Plunger::VERSION}") dep = Gem::Dependency.new('plunger', req) tuples = Gem::SpecFetcher.fetcher.fetch(dep) if tuples.empty? Command.ui.say("Plunger is up to date") else spec, source = tuples.first Command.ui.say("Upgrading #{Plunger::VERSION} to #{spec.version}") installer = Gem::DependencyInstaller.new installer.install(spec.name, spec.version.to_s) exit end true end |