Class: Gem::Commands::GitinstallCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::GitinstallCommand
- Defined in:
- lib/rubygems/commands/gitinstall_command.rb
Instance Method Summary collapse
-
#arguments ⇒ Object
:nodoc:.
- #build_gem(dir) ⇒ Object
- #clone_repo(url, dir) ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ GitinstallCommand
constructor
A new instance of GitinstallCommand.
- #install_gem(dir) ⇒ Object
- #run(cmd) ⇒ Object
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ GitinstallCommand
Returns a new instance of GitinstallCommand.
5 6 7 8 9 10 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 5 def initialize super 'gitinstall', "Install gem from a git repo" add_option '--force', 'skip validation of the gemspec' do |value, | [:force] = true end end |
Instance Method Details
#arguments ⇒ Object
:nodoc:
40 41 42 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 40 def arguments # :nodoc: "GEMNAME name of gem to install" end |
#build_gem(dir) ⇒ Object
25 26 27 28 29 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 25 def build_gem(dir) force = [:force] ? " --force" : "" run "cd #{dir} && rm -rf *.gem" run "cd #{dir} && gem build *.gemspec#{force}" end |
#clone_repo(url, dir) ⇒ Object
21 22 23 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 21 def clone_repo(url, dir) run "git clone #{url} #{dir}" end |
#execute ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 12 def execute url = get_one_gem_name Dir.mktmpdir "gemgitinstall" do |dir| clone_repo(url, dir) build_gem(dir) install_gem(dir) end end |
#install_gem(dir) ⇒ Object
31 32 33 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 31 def install_gem(dir) run "cd #{dir} && gem install *.gem" end |
#run(cmd) ⇒ Object
35 36 37 38 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 35 def run(cmd) puts "Executing: #{cmd}" system cmd end |
#usage ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/rubygems/commands/gitinstall_command.rb', line 44 def usage # :nodoc: "#{program_name} GEMNAME" end |