Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Output a better error message when top level dependencies conflict wi…
Browse files Browse the repository at this point in the history
…th the lockfile
  • Loading branch information
Carl Lerche committed Aug 3, 2010
1 parent 2de5e9e commit c1f4c1e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/bundler/resolver.rb
Expand Up @@ -254,7 +254,13 @@ def resolve(reqs, activated)

if matching_versions.empty?
if current.required_by.empty?
if current.source
if base = @base[current.name] and !base.empty?
version = base.first.version
message = "You have requested:\n" \
" #{current.name} #{current.requirement}\n\n" \
"The bundle currently has #{current.name} locked at #{version}.\n" \
"Try running `bundle update #{current.name}`"
elsif current.source
name = current.name
versions = @source_requirements[name][name].map { |s| s.version }
message = "Could not find gem '#{current}' in #{current.source}.\n"
Expand Down
31 changes: 30 additions & 1 deletion spec/install/gems/flex_spec.rb
Expand Up @@ -209,6 +209,35 @@
bundle :install
out.should == nice_error
end
end

describe "subtler cases" do
before :each do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
gem "rack-obama"
G

gemfile <<-G
source "file:://#{gem_repo1}"
gem "rack", "0.9.1"
gem "rack-obama"
G
end

it "does something" do
lambda {
bundle "install"
}.should_not change { File.read(bundled_app('Gemfile.lock')) }

out.should include('rack = 0.9.1')
out.should include('locked at 1.0.0')
out.should include('bundle update rack')
end

it "should work when you update" do
bundle "update rack"
end
end
end
end

0 comments on commit c1f4c1e

Please sign in to comment.