Parent

GemInstaller::GemListChecker

Attributes

gem_command_manager[W]
gem_arg_processor[W]
version_specifier[W]

Public Instance Methods

available_versions(gem) click to toggle source
    # File lib/geminstaller/gem_list_checker.rb, line 43
43:     def available_versions(gem)
44:       remote_match_line = find_remote_matching_gem(gem)
45:       version_list = parse_out_version_list(remote_match_line)
46:     end
find_remote_matching_gem(gem) click to toggle source
    # File lib/geminstaller/gem_list_checker.rb, line 5
 5:     def find_remote_matching_gem(gem)
 6:       gem_list_match_regexp =  /^#{gem.regexp_escaped_name} \(.*/
 7:       common_args = @gem_arg_processor.strip_non_common_gem_args(gem.install_options)
 8:       remote_list = @gem_command_manager.list_remote_gem(gem, common_args)
 9: 
10:       matched_lines = []
11:       remote_list.each do |line|
12:         if line.match(gem_list_match_regexp)
13:           matched_lines << line
14:         end
15:       end
16:       
17:       if matched_lines.size > 1
18:         error_message = "Error: more than one remote gem matches (this should not happen and is probably a bug in geminstaller).  Gem name = '#{gem.name}', install options = '#{gem.install_options.join(' ')}'.  Matching remote gems: \n"
19:         matched_lines.each do |line|
20:           error_message += line + "\n"
21:         end
22:         raise GemInstaller::GemInstallerError.new(error_message)
23:       end
24: 
25:       if matched_lines.size == 0
26:         error_message = "Error: Could not find remote gem to install.  Gem name = '#{gem.name}', Gem version = '#{gem.version}', install options = '#{gem.install_options.join(' ')}'.  Your remote gem server may be having problems.  You should try to list the remote gem yourself:  'gem list -r -v '#{gem.version}' #{common_args.join(' ')} #{gem.name}'.  If it exists on the server, try running geminstaller again and open a ticket here: http://thewoolleyweb.lighthouseapp.com/projects/11580-geminstaller.  Output of remote gem list command: \n#{remote_list}"
27:         raise GemInstaller::GemInstallerError.new(error_message)
28:       end
29: 
30:       return matched_lines[0]
31:     end
parse_out_version_list(line) click to toggle source
    # File lib/geminstaller/gem_list_checker.rb, line 48
48:     def parse_out_version_list(line)
49:       # return everything between first set of parenthesis
50:       version_list = line.split(/[()]/)[1]
51:       version_list
52:     end
verify_and_specify_remote_gem!(gem) click to toggle source
    # File lib/geminstaller/gem_list_checker.rb, line 33
33:     def verify_and_specify_remote_gem!(gem)
34:       # TODO: this seems like it is a hack, but we must have a non-ambiguous version on the gem in order for 
35:       # noninteractive_chooser to be able to parse the gem list for multi-platform gems.  This will not be necessary
36:       # if a future RubyGems release allows specification/searching of the platform, because then we won't need noninteractive_chooser
37:       
38:       version_list = available_versions(gem)
39:       specified_version = @version_specifier.specify(gem.version, version_list, gem.name)
40:       gem.version = specified_version
41:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.