Permalink
Browse files

fix GemCommandManager#dependency now that output lines are properly s…

…plit
  • Loading branch information...
thewoolleyman committed Aug 25, 2009
1 parent 7f90195 commit aaaf029df5740325e2e45b5331337e9a5bb08536
Showing with 8 additions and 9 deletions.
  1. +2 −0 lib/geminstaller/autogem.rb
  2. +6 −9 lib/geminstaller/gem_command_manager.rb
@@ -3,6 +3,8 @@ class Autogem
attr_writer :gem_command_manager, :gem_source_index_proxy
def autogem(gems)
@gem_source_index_proxy.refresh!
# REALLY refresh - refreshing the source_index directly isn't enough.
Gem.refresh
@completed_names = []
@completed_gems = []
gems.each do |gem|
@@ -36,21 +36,18 @@ def dependency(name, version, additional_options = [])
run_args = ["dependency", name_regexp, "--version", version]
run_args += additional_options
output_lines = @gem_runner_proxy.run(run_args)
p output_lines
# dependency output has all lines in the first element
output_array = output_lines[0].split("\n")
# drop the first line which just echoes the dependent gem
output_array.shift
output_lines.shift
# drop the line containing 'requires' (rubygems < 0.9.0)
if output_array[0] == ' Requires'
output_array.shift
if output_lines[0] == ' Requires'
output_lines.shift
end
# drop all empty lines
output_array.reject! { |line| line == "" }
output_lines.reject! { |line| line == "" }
# strip leading space
output_array.each { |line| line.strip! }
output_lines.each { |line| line.strip! }
# convert into gems
output_gems = output_array.collect do |line|
output_gems = output_lines.collect do |line|
name = line.split(' ')[0]
version_spec = line.split(/[(,)]/)[1]
GemInstaller::RubyGem.new(name, :version => version_spec)

0 comments on commit aaaf029

Please sign in to comment.