bundler 1.4.0.rc.1 → 1.5.0.rc.1

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 (58) hide show
  1. data/.travis.yml +18 -15
  2. data/CHANGELOG.md +23 -2
  3. data/Rakefile +3 -1
  4. data/bundler.gemspec +1 -1
  5. data/lib/bundler.rb +3 -2
  6. data/lib/bundler/capistrano.rb +1 -0
  7. data/lib/bundler/cli.rb +19 -5
  8. data/lib/bundler/definition.rb +6 -2
  9. data/lib/bundler/dsl.rb +7 -3
  10. data/lib/bundler/endpoint_specification.rb +1 -1
  11. data/lib/bundler/fetcher.rb +22 -41
  12. data/lib/bundler/installer.rb +1 -11
  13. data/lib/bundler/lazy_specification.rb +1 -1
  14. data/lib/bundler/parallel_workers/unix_worker.rb +6 -0
  15. data/lib/bundler/remote_specification.rb +1 -1
  16. data/lib/bundler/retry.rb +4 -3
  17. data/lib/bundler/ruby_version.rb +1 -1
  18. data/lib/bundler/rubygems_ext.rb +7 -2
  19. data/lib/bundler/rubygems_integration.rb +31 -30
  20. data/lib/bundler/settings.rb +21 -0
  21. data/lib/bundler/source.rb +13 -2
  22. data/lib/bundler/source/git/git_proxy.rb +1 -1
  23. data/lib/bundler/source/rubygems.rb +43 -13
  24. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  25. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -2
  26. data/lib/bundler/version.rb +1 -1
  27. data/man/bundle-config.ronn +9 -0
  28. data/man/bundle-install.ronn +9 -5
  29. data/man/gemfile.5.ronn +6 -0
  30. data/spec/bundler/retry_spec.rb +26 -3
  31. data/spec/commands/config_spec.rb +14 -0
  32. data/spec/{integration/inject.rb → commands/inject_spec.rb} +0 -0
  33. data/spec/commands/newgem_spec.rb +2 -2
  34. data/spec/commands/outdated_spec.rb +17 -0
  35. data/spec/install/binstubs_spec.rb +24 -0
  36. data/spec/install/bundler_spec.rb +146 -0
  37. data/spec/install/{gemspec_spec.rb → gemfile/gemspec_spec.rb} +0 -0
  38. data/spec/install/{git_spec.rb → gemfile/git_spec.rb} +2 -2
  39. data/spec/install/gemfile/path_spec.rb +468 -0
  40. data/spec/install/gemfile_spec.rb +44 -0
  41. data/spec/install/gems/groups_spec.rb +236 -177
  42. data/spec/install/gems/mirror_spec.rb +39 -0
  43. data/spec/install/gems/platform_spec.rb +2 -14
  44. data/spec/install/gems/simple_case_spec.rb +1 -450
  45. data/spec/install/gemspecs_spec.rb +50 -0
  46. data/spec/install/path_spec.rb +91 -409
  47. data/spec/install/prereleases_spec.rb +43 -0
  48. data/spec/other/bundle_ruby_spec.rb +2 -2
  49. data/spec/other/ext_spec.rb +1 -1
  50. data/spec/other/platform_spec.rb +29 -2
  51. data/spec/realworld/parallel_install_spec.rb +2 -1
  52. data/spec/realworld/parallel_update_spec.rb +31 -0
  53. data/spec/runtime/platform_spec.rb +2 -2
  54. data/spec/spec_helper.rb +2 -2
  55. data/spec/support/{rubygems_hax/platform.rb → hax.rb} +0 -0
  56. metadata +110 -67
  57. checksums.yaml +0 -7
  58. data/spec/install/invalid_spec.rb +0 -50
@@ -0,0 +1,44 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install" do
4
+
5
+ context "with duplicated gems" do
6
+ it "will display a warning" do
7
+ install_gemfile <<-G
8
+ gem 'rails', '~> 4.0.0'
9
+ gem 'rails', '~> 4.0.0'
10
+ G
11
+ expect(out).to include("more than once")
12
+ end
13
+ end
14
+
15
+ context "with --gemfile" do
16
+ it "finds the gemfile" do
17
+ gemfile bundled_app("NotGemfile"), <<-G
18
+ source "file://#{gem_repo1}"
19
+ gem 'rack'
20
+ G
21
+
22
+ bundle :install, :gemfile => bundled_app("NotGemfile")
23
+
24
+ ENV['BUNDLE_GEMFILE'] = "NotGemfile"
25
+ should_be_installed "rack 1.0.0"
26
+ end
27
+ end
28
+
29
+ context "with deprecated features" do
30
+ before :each do
31
+ in_app_root
32
+ end
33
+
34
+ it "reports that lib is an invalid option" do
35
+ gemfile <<-G
36
+ gem "rack", :lib => "rack"
37
+ G
38
+
39
+ bundle :install
40
+ expect(out).to match(/You passed :lib as an option for gem 'rack', but it is invalid/)
41
+ end
42
+ end
43
+
44
+ end
@@ -1,249 +1,308 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "bundle install with gem sources" do
4
- describe "with groups" do
5
- describe "installing with no options" do
3
+ describe "bundle install with groups" do
4
+
5
+ describe "installing with no options" do
6
+ before :each do
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo1}"
9
+ gem "rack"
10
+ group :emo do
11
+ gem "activesupport", "2.3.5"
12
+ end
13
+ gem "thin", :groups => [:emo]
14
+ G
15
+ end
16
+
17
+ it "installs gems in the default group" do
18
+ should_be_installed "rack 1.0.0"
19
+ end
20
+
21
+ it "installs gems in a group block into that group" do
22
+ should_be_installed "activesupport 2.3.5"
23
+
24
+ load_error_run <<-R, 'activesupport', :default
25
+ require 'activesupport'
26
+ puts ACTIVESUPPORT
27
+ R
28
+
29
+ expect(err).to eq("ZOMG LOAD ERROR")
30
+ end
31
+
32
+ it "installs gems with inline :groups into those groups" do
33
+ should_be_installed "thin 1.0"
34
+
35
+ load_error_run <<-R, 'thin', :default
36
+ require 'thin'
37
+ puts THIN
38
+ R
39
+
40
+ expect(err).to eq("ZOMG LOAD ERROR")
41
+ end
42
+
43
+ it "sets up everything if Bundler.setup is used with no groups" do
44
+ out = run("require 'rack'; puts RACK")
45
+ expect(out).to eq('1.0.0')
46
+
47
+ out = run("require 'activesupport'; puts ACTIVESUPPORT")
48
+ expect(out).to eq('2.3.5')
49
+
50
+ out = run("require 'thin'; puts THIN")
51
+ expect(out).to eq('1.0')
52
+ end
53
+
54
+ it "removes old groups when new groups are set up" do
55
+ load_error_run <<-RUBY, 'thin', :emo
56
+ Bundler.setup(:default)
57
+ require 'thin'
58
+ puts THIN
59
+ RUBY
60
+
61
+ expect(err).to eq("ZOMG LOAD ERROR")
62
+ end
63
+
64
+ it "sets up old groups when they have previously been removed" do
65
+ out = run <<-RUBY, :emo
66
+ Bundler.setup(:default)
67
+ Bundler.setup(:default, :emo)
68
+ require 'thin'; puts THIN
69
+ RUBY
70
+ expect(out).to eq('1.0')
71
+ end
72
+ end
73
+
74
+ describe "installing --without" do
75
+ describe "with gems assigned to a single group" do
6
76
  before :each do
7
- install_gemfile <<-G
77
+ gemfile <<-G
8
78
  source "file://#{gem_repo1}"
9
79
  gem "rack"
10
80
  group :emo do
11
81
  gem "activesupport", "2.3.5"
12
82
  end
13
- gem "thin", :groups => [:emo]
14
83
  G
15
84
  end
16
85
 
17
86
  it "installs gems in the default group" do
18
- should_be_installed "rack 1.0.0"
87
+ bundle :install, :without => "emo"
88
+ should_be_installed "rack 1.0.0", :groups => [:default]
19
89
  end
20
90
 
21
- it "installs gems in a group block into that group" do
22
- should_be_installed "activesupport 2.3.5"
91
+ it "does not install gems from the excluded group" do
92
+ bundle :install, :without => "emo"
93
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
94
+ end
23
95
 
24
- load_error_run <<-R, 'activesupport', :default
25
- require 'activesupport'
26
- puts ACTIVESUPPORT
27
- R
96
+ it "does not install gems from the previously excluded group" do
97
+ bundle :install, :without => "emo"
98
+ should_not_be_installed "activesupport 2.3.5"
99
+ bundle :install
100
+ should_not_be_installed "activesupport 2.3.5"
101
+ end
28
102
 
29
- expect(err).to eq("ZOMG LOAD ERROR")
103
+ it "does not say it installed gems from the excluded group" do
104
+ bundle :install, :without => "emo"
105
+ expect(out).not_to include("activesupport")
30
106
  end
31
107
 
32
- it "installs gems with inline :groups into those groups" do
33
- should_be_installed "thin 1.0"
108
+ it "allows Bundler.setup for specific groups" do
109
+ bundle :install, :without => "emo"
110
+ run("require 'rack'; puts RACK", :default)
111
+ expect(out).to eq('1.0.0')
112
+ end
34
113
 
35
- load_error_run <<-R, 'thin', :default
36
- require 'thin'
37
- puts THIN
38
- R
114
+ it "does not effect the resolve" do
115
+ gemfile <<-G
116
+ source "file://#{gem_repo1}"
117
+ gem "activesupport"
118
+ group :emo do
119
+ gem "rails", "2.3.2"
120
+ end
121
+ G
39
122
 
40
- expect(err).to eq("ZOMG LOAD ERROR")
123
+ bundle :install, :without => "emo"
124
+ should_be_installed "activesupport 2.3.2", :groups => [:default]
41
125
  end
42
126
 
43
- it "sets up everything if Bundler.setup is used with no groups" do
44
- out = run("require 'rack'; puts RACK")
45
- expect(out).to eq('1.0.0')
127
+ it "still works on a different machine and excludes gems" do
128
+ bundle :install, :without => "emo"
46
129
 
47
- out = run("require 'activesupport'; puts ACTIVESUPPORT")
48
- expect(out).to eq('2.3.5')
130
+ simulate_new_machine
131
+ bundle :install, :without => "emo"
49
132
 
50
- out = run("require 'thin'; puts THIN")
51
- expect(out).to eq('1.0')
133
+ should_be_installed "rack 1.0.0", :groups => [:default]
134
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
52
135
  end
53
136
 
54
- it "removes old groups when new groups are set up" do
55
- load_error_run <<-RUBY, 'thin', :emo
56
- Bundler.setup(:default)
57
- require 'thin'
58
- puts THIN
59
- RUBY
137
+ it "still works when BUNDLE_WITHOUT is set" do
138
+ ENV["BUNDLE_WITHOUT"] = "emo"
60
139
 
61
- expect(err).to eq("ZOMG LOAD ERROR")
140
+ bundle :install
141
+ expect(out).not_to include("activesupport")
142
+
143
+ should_be_installed "rack 1.0.0", :groups => [:default]
144
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
145
+
146
+ ENV["BUNDLE_WITHOUT"] = nil
62
147
  end
63
148
 
64
- it "sets up old groups when they have previously been removed" do
65
- out = run <<-RUBY, :emo
66
- Bundler.setup(:default)
67
- Bundler.setup(:default, :emo)
68
- require 'thin'; puts THIN
69
- RUBY
70
- expect(out).to eq('1.0')
149
+ it "clears without when passed an empty list" do
150
+ bundle :install, :without => "emo"
151
+
152
+ bundle 'install --without ""'
153
+ should_be_installed "activesupport 2.3.5"
154
+ end
155
+
156
+ it "doesn't clear without when nothing is passed" do
157
+ bundle :install, :without => "emo"
158
+
159
+ bundle :install
160
+ should_not_be_installed "activesupport 2.3.5"
71
161
  end
72
162
  end
73
163
 
74
- describe "installing --without" do
75
- describe "with gems assigned to a single group" do
164
+ describe "with gems assigned to multiple groups" do
165
+ before :each do
166
+ gemfile <<-G
167
+ source "file://#{gem_repo1}"
168
+ gem "rack"
169
+ group :emo, :lolercoaster do
170
+ gem "activesupport", "2.3.5"
171
+ end
172
+ G
173
+ end
174
+
175
+ it "installs gems in the default group" do
176
+ bundle :install, :without => "emo lolercoaster"
177
+ should_be_installed "rack 1.0.0"
178
+ end
179
+
180
+ it "installs the gem if any of its groups are installed" do
181
+ bundle "install --without emo"
182
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
183
+ end
184
+
185
+ describe "with a gem defined multiple times in different groups" do
76
186
  before :each do
77
187
  gemfile <<-G
78
188
  source "file://#{gem_repo1}"
79
189
  gem "rack"
190
+
80
191
  group :emo do
81
192
  gem "activesupport", "2.3.5"
82
193
  end
83
- G
84
- end
85
-
86
- it "installs gems in the default group" do
87
- bundle :install, :without => "emo"
88
- should_be_installed "rack 1.0.0", :groups => [:default]
89
- end
90
-
91
- it "does not install gems from the excluded group" do
92
- bundle :install, :without => "emo"
93
- should_not_be_installed "activesupport 2.3.5", :groups => [:default]
94
- end
95
-
96
- it "does not install gems from the previously excluded group" do
97
- bundle :install, :without => "emo"
98
- should_not_be_installed "activesupport 2.3.5"
99
- bundle :install
100
- should_not_be_installed "activesupport 2.3.5"
101
- end
102
-
103
- it "does not say it installed gems from the excluded group" do
104
- bundle :install, :without => "emo"
105
- expect(out).not_to include("activesupport")
106
- end
107
194
 
108
- it "allows Bundler.setup for specific groups" do
109
- bundle :install, :without => "emo"
110
- run("require 'rack'; puts RACK", :default)
111
- expect(out).to eq('1.0.0')
112
- end
113
-
114
- it "does not effect the resolve" do
115
- gemfile <<-G
116
- source "file://#{gem_repo1}"
117
- gem "activesupport"
118
- group :emo do
119
- gem "rails", "2.3.2"
195
+ group :lolercoaster do
196
+ gem "activesupport", "2.3.5"
120
197
  end
121
198
  G
122
-
123
- bundle :install, :without => "emo"
124
- should_be_installed "activesupport 2.3.2", :groups => [:default]
125
199
  end
126
200
 
127
- it "still works on a different machine and excludes gems" do
128
- bundle :install, :without => "emo"
129
-
130
- simulate_new_machine
131
- bundle :install, :without => "emo"
132
-
133
- should_be_installed "rack 1.0.0", :groups => [:default]
134
- should_not_be_installed "activesupport 2.3.5", :groups => [:default]
135
- end
136
-
137
- it "still works when BUNDLE_WITHOUT is set" do
138
- ENV["BUNDLE_WITHOUT"] = "emo"
139
-
140
- bundle :install
141
- expect(out).not_to include("activesupport")
142
-
143
- should_be_installed "rack 1.0.0", :groups => [:default]
144
- should_not_be_installed "activesupport 2.3.5", :groups => [:default]
145
-
146
- ENV["BUNDLE_WITHOUT"] = nil
201
+ it "installs the gem w/ option --without emo" do
202
+ bundle "install --without emo"
203
+ should_be_installed "activesupport 2.3.5"
147
204
  end
148
205
 
149
- it "clears without when passed an empty list" do
150
- bundle :install, :without => "emo"
151
-
152
- bundle 'install --without ""'
206
+ it "installs the gem w/ option --without lolercoaster" do
207
+ bundle "install --without lolercoaster"
153
208
  should_be_installed "activesupport 2.3.5"
154
209
  end
155
210
 
156
- it "doesn't clear without when nothing is passed" do
157
- bundle :install, :without => "emo"
211
+ it "does not install the gem w/ option --without emo lolercoaster" do
212
+ bundle "install --without emo lolercoaster"
213
+ should_not_be_installed "activesupport 2.3.5"
214
+ end
158
215
 
159
- bundle :install
216
+ it "does not install the gem w/ option --without 'emo lolercoaster'" do
217
+ bundle "install --without 'emo lolercoaster'"
160
218
  should_not_be_installed "activesupport 2.3.5"
161
219
  end
162
220
  end
221
+ end
163
222
 
164
- describe "with gems assigned to multiple groups" do
165
- before :each do
166
- gemfile <<-G
167
- source "file://#{gem_repo1}"
168
- gem "rack"
169
- group :emo, :lolercoaster do
223
+ describe "nesting groups" do
224
+ before :each do
225
+ gemfile <<-G
226
+ source "file://#{gem_repo1}"
227
+ gem "rack"
228
+ group :emo do
229
+ group :lolercoaster do
170
230
  gem "activesupport", "2.3.5"
171
231
  end
172
- G
173
- end
174
-
175
- it "installs gems in the default group" do
176
- bundle :install, :without => "emo lolercoaster"
177
- should_be_installed "rack 1.0.0"
178
- end
232
+ end
233
+ G
234
+ end
179
235
 
180
- it "installs the gem if any of its groups are installed" do
181
- bundle "install --without emo"
182
- should_be_installed "rack 1.0.0", "activesupport 2.3.5"
183
- end
236
+ it "installs gems in the default group" do
237
+ bundle :install, :without => "emo lolercoaster"
238
+ should_be_installed "rack 1.0.0"
239
+ end
184
240
 
185
- describe "with a gem defined multiple times in different groups" do
186
- before :each do
187
- gemfile <<-G
188
- source "file://#{gem_repo1}"
189
- gem "rack"
241
+ it "installs the gem if any of its groups are installed" do
242
+ bundle "install --without emo"
243
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
244
+ end
190
245
 
191
- group :emo do
192
- gem "activesupport", "2.3.5"
193
- end
246
+ end
247
+ end
194
248
 
195
- group :lolercoaster do
196
- gem "activesupport", "2.3.5"
197
- end
198
- G
199
- end
249
+ describe "when loading only the default group" do
250
+ it "should not load all groups" do
251
+ install_gemfile <<-G
252
+ source "file://#{gem_repo1}"
253
+ gem "rack"
254
+ gem "activesupport", :groups => :development
255
+ G
256
+
257
+ ruby <<-R
258
+ require "bundler"
259
+ Bundler.setup :default
260
+ Bundler.require :default
261
+ puts RACK
262
+ begin
263
+ require "activesupport"
264
+ rescue LoadError
265
+ puts "no activesupport"
266
+ end
267
+ R
200
268
 
201
- it "installs the gem w/ option --without emo" do
202
- bundle "install --without emo"
203
- should_be_installed "activesupport 2.3.5"
204
- end
269
+ expect(out).to include("1.0")
270
+ expect(out).to include("no activesupport")
271
+ end
272
+ end
205
273
 
206
- it "installs the gem w/ option --without lolercoaster" do
207
- bundle "install --without lolercoaster"
208
- should_be_installed "activesupport 2.3.5"
209
- end
210
274
 
211
- it "does not install the gem w/ option --without emo lolercoaster" do
212
- bundle "install --without emo lolercoaster"
213
- should_not_be_installed "activesupport 2.3.5"
214
- end
275
+ describe "when locked and installed with --without" do
276
+ before(:each) do
277
+ build_repo2
278
+ system_gems "rack-0.9.1" do
279
+ install_gemfile <<-G, :without => :rack
280
+ source "file://#{gem_repo2}"
281
+ gem "rack"
215
282
 
216
- it "does not install the gem w/ option --without 'emo lolercoaster'" do
217
- bundle "install --without 'emo lolercoaster'"
218
- should_not_be_installed "activesupport 2.3.5"
283
+ group :rack do
284
+ gem "rack_middleware"
219
285
  end
220
- end
286
+ G
221
287
  end
288
+ end
222
289
 
223
- describe "nesting groups" do
224
- before :each do
225
- gemfile <<-G
226
- source "file://#{gem_repo1}"
227
- gem "rack"
228
- group :emo do
229
- group :lolercoaster do
230
- gem "activesupport", "2.3.5"
231
- end
232
- end
233
- G
234
- end
290
+ it "uses the correct versions even if --without was used on the original" do
291
+ should_be_installed "rack 0.9.1"
292
+ should_not_be_installed "rack_middleware 1.0"
293
+ simulate_new_machine
235
294
 
236
- it "installs gems in the default group" do
237
- bundle :install, :without => "emo lolercoaster"
238
- should_be_installed "rack 1.0.0"
239
- end
295
+ bundle :install
240
296
 
241
- it "installs the gem if any of its groups are installed" do
242
- bundle "install --without emo"
243
- should_be_installed "rack 1.0.0", "activesupport 2.3.5"
244
- end
297
+ should_be_installed "rack 0.9.1"
298
+ should_be_installed "rack_middleware 1.0"
299
+ end
245
300
 
246
- end
301
+ it "does not hit the remote a second time" do
302
+ FileUtils.rm_rf gem_repo2
303
+ bundle "install --without rack"
304
+ expect(err).to be_empty
247
305
  end
248
306
  end
249
- end
307
+
308
+ end