2012-08-11 20:22:29 -04:00
|
|
|
class Pry
|
2012-12-25 16:35:17 -05:00
|
|
|
class Command::GemInstall < Pry::ClassCommand
|
|
|
|
match 'gem-install'
|
2012-08-11 21:26:59 -04:00
|
|
|
group 'Gems'
|
2012-12-25 16:35:17 -05:00
|
|
|
description 'Install a gem and refresh the gem cache.'
|
2012-08-11 21:26:59 -04:00
|
|
|
command_options :argument_required => true
|
|
|
|
|
2012-08-11 20:22:29 -04:00
|
|
|
banner <<-BANNER
|
|
|
|
Usage: gem-install GEM_NAME
|
|
|
|
|
|
|
|
Installs the given gem and refreshes the gem cache so that you can immediately 'require GEM_FILE'
|
|
|
|
BANNER
|
|
|
|
|
|
|
|
def setup
|
|
|
|
require 'rubygems/dependency_installer' unless defined? Gem::DependencyInstaller
|
|
|
|
end
|
|
|
|
|
|
|
|
def process(gem)
|
2013-01-08 18:27:27 -05:00
|
|
|
Rubygem.install(gem)
|
|
|
|
output.puts "Gem `#{ text.green(gem) }` installed."
|
|
|
|
require gem
|
2012-08-11 20:22:29 -04:00
|
|
|
end
|
|
|
|
end
|
2012-12-25 16:35:17 -05:00
|
|
|
|
|
|
|
Pry::Commands.add_command(Pry::Command::GemInstall)
|
2012-08-11 20:22:29 -04:00
|
|
|
end
|