Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Persist the new rubygem sources to the lockfile

  • Loading branch information...
commit 02ec0fe36901001dfa27e575d180261ff7dafa76 1 parent fb6a5e5
Carl Lerche authored wycats committed
View
7 lib/bundler/definition.rb
@@ -293,6 +293,13 @@ def pretty_dep(dep, source = false)
end
def converge_sources
+ locked_gem = @locked_sources.find { |s| Source::Rubygems === s }
+ actual_gem = @sources.find { |s| Source::Rubygems === s }
+
+ if locked_gem && actual_gem
+ locked_gem.merge_remotes actual_gem
+ end
+
@sources.map! do |source|
@locked_sources.find { |s| s == source } || source
end
View
7 lib/bundler/source.rb
@@ -129,6 +129,13 @@ def add_remote(source)
@remotes << normalize_uri(source)
end
+ def merge_remotes(source)
+ @remotes = []
+ source.remotes.each do |r|
+ add_remote r.to_s
+ end
+ end
+
private
def cached_gem(spec)
View
31 spec/install/gems/flex_spec.rb
@@ -220,7 +220,7 @@
G
gemfile <<-G
- source "file:://#{gem_repo1}"
+ source "file://#{gem_repo1}"
gem "rack", "0.9.1"
gem "rack-obama"
G
@@ -240,4 +240,33 @@
bundle "update rack"
end
end
+
+ describe "when adding a new source" do
+ it "updates the lockfile" do
+ build_repo2
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ source "file://#{gem_repo2}"
+ gem "rack"
+ G
+
+ lockfile_should_be <<-L
+ GEM
+ remote: file:#{gem_repo1}/
+ remote: file:#{gem_repo2}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ ruby
+
+ DEPENDENCIES
+ rack
+ L
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.