Parent

Methods

GemInstaller::VersionSpecifier

Public Instance Methods

specify(version_requirement, available_versions, gem_name = nil) click to toggle source

NOTE: available_versions should be sorted in descending order (highest versions first) This method will return the first matching version

    # File lib/geminstaller/version_specifier.rb, line 5
 5:     def specify(version_requirement, available_versions, gem_name = nil)
 6:       rubygems_version_requirement = GemInstaller::REQUIREMENT_CLASS.new [version_requirement]
 7:       if available_versions.respond_to? :to_str
 8:         available_versions = available_versions.split(', ')
 9:       end
10:       available_versions.each do |available_version_string|
11:         available_version_string_without_platforms = available_version_string.split(' ').first
12:         available_version = Gem::Version.new(available_version_string_without_platforms)
13:         if rubygems_version_requirement.satisfied_by?(available_version)
14:           return available_version.to_s
15:         end
16:       end
17:       gem_name_msg = ''
18:       if gem_name
19:         gem_name_msg = "for gem '#{gem_name}' "
20:       end
21:       error_msg = "The specified version requirement '#{version_requirement}' #{gem_name_msg}is not met by any of the available versions: #{available_versions.join(', ')}."
22:       raise GemInstaller::GemInstallerError.new(error_msg)
23:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.