Class: Gem::SpecFetcher

Inherits:
Object show all
Defined in:
lib/bowline/dependencies/lib/ext/rubygems.rb

Instance Method Summary collapse

Instance Method Details

#fetch(*args) ⇒ Object

in rubygems 1.3.2 fetch takes 4 parameters



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/bowline/dependencies/lib/ext/rubygems.rb', line 83

def fetch(*args) # in rubygems 1.3.2 fetch takes 4 parameters
  dependency, all, matching_platform, prerelease = *args
  idx = Gem::SourceIndex.from_installed_gems

  reqs = dependency.version_requirements.requirements

  if reqs.size == 1 && reqs[0][0] == "="
    dep = idx.search(dependency).sort.last
  end

  if dep
    file = dep.loaded_from.dup
    file.gsub!(/specifications/, "cache")
    file.gsub!(/gemspec$/, "gem")
    spec = ::Gem::Format.from_file_by_path(file).spec
    [[spec, file]]
  else
    old_fetch(*args)
  end
end

#old_fetchObject



82
# File 'lib/bowline/dependencies/lib/ext/rubygems.rb', line 82

alias old_fetch fetch