bundler 1.0.3 → 1.0.5

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.

Files changed (64) hide show
  1. data/.gitignore +10 -3
  2. data/CHANGELOG.md +31 -0
  3. data/ISSUES.md +16 -1
  4. data/LICENSE +2 -1
  5. data/Rakefile +39 -13
  6. data/bin/bundle +1 -1
  7. data/lib/bundler.rb +7 -19
  8. data/lib/bundler/capistrano.rb +0 -1
  9. data/lib/bundler/cli.rb +10 -6
  10. data/lib/bundler/definition.rb +23 -9
  11. data/lib/bundler/dependency.rb +7 -2
  12. data/lib/bundler/deployment.rb +25 -9
  13. data/lib/bundler/dsl.rb +3 -2
  14. data/lib/bundler/gem_helper.rb +25 -26
  15. data/lib/bundler/installer.rb +1 -0
  16. data/lib/bundler/resolver.rb +27 -14
  17. data/lib/bundler/rubygems_ext.rb +9 -6
  18. data/lib/bundler/runtime.rb +1 -1
  19. data/lib/bundler/setup.rb +1 -0
  20. data/lib/bundler/shared_helpers.rb +11 -4
  21. data/lib/bundler/source.rb +24 -15
  22. data/lib/bundler/ui.rb +11 -1
  23. data/lib/bundler/version.rb +1 -1
  24. data/lib/bundler/vlad.rb +1 -1
  25. data/man/bundle-exec.ronn +13 -0
  26. data/man/bundle-install.ronn +6 -3
  27. data/man/bundle.ronn +4 -1
  28. data/spec/cache/gems_spec.rb +14 -0
  29. data/spec/cache/git_spec.rb +1 -1
  30. data/spec/install/deploy_spec.rb +23 -4
  31. data/spec/install/gems/flex_spec.rb +41 -0
  32. data/spec/install/gems/groups_spec.rb +1 -1
  33. data/spec/install/gems/platform_spec.rb +4 -21
  34. data/spec/install/gems/simple_case_spec.rb +21 -14
  35. data/spec/install/gems/sudo_spec.rb +2 -2
  36. data/spec/install/gems/win32_spec.rb +1 -1
  37. data/spec/install/git_spec.rb +23 -5
  38. data/spec/install/path_spec.rb +31 -7
  39. data/spec/lock/{flex_spec.rb → lockfile_spec.rb} +33 -0
  40. data/spec/other/check_spec.rb +7 -7
  41. data/spec/other/config_spec.rb +2 -2
  42. data/spec/other/exec_spec.rb +6 -6
  43. data/spec/other/ext_spec.rb +2 -2
  44. data/spec/other/gem_helper_spec.rb +18 -6
  45. data/spec/other/help_spec.rb +1 -1
  46. data/spec/other/init_spec.rb +3 -3
  47. data/spec/quality_spec.rb +3 -0
  48. data/spec/resolver/platform_spec.rb +29 -4
  49. data/spec/runtime/load_spec.rb +47 -42
  50. data/spec/runtime/require_spec.rb +1 -1
  51. data/spec/runtime/setup_spec.rb +168 -2
  52. data/spec/spec_helper.rb +2 -1
  53. data/spec/support/builders.rb +18 -10
  54. data/spec/support/helpers.rb +7 -11
  55. data/spec/support/indexes.rb +3 -4
  56. data/spec/support/matchers.rb +1 -1
  57. data/spec/support/path.rb +1 -1
  58. data/spec/support/platforms.rb +5 -1
  59. data/spec/support/sudo.rb +1 -1
  60. data/spec/update/gems_spec.rb +26 -0
  61. data/spec/update/git_spec.rb +25 -2
  62. data/spec/update/source_spec.rb +2 -1
  63. metadata +6 -8
  64. data/spec/runtime/environment_rb_spec.rb +0 -162
@@ -16,7 +16,7 @@ describe "bundle install with win32-generated lockfile" do
16
16
  f << " rack\r\n"
17
17
  end
18
18
 
19
- install_gemfile <<-G, :exit_status => true
19
+ install_gemfile <<-G, :exitstatus => true
20
20
  source "file://#{gem_repo1}"
21
21
 
22
22
  gem "rack"
@@ -68,7 +68,7 @@ describe "bundle install with git sources" do
68
68
  end
69
69
 
70
70
  it "still works after moving the application directory" do
71
- bundle "install vendor"
71
+ bundle "install --path vendor/bundle"
72
72
  FileUtils.mv bundled_app, tmp('bundled_app.bck')
73
73
 
74
74
  Dir.chdir tmp('bundled_app.bck')
@@ -76,7 +76,7 @@ describe "bundle install with git sources" do
76
76
  end
77
77
 
78
78
  it "can still install after moving the application directory" do
79
- bundle "install vendor"
79
+ bundle "install --path vendor/bundle"
80
80
  FileUtils.mv bundled_app, tmp('bundled_app.bck')
81
81
 
82
82
  update_git "foo", "1.1", :path => lib_path("foo-1.0")
@@ -118,11 +118,13 @@ describe "bundle install with git sources" do
118
118
  end
119
119
 
120
120
  describe "when specifying a revision" do
121
- it "works" do
121
+ before(:each) do
122
122
  build_git "foo"
123
123
  @revision = revision_for(lib_path("foo-1.0"))
124
124
  update_git "foo"
125
+ end
125
126
 
127
+ it "works" do
126
128
  install_gemfile <<-G
127
129
  git "#{lib_path('foo-1.0')}", :ref => "#{@revision}" do
128
130
  gem "foo"
@@ -136,6 +138,22 @@ describe "bundle install with git sources" do
136
138
 
137
139
  out.should == "WIN"
138
140
  end
141
+
142
+ it "works when the revision is a symbol" do
143
+ install_gemfile <<-G
144
+ git "#{lib_path('foo-1.0')}", :ref => #{@revision.to_sym.inspect} do
145
+ gem "foo"
146
+ end
147
+ G
148
+ check err.should == ""
149
+
150
+ run <<-RUBY
151
+ require 'foo'
152
+ puts "WIN" unless defined?(FOO_PREV_REF)
153
+ RUBY
154
+
155
+ out.should == "WIN"
156
+ end
139
157
  end
140
158
 
141
159
  describe "specified inline" do
@@ -457,7 +475,7 @@ describe "bundle install with git sources" do
457
475
  G
458
476
 
459
477
  bundle "install"
460
- bundle "install", :exit_status => true
478
+ bundle "install", :exitstatus => true
461
479
  exitstatus.should == 0
462
480
  end
463
481
 
@@ -546,7 +564,7 @@ describe "bundle install with git sources" do
546
564
 
547
565
  simulate_new_machine
548
566
 
549
- bundle "install --deployment", :exit_status => true
567
+ bundle "install --deployment", :exitstatus => true
550
568
  exitstatus.should == 0
551
569
  end
552
570
  end
@@ -46,6 +46,30 @@ describe "bundle install with explicit source paths" do
46
46
  should_be_installed("foo 1.0")
47
47
  end
48
48
 
49
+ it "expands paths relative to Bundler.root" do
50
+ build_lib "foo", :path => bundled_app("foo-1.0")
51
+
52
+ install_gemfile <<-G
53
+ gem 'foo', :path => "./foo-1.0"
54
+ G
55
+
56
+ bundled_app("subdir").mkpath
57
+ Dir.chdir(bundled_app("subdir")) do
58
+ should_be_installed("foo 1.0")
59
+ end
60
+ end
61
+
62
+ it "expands paths when comparing locked paths to Gemfile paths" do
63
+ build_lib "foo", :path => bundled_app("foo-1.0")
64
+
65
+ install_gemfile <<-G
66
+ gem 'foo', :path => File.expand_path("../foo-1.0", __FILE__)
67
+ G
68
+
69
+ bundle "install --frozen", :exitstatus => true
70
+ exitstatus.should == 0
71
+ end
72
+
49
73
  it "installs dependencies from the path even if a newer gem is available elsewhere" do
50
74
  system_gems "rack-1.0.0"
51
75
 
@@ -122,11 +146,11 @@ describe "bundle install with explicit source paths" do
122
146
  s.write "bar.gemspec"
123
147
  end
124
148
 
125
- install_gemfile <<-G, :exit_status => true
149
+ install_gemfile <<-G, :exitstatus => true
126
150
  gemspec :path => "#{lib_path("foo")}"
127
151
  G
128
152
 
129
- @exitstatus.should == 15
153
+ check exitstatus.should == 15
130
154
  out.should =~ /There are multiple gemspecs/
131
155
  end
132
156
 
@@ -135,7 +159,7 @@ describe "bundle install with explicit source paths" do
135
159
  s.write "bar.gemspec"
136
160
  end
137
161
 
138
- install_gemfile <<-G, :exit_status => true
162
+ install_gemfile <<-G, :exitstatus => true
139
163
  gemspec :path => "#{lib_path("foo")}", :name => "foo"
140
164
  G
141
165
 
@@ -287,12 +311,12 @@ describe "bundle install with explicit source paths" do
287
311
  end
288
312
 
289
313
  install_gemfile <<-G
290
- source "http://#{gem_repo1}"
314
+ source "file://#{gem_repo1}"
291
315
  gem "bar", :git => "#{lib_path('bar')}"
292
316
  G
293
317
 
294
318
  install_gemfile <<-G
295
- source "http://#{gem_repo1}"
319
+ source "file://#{gem_repo1}"
296
320
  gem "bar", :path => "#{lib_path('bar')}"
297
321
  G
298
322
 
@@ -306,7 +330,7 @@ describe "bundle install with explicit source paths" do
306
330
  end
307
331
 
308
332
  install_gemfile <<-G
309
- source "http://#{gem_repo1}"
333
+ source "file://#{gem_repo1}"
310
334
  gem "bar"
311
335
  path "#{lib_path('foo')}" do
312
336
  gem "foo"
@@ -316,7 +340,7 @@ describe "bundle install with explicit source paths" do
316
340
  build_lib "bar", "1.0", :path => lib_path("foo/bar")
317
341
 
318
342
  install_gemfile <<-G
319
- source "http://#{gem_repo1}"
343
+ source "file://#{gem_repo1}"
320
344
  path "#{lib_path('foo')}" do
321
345
  gem "foo"
322
346
  gem "bar"
@@ -647,4 +647,37 @@ describe "the lockfile format" do
647
647
  G
648
648
 
649
649
  end
650
+
651
+ context "line endings" do
652
+ before(:each) do
653
+ build_repo2
654
+ install_gemfile <<-G
655
+ source "file://#{gem_repo2}"
656
+ gem "rack"
657
+ G
658
+ end
659
+
660
+ it "generates Gemfile.lock with \\n line endings" do
661
+ File.read(bundled_app("Gemfile.lock")).should_not match("\r\n")
662
+ should_be_installed "rack 1.0"
663
+ end
664
+
665
+ it "preserves Gemfile.lock \\n line endings" do
666
+ update_repo2
667
+
668
+ bundle "update"
669
+ File.read(bundled_app("Gemfile.lock")).should_not match("\r\n")
670
+ should_be_installed "rack 1.2"
671
+ end
672
+
673
+ it "preserves Gemfile.lock \\n\\r line endings" do
674
+ update_repo2
675
+ win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
676
+ File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
677
+
678
+ bundle "update"
679
+ File.read(bundled_app("Gemfile.lock")).should match("\r\n")
680
+ should_be_installed "rack 1.2"
681
+ end
682
+ end
650
683
  end
@@ -7,7 +7,7 @@ describe "bundle check" do
7
7
  gem "rails"
8
8
  G
9
9
 
10
- bundle :check, :exit_status => true
10
+ bundle :check, :exitstatus => true
11
11
  check @exitstatus.should == 0
12
12
  out.should == "The Gemfile's dependencies are satisfied"
13
13
  end
@@ -54,7 +54,7 @@ describe "bundle check" do
54
54
  gem "rails"
55
55
  G
56
56
 
57
- bundle :check, :exit_status => true
57
+ bundle :check, :exitstatus => true
58
58
  check @exitstatus.should > 0
59
59
  out.should include("could not be satisfied")
60
60
  end
@@ -88,7 +88,7 @@ describe "bundle check" do
88
88
  G
89
89
 
90
90
  bundle "install --without foo"
91
- bundle "check", :exit_status => true
91
+ bundle "check", :exitstatus => true
92
92
  check @exitstatus.should == 0
93
93
  out.should include("The Gemfile's dependencies are satisfied")
94
94
  end
@@ -106,7 +106,7 @@ describe "bundle check" do
106
106
  gem "rack"
107
107
  G
108
108
 
109
- bundle "check", :exit_status => true
109
+ bundle "check", :exitstatus => true
110
110
  out.should include("* rack (1.0.0)")
111
111
  @exitstatus.should == 1
112
112
  end
@@ -174,7 +174,7 @@ describe "bundle check" do
174
174
  end
175
175
 
176
176
  it "outputs an error when the default Gemfile is not found" do
177
- bundle :check, :exit_status => true
177
+ bundle :check, :exitstatus => true
178
178
  check @exitstatus.should == 10
179
179
  out.should include("Could not locate Gemfile")
180
180
  end
@@ -190,7 +190,7 @@ describe "bundle check" do
190
190
  last_out = out
191
191
  3.times do |i|
192
192
  bundle :check
193
- out.should == last_out
193
+ check out.should == last_out
194
194
  err.should be_empty
195
195
  end
196
196
  end
@@ -206,7 +206,7 @@ describe "bundle check" do
206
206
 
207
207
  it "returns success when the Gemfile is satisfied" do
208
208
  bundle :install
209
- bundle :check, :exit_status => true
209
+ bundle :check, :exitstatus => true
210
210
  check @exitstatus.should == 0
211
211
  out.should == "The Gemfile's dependencies are satisfied"
212
212
  end
@@ -10,7 +10,7 @@ describe ".bundle/config" do
10
10
 
11
11
  it "can be moved with an environment variable" do
12
12
  ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
13
- bundle "install vendor"
13
+ bundle "install --path vendor/bundle"
14
14
 
15
15
  bundled_app('.bundle').should_not exist
16
16
  tmp('foo/bar/config').should exist
@@ -22,7 +22,7 @@ describe ".bundle/config" do
22
22
  Dir.chdir bundled_app('omg')
23
23
 
24
24
  ENV['BUNDLE_APP_CONFIG'] = "../foo"
25
- bundle "install vendor"
25
+ bundle "install --path vendor/bundle"
26
26
 
27
27
  bundled_app(".bundle").should_not exist
28
28
  bundled_app("../foo/config").should exist
@@ -97,8 +97,8 @@ describe "bundle exec" do
97
97
  gem "rack"
98
98
  G
99
99
 
100
- bundle "exec foobarbaz", :exit_status => true
101
- @exitstatus.should == 127
100
+ bundle "exec foobarbaz", :exitstatus => true
101
+ check exitstatus.should == 127
102
102
  out.should include("bundler: command not found: foobarbaz")
103
103
  out.should include("Install missing gem binaries with `bundle install`")
104
104
  end
@@ -109,8 +109,8 @@ describe "bundle exec" do
109
109
  G
110
110
 
111
111
  bundle "exec touch foo"
112
- bundle "exec ./foo", :exit_status => true
113
- @exitstatus.should == 126
112
+ bundle "exec ./foo", :exitstatus => true
113
+ check exitstatus.should == 126
114
114
  out.should include("bundler: not executable: ./foo")
115
115
  end
116
116
 
@@ -217,11 +217,11 @@ describe "bundle exec" do
217
217
  gem "rack"
218
218
  G
219
219
 
220
- bundle "install vendor --disable-shared-gems"
220
+ bundle "install --path vendor/bundle --disable-shared-gems"
221
221
  end
222
222
 
223
223
  it "does not explode with --disable-shared-gems" do
224
- bundle "exec bundle check", :exit_status => true
224
+ bundle "exec bundle check", :exitstatus => true
225
225
  exitstatus.should == 0
226
226
  end
227
227
 
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Gem::Specification#match_platform" do
4
- it "works" do
4
+ it "does not match platforms other than the gem platform" do
5
5
  darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10"
6
6
  darwin.match_platform(pl('java')).should be_false
7
7
  end
@@ -10,7 +10,7 @@ end
10
10
  describe "Bundler::GemHelpers#generic" do
11
11
  include Bundler::GemHelpers
12
12
 
13
- it "works" do
13
+ it "converts non-windows platforms into ruby" do
14
14
  generic(pl('x86-darwin-10')).should == pl('ruby')
15
15
  end
16
16
  end
@@ -73,7 +73,9 @@ describe "Bundler::GemHelper tasks" do
73
73
  @helper.should_receive(:build_gem) do
74
74
  # write an invalid gem file, so we can simulate install failure...
75
75
  FileUtils.mkdir_p(File.join(@app.to_s, 'pkg'))
76
- File.open("#{@app.to_s}/pkg/test-0.0.1.gem", 'w'){|f| f << "not actually a gem"}
76
+ path = "#{@app.to_s}/pkg/test-0.0.1.gem"
77
+ File.open(path, 'w'){|f| f << "not actually a gem"}
78
+ path
77
79
  end
78
80
  proc { @helper.install_gem }.should raise_error
79
81
  end
@@ -87,23 +89,33 @@ describe "Bundler::GemHelper tasks" do
87
89
  it 'raises an appropriate error if there is no git remote' do
88
90
  Bundler.ui.stub(:confirm => nil, :error => nil) # silence messages
89
91
 
92
+ Dir.chdir(gem_repo1) {
93
+ `git init --bare`
94
+ }
90
95
  Dir.chdir(@app) {
91
- `git init --bare #{gem_repo1}`
96
+ `git init`
97
+ `git config user.email "you@example.com"`
98
+ `git config user.name "name"`
92
99
  `git commit -a -m "initial commit"`
93
100
  }
94
101
 
95
- proc { @helper.release_gem }.should raise_error(/No destination configured to push to/)
102
+ proc { @helper.release_gem }.should raise_error
96
103
  end
97
104
 
98
105
  it "releases" do
99
106
  mock_build_message
100
- mock_confirm_message /Tagged [\da-f]+ with v0.0.1/
101
- mock_confirm_message "Pushed git commits and tags"
107
+ mock_confirm_message(/Tagged v0.0.1/)
108
+ mock_confirm_message("Pushed git commits and tags")
102
109
 
103
110
  @helper.should_receive(:rubygem_push).with(bundled_app('test/pkg/test-0.0.1.gem').to_s)
104
111
 
112
+ Dir.chdir(gem_repo1) {
113
+ `git init --bare`
114
+ }
105
115
  Dir.chdir(@app) {
106
- `git init --bare #{gem_repo1}`
116
+ `git init`
117
+ `git config user.email "you@example.com"`
118
+ `git config user.name "name"`
107
119
  `git remote add origin file://#{gem_repo1}`
108
120
  `git commit -a -m "initial commit"`
109
121
  Open3.popen3("git push origin master") # use popen3 to silence output...
@@ -25,7 +25,7 @@ describe "bundle help" do
25
25
  it "simply outputs the txt file when there is no groff on the path" do
26
26
  kill_path!
27
27
 
28
- bundle "help install"
28
+ bundle "help install", :expect_err => true
29
29
  out.should =~ /BUNDLE-INSTALL/
30
30
  end
31
31
 
@@ -32,9 +32,9 @@ describe "bundle init" do
32
32
 
33
33
  gemfile = bundled_app("Gemfile").read
34
34
  gemfile.should =~ /source :gemcutter/
35
- gemfile.scan(/gem "rack", "= 1.0.1"/).size.should == 1
36
- gemfile.scan(/gem "rspec", "= 1.2"/).size.should == 1
37
- gemfile.scan(/group :development/).size.should == 1
35
+ check gemfile.scan(/gem "rack", "= 1.0.1"/).size.should == 1
36
+ check gemfile.scan(/gem "rspec", "= 1.2"/).size.should == 1
37
+ check gemfile.scan(/group :development/).size.should == 1
38
38
  end
39
39
 
40
40
  end
data/spec/quality_spec.rb CHANGED
@@ -50,6 +50,9 @@ describe "The library itself" do
50
50
  Dir.chdir(root) do
51
51
  `gem build bundler.gemspec`
52
52
  $?.should == 0
53
+
54
+ # clean up the .gem generated
55
+ system("rm bundler-#{Bundler::VERSION}.gem")
53
56
  end
54
57
  end
55
58
  end
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "Resolving platform craziness" do
4
- describe "with semi real cases" do
4
+ describe "with cross-platform gems" do
5
5
  before :each do
6
6
  @index = an_awesome_index
7
7
  end
@@ -13,14 +13,14 @@ describe "Resolving platform craziness" do
13
13
  should_resolve_as %w(nokogiri-1.4.2 nokogiri-1.4.2-java weakling-0.0.3)
14
14
  end
15
15
 
16
- it "doesn't pull gems when it doesn't exist for the current platform" do
16
+ it "doesn't pull gems that don't exist for the current platform" do
17
17
  dep "nokogiri"
18
18
  platforms "ruby"
19
19
 
20
20
  should_resolve_as %w(nokogiri-1.4.2)
21
21
  end
22
22
 
23
- it "doesn't pulls gems when the version is available for all requested platforms" do
23
+ it "doesn't pull gems when the version is available for all requested platforms" do
24
24
  dep "nokogiri"
25
25
  platforms "mswin32"
26
26
 
@@ -28,6 +28,31 @@ describe "Resolving platform craziness" do
28
28
  end
29
29
  end
30
30
 
31
+ describe "with mingw32" do
32
+
33
+ before :each do
34
+ @index = build_index do
35
+ platforms "mingw32 mswin32" do |platform|
36
+ gem "thin", "1.2.7", platform
37
+ end
38
+ end
39
+ end
40
+
41
+ it "finds mswin gems" do
42
+ # win32 is hardcoded to get CPU x86 in rubygems
43
+ platforms "mswin32"
44
+ dep "thin"
45
+ should_resolve_as %w(thin-1.2.7-x86-mswin32)
46
+ end
47
+
48
+ it "finds mingw gems" do
49
+ # mingw is _not_ hardcoded to add CPU x86 in rubygems
50
+ platforms "x86-mingw32"
51
+ dep "thin"
52
+ should_resolve_as %w(thin-1.2.7-x86-mingw32)
53
+ end
54
+ end
55
+
31
56
  describe "with conflicting cases" do
32
57
  before :each do
33
58
  @index = build_index do
@@ -47,7 +72,7 @@ describe "Resolving platform craziness" do
47
72
  end
48
73
  end
49
74
 
50
- it "does something" do
75
+ it "reports on the conflict" do
51
76
  platforms "ruby", "java"
52
77
  dep "foo"
53
78