Class: Jeweler::Commands::InstallGem
- Inherits:
-
Object
- Object
- Jeweler::Commands::InstallGem
- Defined in:
- lib/jeweler/commands/install_gem.rb
Instance Attribute Summary collapse
-
#gemspec_helper ⇒ Object
Returns the value of attribute gemspec_helper.
-
#output ⇒ Object
Returns the value of attribute output.
Class Method Summary collapse
Instance Method Summary collapse
- #host_os ⇒ Object
-
#initialize ⇒ InstallGem
constructor
A new instance of InstallGem.
- #run ⇒ Object
- #sudo_wrapper(command) ⇒ Object
- #use_sudo? ⇒ Boolean
Constructor Details
#initialize ⇒ InstallGem
Returns a new instance of InstallGem.
8 9 10 |
# File 'lib/jeweler/commands/install_gem.rb', line 8 def initialize self.output = $stdout end |
Instance Attribute Details
#gemspec_helper ⇒ Object
Returns the value of attribute gemspec_helper.
6 7 8 |
# File 'lib/jeweler/commands/install_gem.rb', line 6 def gemspec_helper @gemspec_helper end |
#output ⇒ Object
Returns the value of attribute output.
6 7 8 |
# File 'lib/jeweler/commands/install_gem.rb', line 6 def output @output end |
Class Method Details
.build_for(jeweler) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/jeweler/commands/install_gem.rb', line 32 def self.build_for(jeweler) command = new command.output = jeweler.output command.gemspec_helper = jeweler.gemspec_helper command end |
Instance Method Details
#host_os ⇒ Object
28 29 30 |
# File 'lib/jeweler/commands/install_gem.rb', line 28 def host_os Config::CONFIG['host_os'] end |
#run ⇒ Object
13 14 15 16 17 18 |
# File 'lib/jeweler/commands/install_gem.rb', line 13 def run command = "gem install #{gemspec_helper.gem_path}" output.puts "Executing #{command.inspect}:" sh sudo_wrapper(command) # TODO where does sh actually come from!? - rake, apparently end |
#sudo_wrapper(command) ⇒ Object
20 21 22 |
# File 'lib/jeweler/commands/install_gem.rb', line 20 def sudo_wrapper(command) use_sudo? ? "sudo #{command}" : command end |
#use_sudo? ⇒ Boolean
24 25 26 |
# File 'lib/jeweler/commands/install_gem.rb', line 24 def use_sudo? host_os !~ /mswin|windows|cygwin/i end |