summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-06-07 09:26:42 -0700
committerCarl Lerche <carllerche@mac.com>2010-06-07 09:26:42 -0700
commitb0e51cdc453b7e5cdf7b7add5e37793f2f9b79bc (patch)
treeab66b0496cb46a0b630b2b51f4cf368f3a7fe0e0
parent171bfee09d72d596adc218cc8ddaf922916adff0 (diff)
downloadbundler-b0e51cdc453b7e5cdf7b7add5e37793f2f9b79bc.tar.gz
Rescue from spec materialization errors
-rw-r--r--TODO.md1
-rw-r--r--lib/bundler/spec_set.rb2
-rw-r--r--spec/runtime/platform_spec.rb34
3 files changed, 35 insertions, 2 deletions
diff --git a/TODO.md b/TODO.md
index 9a80fb82d9..028a657a49 100644
--- a/TODO.md
+++ b/TODO.md
@@ -6,7 +6,6 @@
- bundle irb / bundle ruby / bundle [whatever] -> bundle exec
- Make bundle (install) work when sudo might be needed
- Generate a bundle stub into the application
- - Handle materialization errors
- Handle the following case (no remote fetching):
1) Depend on nokogiri, nokogiri is installed locally (ruby platform)
2) Run bundle package. nokogiri-1.4.2.gem is cached
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 6eb727e449..32c9bf9e2b 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -72,7 +72,7 @@ module Bundler
if missing_specs
missing_specs << s unless spec
else
- raise "Could not materialize #{s.full_name}" unless spec
+ raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
end
spec if spec
end
diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb
new file mode 100644
index 0000000000..5137ea6060
--- /dev/null
+++ b/spec/runtime/platform_spec.rb
@@ -0,0 +1,34 @@
+require "spec_helper"
+
+describe "Bundler.setup with multi platform stuff" do
+ it "raises a friendly error when gems are missing locally" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ lockfile <<-G
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ rack (1.0)
+
+ PLATFORMS
+ #{local_tag}
+
+ DEPENDENCIES
+ rack
+ G
+
+ ruby <<-R
+ begin
+ require 'bundler'
+ Bundler.setup
+ rescue Bundler::GemNotFound => e
+ puts "WIN"
+ end
+ R
+
+ out.should == "WIN"
+ end
+end \ No newline at end of file