bundler 1.1.rc.8 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

@@ -1,4 +1,12 @@
1
- ## 1.1.rc.8 (Jan 13, 2011)
1
+ ## 1.1.0 (Mar 7, 2012)
2
+
3
+ Bugfixes:
4
+
5
+ - Clean up corrupted lockfiles on bundle installs
6
+ - Prevent duplicate GIT sources
7
+ - Fix post_install_message when uing the endpoint API
8
+
9
+ ## 1.1.rc.8 (Mar 3, 2012)
2
10
 
3
11
  Performance:
4
12
 
@@ -104,7 +104,11 @@ module Bundler
104
104
  return
105
105
  else
106
106
  @source = source
107
- options[:prepend] ? @sources.unshift(@source) : @sources << @source
107
+ if options[:prepend]
108
+ @sources = [@source] | @sources
109
+ else
110
+ @sources = @sources | [@source]
111
+ end
108
112
 
109
113
  yield if block_given?
110
114
  return @source
@@ -53,6 +53,15 @@ module Bundler
53
53
  end
54
54
  end
55
55
 
56
+ # needed for post_install_messages during install
57
+ def post_install_message
58
+ if @remote_specification
59
+ @remote_specification.post_install_message
60
+ elsif _local_specification
61
+ _local_specification.post_install_message
62
+ end
63
+ end
64
+
56
65
  def _local_specification
57
66
  eval(File.read(local_specification_path)) if @loaded_from && File.exists?(local_specification_path)
58
67
  end
@@ -25,6 +25,11 @@ module Bundler
25
25
  end
26
26
  end
27
27
 
28
+ def ==(other)
29
+ [name, version, dependencies, platform, source] ==
30
+ [other.name, other.version, other.dependencies, other.platform, other.source]
31
+ end
32
+
28
33
  def satisfies?(dependency)
29
34
  @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
30
35
  end
@@ -1,5 +1,15 @@
1
1
  require "strscan"
2
2
 
3
+ # Some versions of the Bundler 1.1 RC series introduced corrupted
4
+ # lockfiles. There were two major problems:
5
+ #
6
+ # * multiple copies of the same GIT section appeared in the lockfile
7
+ # * when this happened, those sections got multiple copies of gems
8
+ # in those sections.
9
+ #
10
+ # As a result, Bundler 1.1 contains code that fixes the earlier
11
+ # corruption. We will remove this fix-up code in Bundler 1.2.
12
+
3
13
  module Bundler
4
14
  class LockfileParser
5
15
  attr_reader :sources, :dependencies, :specs, :platforms
@@ -37,6 +47,12 @@ module Bundler
37
47
  @opts, @type = {}, line
38
48
  when " specs:"
39
49
  @current_source = TYPES[@type].from_lock(@opts)
50
+
51
+ # Strip out duplicate GIT sections
52
+ if @sources.include?(@current_source)
53
+ @current_source = @sources.find { |s| s == @current_source }
54
+ end
55
+
40
56
  @sources << @current_source
41
57
  when /^ ([a-z]+): (.*)$/i
42
58
  value = $2
@@ -89,7 +105,10 @@ module Bundler
89
105
  platform = $3 ? Gem::Platform.new($3) : Gem::Platform::RUBY
90
106
  @current_spec = LazySpecification.new(name, version, platform)
91
107
  @current_spec.source = @current_source
92
- @specs << @current_spec
108
+
109
+ # Avoid introducing multiple copies of the same spec (caused by
110
+ # duplicate GIT sections)
111
+ @specs << @current_spec unless @specs.include?(@current_spec)
93
112
  elsif line =~ %r{^ {6}#{NAME_VERSION}$}
94
113
  name, version = $1, $2
95
114
  version = version.split(',').map { |d| d.strip } if version
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.1.rc.8" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.1.0" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -312,6 +312,27 @@ OUTPUT
312
312
  vendored_gems("bin/rackup").should exist
313
313
  end
314
314
 
315
+ it "prints post_install_messages" do
316
+ gemfile <<-G
317
+ source "#{source_uri}"
318
+ gem 'rack-obama'
319
+ G
320
+
321
+ bundle :install, :artifice => "endpoint"
322
+ out.should include("Post-install message from rack:")
323
+ end
324
+
325
+ it "should display the post install message for a dependency" do
326
+ gemfile <<-G
327
+ source "#{source_uri}"
328
+ gem 'rack_middleware'
329
+ G
330
+
331
+ bundle :install, :artifice => "endpoint"
332
+ out.should include("Post-install message from rack:")
333
+ out.should include("Rack's post install message")
334
+ end
335
+
315
336
  context "when using basic authentication" do
316
337
  let(:user) { "user" }
317
338
  let(:password) { "pass" }
@@ -478,6 +478,22 @@ describe "bundle install with git sources" do
478
478
  exitstatus.should == 0
479
479
  end
480
480
 
481
+ it "does not duplicate git gem sources" do
482
+ build_lib "foo", :path => lib_path('nested/foo')
483
+ build_lib "bar", :path => lib_path('nested/bar')
484
+
485
+ build_git "foo", :path => lib_path('nested')
486
+ build_git "bar", :path => lib_path('nested')
487
+
488
+ gemfile <<-G
489
+ gem "foo", :git => "#{lib_path('nested')}"
490
+ gem "bar", :git => "#{lib_path('nested')}"
491
+ G
492
+
493
+ bundle "install"
494
+ File.read(bundled_app("Gemfile.lock")).scan('GIT').size.should == 1
495
+ end
496
+
481
497
  describe "switching sources" do
482
498
  it "doesn't explode when switching Path to Git sources" do
483
499
  build_gem "foo", "1.0", :to_system => true do |s|
@@ -670,6 +670,76 @@ describe "the lockfile format" do
670
670
 
671
671
  end
672
672
 
673
+ # Some versions of the Bundler 1.1 RC series introduced corrupted
674
+ # lockfiles. There were two major problems:
675
+ #
676
+ # * multiple copies of the same GIT section appeared in the lockfile
677
+ # * when this happened, those sections got multiple copies of gems
678
+ # in those sections.
679
+ it "fix corrupted lockfiles" do
680
+ build_git "omg", :path => lib_path('omg')
681
+ revision = revision_for(lib_path('omg'))
682
+
683
+ gemfile <<-G
684
+ source "file://#{gem_repo1}"
685
+ gem "omg", :git => "#{lib_path('omg')}", :branch => 'master'
686
+ G
687
+
688
+ bundle "install --path vendor"
689
+ should_be_installed "omg 1.0"
690
+
691
+ # Create a Gemfile.lock that has duplicate GIT sections
692
+ lockfile <<-L
693
+ GIT
694
+ remote: #{lib_path('omg')}
695
+ revision: #{revision}
696
+ branch: master
697
+ specs:
698
+ omg (1.0)
699
+
700
+ GIT
701
+ remote: #{lib_path('omg')}
702
+ revision: #{revision}
703
+ branch: master
704
+ specs:
705
+ omg (1.0)
706
+
707
+ GEM
708
+ remote: file:#{gem_repo1}/
709
+ specs:
710
+
711
+ PLATFORMS
712
+ #{local}
713
+
714
+ DEPENDENCIES
715
+ omg!
716
+ L
717
+
718
+ FileUtils.rm_rf(bundled_app('vendor'))
719
+ bundle "install"
720
+ should_be_installed "omg 1.0"
721
+
722
+ # Confirm that duplicate specs do not appear
723
+ File.read(bundled_app('Gemfile.lock')).should == strip_whitespace(<<-L)
724
+ GIT
725
+ remote: #{lib_path('omg')}
726
+ revision: #{revision}
727
+ branch: master
728
+ specs:
729
+ omg (1.0)
730
+
731
+ GEM
732
+ remote: file:#{gem_repo1}/
733
+ specs:
734
+
735
+ PLATFORMS
736
+ #{local}
737
+
738
+ DEPENDENCIES
739
+ omg!
740
+ L
741
+ end
742
+
673
743
  describe "line endings" do
674
744
  def set_lockfile_mtime_to_known_value
675
745
  time = Time.local(2000, 1, 1, 0, 0, 0)
@@ -162,6 +162,12 @@ module Spec
162
162
  end
163
163
  end
164
164
 
165
+ def strip_whitespace(str)
166
+ # Trim the leading spaces
167
+ spaces = str[/\A\s+/, 0] || ""
168
+ str.gsub(/^#{spaces}/, '')
169
+ end
170
+
165
171
  def install_gemfile(*args)
166
172
  gemfile(*args)
167
173
  opts = args.last.is_a?(Hash) ? args.last : {}
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424237
5
- prerelease: 4
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - rc
10
- - 8
11
- version: 1.1.rc.8
9
+ - 0
10
+ version: 1.1.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - "Andr\xC3\xA9 Arko"
@@ -19,7 +18,7 @@ autorequire:
19
18
  bindir: bin
20
19
  cert_chain: []
21
20
 
22
- date: 2012-03-03 00:00:00 Z
21
+ date: 2012-03-07 00:00:00 Z
23
22
  dependencies:
24
23
  - !ruby/object:Gem::Dependency
25
24
  name: ronn
@@ -281,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
280
  requirements: []
282
281
 
283
282
  rubyforge_project: bundler
284
- rubygems_version: 1.8.11
283
+ rubygems_version: 1.8.17
285
284
  signing_key:
286
285
  specification_version: 3
287
286
  summary: The best way to manage your application's dependencies