1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems/spec_fetcher.rb: Allow prerelease spec fetching to fail

for bundler.
	* test/rubygems/test_gem_spec_fetcher.rb:  Test for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2012-11-30 03:28:04 +00:00
parent 8137152e01
commit aee295fc74
3 changed files with 33 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Fri Nov 30 12:27:51 2012 Eric Hodel <drbrain@segment7.net>
* lib/rubygems/spec_fetcher.rb: Allow prerelease spec fetching to fail
for bundler.
* test/rubygems/test_gem_spec_fetcher.rb: Test for above.
Fri Nov 30 12:20:53 2012 Eric Hodel <drbrain@segment7.net>
* lib/rake/backtrace.rb: Removed duplication in

View file

@ -195,7 +195,8 @@ class Gem::SpecFetcher
when :released
tuples_for source, :released
when :complete
tuples_for(source, :prerelease) + tuples_for(source, :released)
tuples_for(source, :prerelease, true) +
tuples_for(source, :released)
when :prerelease
tuples_for(source, :prerelease)
else
@ -211,9 +212,18 @@ class Gem::SpecFetcher
[list, errors]
end
def tuples_for(source, type)
def tuples_for(source, type, gracefully_ignore=false)
cache = @caches[type]
cache[source.uri] ||= source.load_specs(type)
if gracefully_ignore
begin
cache[source.uri] ||= source.load_specs(type)
rescue Gem::RemoteFetcher::FetchError
[]
end
else
cache[source.uri] ||= source.load_specs(type)
end
end
end

View file

@ -187,6 +187,20 @@ class TestGemSpecFetcher < Gem::TestCase
assert_equal comp.sort, specs[@source].sort
end
def test_available_specs_complete_handles_no_prerelease
v = Gem.marshal_version
@fetcher.data.delete "#{@gem_repo}prerelease_specs.#{v}.gz"
specs, _ = @sf.available_specs(:complete)
assert_equal [@source], specs.keys
comp = @released
assert_equal comp.sort, specs[@source].sort
end
def test_available_specs_cache
specs, _ = @sf.available_specs(:latest)