Skip to content

Commit

Permalink
Rescue from spec materialization errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Lerche committed Jun 7, 2010
1 parent 171bfee commit b0e51cd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
1 change: 0 additions & 1 deletion TODO.md
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/spec_set.rb
Expand Up @@ -72,7 +72,7 @@ def materialize(deps, missing_specs = nil)
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
Expand Down
34 changes: 34 additions & 0 deletions 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

0 comments on commit b0e51cd

Please sign in to comment.