Class: Gem::Commands::ReadCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::ReadCommand
- Defined in:
- lib/rubygems/commands/read_command.rb
Constant Summary collapse
- VERSION =
"0.0.1"
- FNAME =
"/.gemfile"
Instance Method Summary collapse
-
#arguments ⇒ Object
:nodoc:.
-
#defaults_str ⇒ Object
:nodoc:.
- #execute ⇒ Object
- #gem(name) ⇒ Object
-
#initialize ⇒ ReadCommand
constructor
A new instance of ReadCommand.
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ ReadCommand
Returns a new instance of ReadCommand.
9 10 11 12 |
# File 'lib/rubygems/commands/read_command.rb', line 9 def initialize super("read", "\"Reads\" all your gems from a ~/.gemfile", :version => Gem::Requirement.default) end |
Instance Method Details
#arguments ⇒ Object
:nodoc:
14 15 16 |
# File 'lib/rubygems/commands/read_command.rb', line 14 def arguments # :nodoc: 'FILE reads from another file' end |
#defaults_str ⇒ Object
:nodoc:
18 19 20 |
# File 'lib/rubygems/commands/read_command.rb', line 18 def defaults_str # :nodoc: "--version='>= 0'" end |
#execute ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/rubygems/commands/read_command.rb', line 33 def execute file ||= ENV['HOME'] + FNAME unless file && File.exists?(file) puts "Gemfile not found.."; return end eval File.read(file) end |
#gem(name) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/rubygems/commands/read_command.rb', line 26 def gem(name) unless Gem.available?(name) puts "Installing #{name}" `gem install #{name} --no-rdoc --no-ri` end end |
#usage ⇒ Object
:nodoc:
22 23 24 |
# File 'lib/rubygems/commands/read_command.rb', line 22 def usage # :nodoc: "#{program_name} [FILE]" end |