Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '1-1-stable'

  • Loading branch information...
commit ff04fa295f182b4fc8672aeab03929cac774935a 2 parents 47072f5 + 504ff2a
@hone hone authored
View
8 CHANGELOG.md
@@ -1,3 +1,11 @@
+## 1.1.0 (Mar 7, 2012)
+
+Bugfixes:
+
+ - Clean up corrupted lockfiles on bundle installs
+ - Prevent duplicate GIT sources
+ - Fix post_install_message when uing the endpoint API
+
## 1.1.rc.8 (Mar 3, 2012)
Performance:
View
6 lib/bundler/dsl.rb
@@ -110,7 +110,11 @@ def source(source, options = {})
return
else
@source = source
- options[:prepend] ? @sources.unshift(@source) : @sources << @source
+ if options[:prepend]
+ @sources = [@source] | @sources
+ else
+ @sources = @sources | [@source]
+ end
yield if block_given?
return @source
View
5 lib/bundler/lazy_specification.rb
@@ -25,6 +25,11 @@ def full_name
end
end
+ def ==(other)
+ [name, version, dependencies, platform, source] ==
+ [other.name, other.version, other.dependencies, other.platform, other.source]
+ end
+
def satisfies?(dependency)
@name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
end
View
21 lib/bundler/lockfile_parser.rb
@@ -1,5 +1,15 @@
require "strscan"
+# Some versions of the Bundler 1.1 RC series introduced corrupted
+# lockfiles. There were two major problems:
+#
+# * multiple copies of the same GIT section appeared in the lockfile
+# * when this happened, those sections got multiple copies of gems
+# in those sections.
+#
+# As a result, Bundler 1.1 contains code that fixes the earlier
+# corruption. We will remove this fix-up code in Bundler 1.2.
+
module Bundler
class LockfileParser
attr_reader :sources, :dependencies, :specs, :platforms
@@ -37,6 +47,12 @@ def parse_source(line)
@opts, @type = {}, line
when " specs:"
@current_source = TYPES[@type].from_lock(@opts)
+
+ # Strip out duplicate GIT sections
+ if @sources.include?(@current_source)
+ @current_source = @sources.find { |s| s == @current_source }
+ end
+
@sources << @current_source
when /^ ([a-z]+): (.*)$/i
value = $2
@@ -89,7 +105,10 @@ def parse_spec(line)
platform = $3 ? Gem::Platform.new($3) : Gem::Platform::RUBY
@current_spec = LazySpecification.new(name, version, platform)
@current_spec.source = @current_source
- @specs << @current_spec
+
+ # Avoid introducing multiple copies of the same spec (caused by
+ # duplicate GIT sections)
+ @specs << @current_spec unless @specs.include?(@current_spec)
elsif line =~ %r{^ {6}#{NAME_VERSION}$}
name, version = $1, $2
version = version.split(',').map { |d| d.strip } if version
View
2  lib/bundler/version.rb
@@ -2,5 +2,5 @@ module Bundler
# We're doing this because we might write tests that deal
# with other versions of bundler and we are unsure how to
# handle this better.
- VERSION = "1.1.rc.8" unless defined?(::Bundler::VERSION)
+ VERSION = "1.1.0" unless defined?(::Bundler::VERSION)
end
View
16 spec/install/git_spec.rb
@@ -478,6 +478,22 @@
exitstatus.should == 0
end
+ it "does not duplicate git gem sources" do
+ build_lib "foo", :path => lib_path('nested/foo')
+ build_lib "bar", :path => lib_path('nested/bar')
+
+ build_git "foo", :path => lib_path('nested')
+ build_git "bar", :path => lib_path('nested')
+
+ gemfile <<-G
+ gem "foo", :git => "#{lib_path('nested')}"
+ gem "bar", :git => "#{lib_path('nested')}"
+ G
+
+ bundle "install"
+ File.read(bundled_app("Gemfile.lock")).scan('GIT').size.should == 1
+ end
+
describe "switching sources" do
it "doesn't explode when switching Path to Git sources" do
build_gem "foo", "1.0", :to_system => true do |s|
View
70 spec/lock/lockfile_spec.rb
@@ -670,6 +670,76 @@
end
+ # Some versions of the Bundler 1.1 RC series introduced corrupted
+ # lockfiles. There were two major problems:
+ #
+ # * multiple copies of the same GIT section appeared in the lockfile
+ # * when this happened, those sections got multiple copies of gems
+ # in those sections.
+ it "fix corrupted lockfiles" do
+ build_git "omg", :path => lib_path('omg')
+ revision = revision_for(lib_path('omg'))
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "omg", :git => "#{lib_path('omg')}", :branch => 'master'
+ G
+
+ bundle "install --path vendor"
+ should_be_installed "omg 1.0"
+
+ # Create a Gemfile.lock that has duplicate GIT sections
+ lockfile <<-L
+ GIT
+ remote: #{lib_path('omg')}
+ revision: #{revision}
+ branch: master
+ specs:
+ omg (1.0)
+
+ GIT
+ remote: #{lib_path('omg')}
+ revision: #{revision}
+ branch: master
+ specs:
+ omg (1.0)
+
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+
+ PLATFORMS
+ #{local}
+
+ DEPENDENCIES
+ omg!
+ L
+
+ FileUtils.rm_rf(bundled_app('vendor'))
+ bundle "install"
+ should_be_installed "omg 1.0"
+
+ # Confirm that duplicate specs do not appear
+ File.read(bundled_app('Gemfile.lock')).should == strip_whitespace(<<-L)
+ GIT
+ remote: #{lib_path('omg')}
+ revision: #{revision}
+ branch: master
+ specs:
+ omg (1.0)
+
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+
+ PLATFORMS
+ #{local}
+
+ DEPENDENCIES
+ omg!
+ L
+ end
+
describe "line endings" do
def set_lockfile_mtime_to_known_value
time = Time.local(2000, 1, 1, 0, 0, 0)
View
6 spec/support/helpers.rb
@@ -162,6 +162,12 @@ def lockfile(*args)
end
end
+ def strip_whitespace(str)
+ # Trim the leading spaces
+ spaces = str[/\A\s+/, 0] || ""
+ str.gsub(/^#{spaces}/, '')
+ end
+
def install_gemfile(*args)
gemfile(*args)
opts = args.last.is_a?(Hash) ? args.last : {}
Please sign in to comment.
Something went wrong with that request. Please try again.