Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle Rubygems sources that have no prerelease specs with a warning

  • Loading branch information...
commit 8a7382af11a41aacfa799a9669e2379bd4d370a1 1 parent 5656587
@indirect indirect authored
View
8 lib/bundler/source.rb
@@ -70,8 +70,14 @@ def fetch_specs
end
def fetch_all_specs(&blk)
+ # Fetch all specs, minus prerelease specs
Gem::SpecFetcher.new.list(true, false).each(&blk)
- Gem::SpecFetcher.new.list(false, true).each(&blk)
+ # Then fetch the prerelease specs
+ begin
+ Gem::SpecFetcher.new.list(false, true).each(&blk)
+ rescue Gem::RemoteFetcher::FetchError
+ Bundler.ui.warn "Could not fetch prerelease specs from #{self}"
+ end
end
end
View
42 spec/install/gems/simple_case_spec.rb
@@ -177,7 +177,45 @@
end
end
- describe "with BUNDLE_PATH set" do
+ describe "when prerelease gems are available" do
+ it "finds prereleases" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "not_released"
+ G
+ should_be_installed "not_released 1.0.pre"
+ end
+
+ it "uses regular releases if available" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "has_prerelease"
+ G
+ should_be_installed "has_prerelease 1.0"
+ end
+
+ it "uses prereleases if requested" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "has_prerelease", "1.1.pre"
+ G
+ should_be_installed "has_prerelease 1.1.pre"
+ end
+ end
+
+ describe "when prerelease gems are not available" do
+ it "still works" do
+ build_repo3
+ install_gemfile <<-G
+ source "file://#{gem_repo3}"
+ gem "rack"
+ G
+
+ should_be_installed "rack 1.0"
+ end
+ end
+
+ describe "when BUNDLE_PATH is set" do
before :each do
build_lib "rack", "1.0.0", :to_system => true do |s|
s.write "lib/rack.rb", "raise 'FAIL'"
@@ -249,7 +287,7 @@
end
end
- describe "disabling system gems" do
+ describe "when disabling system gems" do
before :each do
build_gem "rack", "1.0.0", :to_system => true do |s|
s.write "lib/rack.rb", "puts 'FAIL'"
View
2  spec/spec_helper.rb
@@ -14,7 +14,7 @@
$show_err = true
Spec::Rubygems.setup
-Spec::Path.gem_repo1.rmtree
+FileUtils.rm_rf(Spec::Path.gem_repo1)
Spec::Runner.configure do |config|
config.include Spec::Builders
View
12 spec/support/builders.rb
@@ -79,9 +79,10 @@ def build_repo1
s.platform = "java"
end
- build_gem "very-simple"
+ build_gem "not_released", "1.0.pre"
- build_gem "very-simple-prerelease", "1.0.pre"
+ build_gem "has_prerelease", "1.0"
+ build_gem "has_prerelease", "1.1.pre"
build_gem "with_development_dependency" do |s|
s.add_development_dependency "activesupport", "= 2.3.5"
@@ -171,6 +172,13 @@ def build_repo2(&blk)
update_repo2(&blk) if block_given?
end
+ def build_repo3
+ build_repo gem_repo3 do
+ build_gem "rack"
+ end
+ FileUtils.rm_rf Dir[gem_repo3("prerelease*")]
+ end
+
def update_repo2
update_repo gem_repo2 do
build_gem "rack", "1.2" do |s|
View
4 spec/support/path.rb
@@ -42,6 +42,10 @@ def gem_repo2(*args)
tmp("gems/remote2", *args)
end
+ def gem_repo3(*args)
+ tmp("gems/remote3", *args)
+ end
+
def system_gem_path
tmp("gems/system")
end
Please sign in to comment.
Something went wrong with that request. Please try again.