bundler 1.7.15 → 1.8.0.pre

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -14
  3. data/.rspec +1 -0
  4. data/.travis.yml +22 -15
  5. data/CHANGELOG.md +43 -13
  6. data/CODE_OF_CONDUCT.md +40 -0
  7. data/CONTRIBUTING.md +14 -12
  8. data/DEVELOPMENT.md +4 -2
  9. data/ISSUES.md +1 -1
  10. data/README.md +10 -14
  11. data/Rakefile +10 -10
  12. data/bin/bundle +1 -1
  13. data/bundler.gemspec +5 -4
  14. data/lib/bundler.rb +22 -3
  15. data/lib/bundler/anonymizable_uri.rb +24 -8
  16. data/lib/bundler/cli.rb +103 -66
  17. data/lib/bundler/cli/cache.rb +1 -0
  18. data/lib/bundler/cli/clean.rb +11 -4
  19. data/lib/bundler/cli/common.rb +2 -0
  20. data/lib/bundler/cli/console.rb +22 -26
  21. data/lib/bundler/cli/exec.rb +29 -22
  22. data/lib/bundler/cli/gem.rb +125 -37
  23. data/lib/bundler/cli/install.rb +22 -9
  24. data/lib/bundler/cli/outdated.rb +1 -1
  25. data/lib/bundler/cli/package.rb +8 -1
  26. data/lib/bundler/cli/show.rb +29 -3
  27. data/lib/bundler/cli/update.rb +2 -2
  28. data/lib/bundler/cli/viz.rb +1 -1
  29. data/lib/bundler/definition.rb +14 -22
  30. data/lib/bundler/dependency.rb +8 -1
  31. data/lib/bundler/dsl.rb +17 -4
  32. data/lib/bundler/endpoint_specification.rb +1 -1
  33. data/lib/bundler/env.rb +44 -25
  34. data/lib/bundler/fetcher.rb +33 -25
  35. data/lib/bundler/friendly_errors.rb +38 -5
  36. data/lib/bundler/gem_helper.rb +16 -10
  37. data/lib/bundler/gem_helpers.rb +1 -0
  38. data/lib/bundler/graph.rb +4 -1
  39. data/lib/bundler/index.rb +15 -25
  40. data/lib/bundler/installer.rb +6 -6
  41. data/lib/bundler/lockfile_parser.rb +7 -7
  42. data/lib/bundler/resolver.rb +2 -1
  43. data/lib/bundler/ruby_version.rb +1 -1
  44. data/lib/bundler/rubygems_ext.rb +1 -0
  45. data/lib/bundler/rubygems_integration.rb +1 -1
  46. data/lib/bundler/runtime.rb +22 -40
  47. data/lib/bundler/settings.rb +14 -5
  48. data/lib/bundler/setup.rb +2 -1
  49. data/lib/bundler/shared_helpers.rb +56 -4
  50. data/lib/bundler/source.rb +8 -9
  51. data/lib/bundler/source/git.rb +5 -1
  52. data/lib/bundler/source/git/git_proxy.rb +4 -0
  53. data/lib/bundler/source/path.rb +8 -11
  54. data/lib/bundler/source/path/installer.rb +0 -2
  55. data/lib/bundler/source/rubygems.rb +58 -72
  56. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
  57. data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
  58. data/lib/bundler/templates/newgem/README.md.tt +9 -1
  59. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  60. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  61. data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
  62. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  63. data/lib/bundler/templates/newgem/gitignore.tt +2 -0
  64. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
  66. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
  67. data/lib/bundler/ui/shell.rb +1 -1
  68. data/lib/bundler/version.rb +1 -1
  69. data/lib/bundler/worker.rb +73 -0
  70. data/man/bundle-config.ronn +17 -15
  71. data/man/bundle-install.ronn +102 -93
  72. data/man/bundle-update.ronn +39 -30
  73. data/man/bundle.ronn +6 -0
  74. data/man/gemfile.5.ronn +74 -13
  75. metadata +10 -231
  76. data/lib/bundler/parallel_workers.rb +0 -18
  77. data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
  78. data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
  79. data/lib/bundler/parallel_workers/worker.rb +0 -69
  80. data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
  81. data/spec/bundler/anonymizable_uri_spec.rb +0 -32
  82. data/spec/bundler/bundler_spec.rb +0 -72
  83. data/spec/bundler/cli_spec.rb +0 -16
  84. data/spec/bundler/definition_spec.rb +0 -22
  85. data/spec/bundler/dsl_spec.rb +0 -82
  86. data/spec/bundler/friendly_errors_spec.rb +0 -13
  87. data/spec/bundler/gem_helper_spec.rb +0 -226
  88. data/spec/bundler/psyched_yaml_spec.rb +0 -8
  89. data/spec/bundler/retry_spec.rb +0 -59
  90. data/spec/bundler/settings_spec.rb +0 -13
  91. data/spec/bundler/source/rubygems_spec.rb +0 -25
  92. data/spec/bundler/source_list_spec.rb +0 -361
  93. data/spec/cache/gems_spec.rb +0 -284
  94. data/spec/cache/git_spec.rb +0 -188
  95. data/spec/cache/path_spec.rb +0 -121
  96. data/spec/cache/platform_spec.rb +0 -57
  97. data/spec/commands/binstubs_spec.rb +0 -219
  98. data/spec/commands/check_spec.rb +0 -278
  99. data/spec/commands/clean_spec.rb +0 -592
  100. data/spec/commands/config_spec.rb +0 -263
  101. data/spec/commands/console_spec.rb +0 -76
  102. data/spec/commands/exec_spec.rb +0 -309
  103. data/spec/commands/help_spec.rb +0 -39
  104. data/spec/commands/init_spec.rb +0 -39
  105. data/spec/commands/inject_spec.rb +0 -78
  106. data/spec/commands/licenses_spec.rb +0 -18
  107. data/spec/commands/newgem_spec.rb +0 -428
  108. data/spec/commands/open_spec.rb +0 -68
  109. data/spec/commands/outdated_spec.rb +0 -156
  110. data/spec/commands/package_spec.rb +0 -114
  111. data/spec/commands/show_spec.rb +0 -125
  112. data/spec/install/binstubs_spec.rb +0 -24
  113. data/spec/install/bundler_spec.rb +0 -146
  114. data/spec/install/deploy_spec.rb +0 -250
  115. data/spec/install/gemfile/gemspec_spec.rb +0 -170
  116. data/spec/install/gemfile/git_spec.rb +0 -967
  117. data/spec/install/gemfile/path_spec.rb +0 -500
  118. data/spec/install/gemfile_spec.rb +0 -44
  119. data/spec/install/gems/c_ext_spec.rb +0 -48
  120. data/spec/install/gems/dependency_api_spec.rb +0 -652
  121. data/spec/install/gems/env_spec.rb +0 -107
  122. data/spec/install/gems/flex_spec.rb +0 -314
  123. data/spec/install/gems/groups_spec.rb +0 -308
  124. data/spec/install/gems/mirror_spec.rb +0 -39
  125. data/spec/install/gems/platform_spec.rb +0 -195
  126. data/spec/install/gems/post_install_spec.rb +0 -121
  127. data/spec/install/gems/resolving_spec.rb +0 -124
  128. data/spec/install/gems/simple_case_spec.rb +0 -377
  129. data/spec/install/gems/sources_spec.rb +0 -386
  130. data/spec/install/gems/standalone_spec.rb +0 -260
  131. data/spec/install/gems/sudo_spec.rb +0 -136
  132. data/spec/install/gems/win32_spec.rb +0 -26
  133. data/spec/install/gemspecs_spec.rb +0 -50
  134. data/spec/install/path_spec.rb +0 -150
  135. data/spec/install/post_bundle_message_spec.rb +0 -142
  136. data/spec/install/prereleases_spec.rb +0 -43
  137. data/spec/install/security_policy_spec.rb +0 -77
  138. data/spec/install/upgrade_spec.rb +0 -26
  139. data/spec/lock/git_spec.rb +0 -34
  140. data/spec/lock/lockfile_spec.rb +0 -924
  141. data/spec/other/bundle_ruby_spec.rb +0 -142
  142. data/spec/other/cli_dispatch_spec.rb +0 -21
  143. data/spec/other/ext_spec.rb +0 -60
  144. data/spec/other/platform_spec.rb +0 -1285
  145. data/spec/other/ssl_cert_spec.rb +0 -23
  146. data/spec/quality_spec.rb +0 -88
  147. data/spec/realworld/dependency_api_spec.rb +0 -60
  148. data/spec/realworld/edgecases_spec.rb +0 -212
  149. data/spec/realworld/parallel_spec.rb +0 -71
  150. data/spec/resolver/basic_spec.rb +0 -66
  151. data/spec/resolver/platform_spec.rb +0 -88
  152. data/spec/runtime/executable_spec.rb +0 -149
  153. data/spec/runtime/load_spec.rb +0 -107
  154. data/spec/runtime/platform_spec.rb +0 -90
  155. data/spec/runtime/require_spec.rb +0 -332
  156. data/spec/runtime/setup_spec.rb +0 -853
  157. data/spec/runtime/with_clean_env_spec.rb +0 -91
  158. data/spec/spec_helper.rb +0 -123
  159. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
  160. data/spec/support/artifice/endpoint.rb +0 -71
  161. data/spec/support/artifice/endpoint_500.rb +0 -37
  162. data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
  163. data/spec/support/artifice/endpoint_api_missing.rb +0 -16
  164. data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
  165. data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
  166. data/spec/support/artifice/endpoint_extra.rb +0 -31
  167. data/spec/support/artifice/endpoint_extra_api.rb +0 -32
  168. data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
  169. data/spec/support/artifice/endpoint_fallback.rb +0 -17
  170. data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
  171. data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
  172. data/spec/support/artifice/endpoint_redirect.rb +0 -15
  173. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
  174. data/spec/support/artifice/endpoint_timeout.rb +0 -13
  175. data/spec/support/builders.rb +0 -693
  176. data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
  177. data/spec/support/fakeweb/windows.rb +0 -23
  178. data/spec/support/hax.rb +0 -22
  179. data/spec/support/helpers.rb +0 -361
  180. data/spec/support/indexes.rb +0 -280
  181. data/spec/support/matchers.rb +0 -77
  182. data/spec/support/path.rb +0 -85
  183. data/spec/support/permissions.rb +0 -10
  184. data/spec/support/platforms.rb +0 -94
  185. data/spec/support/ruby_ext.rb +0 -20
  186. data/spec/support/rubygems_ext.rb +0 -39
  187. data/spec/support/streams.rb +0 -13
  188. data/spec/support/sudo.rb +0 -16
  189. data/spec/update/gems_spec.rb +0 -201
  190. data/spec/update/git_spec.rb +0 -283
  191. data/spec/update/path_spec.rb +0 -18
@@ -1,592 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "bundle clean" do
4
- def should_have_gems(*gems)
5
- gems.each do |g|
6
- expect(vendored_gems("gems/#{g}")).to exist
7
- expect(vendored_gems("specifications/#{g}.gemspec")).to exist
8
- expect(vendored_gems("cache/#{g}.gem")).to exist
9
- end
10
- end
11
-
12
- def should_not_have_gems(*gems)
13
- gems.each do |g|
14
- expect(vendored_gems("gems/#{g}")).not_to exist
15
- expect(vendored_gems("specifications/#{g}.gemspec")).not_to exist
16
- expect(vendored_gems("cache/#{g}.gem")).not_to exist
17
- end
18
- end
19
-
20
- it "removes unused gems that are different" do
21
- gemfile <<-G
22
- source "file://#{gem_repo1}"
23
-
24
- gem "thin"
25
- gem "foo"
26
- G
27
-
28
- bundle "install --path vendor/bundle --no-clean"
29
-
30
- gemfile <<-G
31
- source "file://#{gem_repo1}"
32
-
33
- gem "thin"
34
- G
35
- bundle "install"
36
-
37
- bundle :clean
38
-
39
- expect(out).to eq("Removing foo (1.0)")
40
-
41
- should_have_gems 'thin-1.0', 'rack-1.0.0'
42
- should_not_have_gems 'foo-1.0'
43
-
44
- expect(vendored_gems("bin/rackup")).to exist
45
- end
46
-
47
- it "removes old version of gem if unused" do
48
- gemfile <<-G
49
- source "file://#{gem_repo1}"
50
-
51
- gem "rack", "0.9.1"
52
- gem "foo"
53
- G
54
-
55
- bundle "install --path vendor/bundle --no-clean"
56
-
57
- gemfile <<-G
58
- source "file://#{gem_repo1}"
59
-
60
- gem "rack", "1.0.0"
61
- gem "foo"
62
- G
63
- bundle "install"
64
-
65
- bundle :clean
66
-
67
- expect(out).to eq("Removing rack (0.9.1)")
68
-
69
- should_have_gems 'foo-1.0', 'rack-1.0.0'
70
- should_not_have_gems 'rack-0.9.1'
71
-
72
- expect(vendored_gems("bin/rackup")).to exist
73
- end
74
-
75
- it "removes new version of gem if unused" do
76
- gemfile <<-G
77
- source "file://#{gem_repo1}"
78
-
79
- gem "rack", "1.0.0"
80
- gem "foo"
81
- G
82
-
83
- bundle "install --path vendor/bundle --no-clean"
84
-
85
- gemfile <<-G
86
- source "file://#{gem_repo1}"
87
-
88
- gem "rack", "0.9.1"
89
- gem "foo"
90
- G
91
- bundle "install"
92
-
93
- bundle :clean
94
-
95
- expect(out).to eq("Removing rack (1.0.0)")
96
-
97
- should_have_gems 'foo-1.0', 'rack-0.9.1'
98
- should_not_have_gems 'rack-1.0.0'
99
-
100
- expect(vendored_gems("bin/rackup")).to exist
101
- end
102
-
103
- it "removes gems in bundle without groups" do
104
- gemfile <<-G
105
- source "file://#{gem_repo1}"
106
-
107
- gem "foo"
108
-
109
- group :test_group do
110
- gem "rack", "1.0.0"
111
- end
112
- G
113
-
114
- bundle "install --path vendor/bundle"
115
- bundle "install --without test_group"
116
- bundle :clean
117
-
118
- expect(out).to eq("Removing rack (1.0.0)")
119
-
120
- should_have_gems 'foo-1.0'
121
- should_not_have_gems 'rack-1.0.0'
122
-
123
- expect(vendored_gems("bin/rackup")).to_not exist
124
- end
125
-
126
- it "does not remove cached git dir if it's being used" do
127
- build_git "foo"
128
- revision = revision_for(lib_path("foo-1.0"))
129
- git_path = lib_path('foo-1.0')
130
-
131
- gemfile <<-G
132
- source "file://#{gem_repo1}"
133
-
134
- gem "rack", "1.0.0"
135
- git "#{git_path}", :ref => "#{revision}" do
136
- gem "foo"
137
- end
138
- G
139
-
140
- bundle "install --path vendor/bundle"
141
-
142
- bundle :clean
143
-
144
- digest = Digest::SHA1.hexdigest(git_path.to_s)
145
- expect(vendored_gems("cache/bundler/git/foo-1.0-#{digest}")).to exist
146
- end
147
-
148
- it "removes unused git gems" do
149
- build_git "foo", :path => lib_path("foo")
150
- git_path = lib_path('foo')
151
- revision = revision_for(git_path)
152
-
153
- gemfile <<-G
154
- source "file://#{gem_repo1}"
155
-
156
- gem "rack", "1.0.0"
157
- git "#{git_path}", :ref => "#{revision}" do
158
- gem "foo"
159
- end
160
- G
161
-
162
- bundle "install --path vendor/bundle"
163
-
164
- gemfile <<-G
165
- source "file://#{gem_repo1}"
166
-
167
- gem "rack", "1.0.0"
168
- G
169
- bundle "install"
170
-
171
- bundle :clean
172
-
173
- expect(out).to eq("Removing foo (#{revision[0..11]})")
174
-
175
- expect(vendored_gems("gems/rack-1.0.0")).to exist
176
- expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).not_to exist
177
- digest = Digest::SHA1.hexdigest(git_path.to_s)
178
- expect(vendored_gems("cache/bundler/git/foo-#{digest}")).not_to exist
179
-
180
- expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist
181
-
182
- expect(vendored_gems("bin/rackup")).to exist
183
- end
184
-
185
- it "removes old git gems" do
186
- build_git "foo-bar", :path => lib_path("foo-bar")
187
- revision = revision_for(lib_path("foo-bar"))
188
-
189
- gemfile <<-G
190
- source "file://#{gem_repo1}"
191
-
192
- gem "rack", "1.0.0"
193
- git "#{lib_path('foo-bar')}" do
194
- gem "foo-bar"
195
- end
196
- G
197
-
198
- bundle "install --path vendor/bundle"
199
-
200
- update_git "foo", :path => lib_path("foo-bar")
201
- revision2 = revision_for(lib_path("foo-bar"))
202
-
203
- bundle "update"
204
- bundle :clean
205
-
206
- expect(out).to eq("Removing foo-bar (#{revision[0..11]})")
207
-
208
- expect(vendored_gems("gems/rack-1.0.0")).to exist
209
- expect(vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}")).not_to exist
210
- expect(vendored_gems("bundler/gems/foo-bar-#{revision2[0..11]}")).to exist
211
-
212
- expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist
213
-
214
- expect(vendored_gems("bin/rackup")).to exist
215
- end
216
-
217
- it "does not remove nested gems in a git repo" do
218
- build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport")
219
- build_git "rails", "3.0", :path => lib_path("rails") do |s|
220
- s.add_dependency "activesupport", "= 3.0"
221
- end
222
- revision = revision_for(lib_path("rails"))
223
-
224
- gemfile <<-G
225
- gem "activesupport", :git => "#{lib_path('rails')}", :ref => '#{revision}'
226
- G
227
-
228
- bundle "install --path vendor/bundle"
229
- bundle :clean
230
- expect(out).to eq("")
231
-
232
- expect(vendored_gems("bundler/gems/rails-#{revision[0..11]}")).to exist
233
- end
234
-
235
- it "does not remove git sources that are in without groups" do
236
- build_git "foo", :path => lib_path("foo")
237
- git_path = lib_path('foo')
238
- revision = revision_for(git_path)
239
-
240
- gemfile <<-G
241
- source "file://#{gem_repo1}"
242
-
243
- gem "rack", "1.0.0"
244
- group :test do
245
- git "#{git_path}", :ref => "#{revision}" do
246
- gem "foo"
247
- end
248
- end
249
- G
250
- bundle "install --path vendor/bundle --without test"
251
-
252
- bundle :clean
253
-
254
- expect(out).to eq("")
255
- expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).to exist
256
- digest = Digest::SHA1.hexdigest(git_path.to_s)
257
- expect(vendored_gems("cache/bundler/git/foo-#{digest}")).to_not exist
258
- end
259
-
260
- it "does not blow up when using without groups" do
261
- gemfile <<-G
262
- source "file://#{gem_repo1}"
263
-
264
- gem "rack"
265
-
266
- group :development do
267
- gem "foo"
268
- end
269
- G
270
-
271
- bundle "install --path vendor/bundle --without development"
272
-
273
- bundle :clean, :exitstatus => true
274
- expect(exitstatus).to eq(0)
275
- end
276
-
277
- it "displays an error when used without --path" do
278
- install_gemfile <<-G
279
- source "file://#{gem_repo1}"
280
-
281
- gem "rack", "1.0.0"
282
- G
283
-
284
- bundle :clean, :exitstatus => true
285
-
286
- expect(exitstatus).to eq(1)
287
- expect(out).to eq("Can only use bundle clean when --path is set or --force is set")
288
- end
289
-
290
- # handling bundle clean upgrade path from the pre's
291
- it "removes .gem/.gemspec file even if there's no corresponding gem dir" do
292
- gemfile <<-G
293
- source "file://#{gem_repo1}"
294
-
295
- gem "thin"
296
- gem "foo"
297
- G
298
-
299
- bundle "install --path vendor/bundle"
300
-
301
- gemfile <<-G
302
- source "file://#{gem_repo1}"
303
-
304
- gem "foo"
305
- G
306
- bundle "install"
307
-
308
- FileUtils.rm(vendored_gems("bin/rackup"))
309
- FileUtils.rm_rf(vendored_gems("gems/thin-1.0"))
310
- FileUtils.rm_rf(vendored_gems("gems/rack-1.0.0"))
311
-
312
- bundle :clean
313
-
314
- should_not_have_gems 'thin-1.0', 'rack-1.0'
315
- should_have_gems 'foo-1.0'
316
-
317
- expect(vendored_gems("bin/rackup")).not_to exist
318
- end
319
-
320
- it "does not call clean automatically when using system gems" do
321
- gemfile <<-G
322
- source "file://#{gem_repo1}"
323
-
324
- gem "thin"
325
- gem "rack"
326
- G
327
- bundle :install
328
-
329
- gemfile <<-G
330
- source "file://#{gem_repo1}"
331
-
332
- gem "rack"
333
- G
334
- bundle :install
335
-
336
- sys_exec "gem list"
337
- expect(out).to include("rack (1.0.0)")
338
- expect(out).to include("thin (1.0)")
339
- end
340
-
341
- it "--clean should override the bundle setting on install" do
342
- gemfile <<-G
343
- source "file://#{gem_repo1}"
344
-
345
- gem "thin"
346
- gem "rack"
347
- G
348
- bundle "install --path vendor/bundle --clean"
349
-
350
- gemfile <<-G
351
- source "file://#{gem_repo1}"
352
-
353
- gem "rack"
354
- G
355
- bundle "install"
356
-
357
- should_have_gems 'rack-1.0.0'
358
- should_not_have_gems 'thin-1.0'
359
- end
360
-
361
- it "--clean should override the bundle setting on update" do
362
- build_repo2
363
-
364
- gemfile <<-G
365
- source "file://#{gem_repo2}"
366
-
367
- gem "foo"
368
- G
369
- bundle "install --path vendor/bundle --clean"
370
-
371
- update_repo2 do
372
- build_gem 'foo', '1.0.1'
373
- end
374
-
375
- bundle "update"
376
-
377
- should_have_gems 'foo-1.0.1'
378
- should_not_have_gems 'foo-1.0'
379
- end
380
-
381
- it "does not clean automatically on --path" do
382
- gemfile <<-G
383
- source "file://#{gem_repo1}"
384
-
385
- gem "thin"
386
- gem "rack"
387
- G
388
- bundle "install --path vendor/bundle"
389
-
390
- gemfile <<-G
391
- source "file://#{gem_repo1}"
392
-
393
- gem "rack"
394
- G
395
- bundle "install"
396
-
397
- should_have_gems 'rack-1.0.0', 'thin-1.0'
398
- end
399
-
400
- it "does not clean on bundle update with --path" do
401
- build_repo2
402
-
403
- gemfile <<-G
404
- source "file://#{gem_repo2}"
405
-
406
- gem "foo"
407
- G
408
- bundle "install --path vendor/bundle"
409
-
410
- update_repo2 do
411
- build_gem 'foo', '1.0.1'
412
- end
413
-
414
- bundle :update
415
- should_have_gems 'foo-1.0', 'foo-1.0.1'
416
- end
417
-
418
- it "does not clean on bundle update when using --system" do
419
- build_repo2
420
-
421
- gemfile <<-G
422
- source "file://#{gem_repo2}"
423
-
424
- gem "foo"
425
- G
426
- bundle "install"
427
-
428
- update_repo2 do
429
- build_gem 'foo', '1.0.1'
430
- end
431
- bundle :update
432
-
433
- sys_exec "gem list"
434
- expect(out).to include("foo (1.0.1, 1.0)")
435
- end
436
-
437
- it "cleans system gems when --force is used" do
438
- gemfile <<-G
439
- source "file://#{gem_repo1}"
440
-
441
- gem "foo"
442
- gem "rack"
443
- G
444
- bundle :install
445
-
446
- gemfile <<-G
447
- source "file://#{gem_repo1}"
448
-
449
- gem "rack"
450
- G
451
- bundle :install
452
- bundle "clean --force"
453
-
454
- expect(out).to eq("Removing foo (1.0)")
455
- sys_exec "gem list"
456
- expect(out).not_to include("foo (1.0)")
457
- expect(out).to include("rack (1.0.0)")
458
- end
459
-
460
- it "cleans git gems with a 7 length git revision" do
461
- build_git "foo"
462
- revision = revision_for(lib_path("foo-1.0"))
463
-
464
- gemfile <<-G
465
- source "file://#{gem_repo1}"
466
-
467
- gem "foo", :git => "#{lib_path('foo-1.0')}"
468
- G
469
-
470
- bundle "install --path vendor/bundle"
471
-
472
- # mimic 7 length git revisions in Gemfile.lock
473
- gemfile_lock = File.read(bundled_app('Gemfile.lock')).split("\n")
474
- gemfile_lock.each_with_index do |line, index|
475
- gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:")
476
- end
477
- File.open(bundled_app('Gemfile.lock'), 'w') do |file|
478
- file.print gemfile_lock.join("\n")
479
- end
480
-
481
- bundle "install --path vendor/bundle"
482
-
483
- bundle :clean
484
-
485
- expect(out).not_to include("Removing foo (1.0 #{revision[0..6]})")
486
-
487
- expect(vendored_gems("bundler/gems/foo-1.0-#{revision[0..6]}")).to exist
488
- end
489
-
490
- it "when using --force on system gems, it doesn't remove binaries" do
491
- build_repo2
492
- update_repo2 do
493
- build_gem 'bindir' do |s|
494
- s.bindir = "exe"
495
- s.executables = "foo"
496
- end
497
- end
498
-
499
- gemfile <<-G
500
- source "file://#{gem_repo2}"
501
-
502
- gem "bindir"
503
- G
504
- bundle :install
505
-
506
- bundle "clean --force"
507
-
508
- sys_status "foo"
509
-
510
- expect(exitstatus).to eq(0)
511
- expect(out).to eq("1.0")
512
- end
513
-
514
- it "doesn't blow up on path gems without a .gempsec" do
515
- relative_path = "vendor/private_gems/bar-1.0"
516
- absolute_path = bundled_app(relative_path)
517
- FileUtils.mkdir_p("#{absolute_path}/lib/bar")
518
- File.open("#{absolute_path}/lib/bar/bar.rb", 'wb') do |file|
519
- file.puts "module Bar; end"
520
- end
521
-
522
- gemfile <<-G
523
- source "file://#{gem_repo1}"
524
-
525
- gem "foo"
526
- gem "bar", "1.0", :path => "#{relative_path}"
527
- G
528
-
529
- bundle "install --path vendor/bundle"
530
- bundle :clean, :exitstatus => true
531
-
532
- expect(exitstatus).to eq(0)
533
- end
534
-
535
- it "doesn't remove gems in dry-run mode" do
536
- gemfile <<-G
537
- source "file://#{gem_repo1}"
538
-
539
- gem "thin"
540
- gem "foo"
541
- G
542
-
543
- bundle "install --path vendor/bundle --no-clean"
544
-
545
- gemfile <<-G
546
- source "file://#{gem_repo1}"
547
-
548
- gem "thin"
549
- G
550
-
551
- bundle :install
552
-
553
- bundle "clean --dry-run"
554
-
555
- expect(out).not_to eq("Removing foo (1.0)")
556
- expect(out).to eq("Would have removed foo (1.0)")
557
-
558
- should_have_gems 'thin-1.0', 'rack-1.0.0', 'foo-1.0'
559
-
560
- expect(vendored_gems("bin/rackup")).to exist
561
- end
562
-
563
- it "doesn't store dry run as a config setting" do
564
- gemfile <<-G
565
- source "file://#{gem_repo1}"
566
-
567
- gem "thin"
568
- gem "foo"
569
- G
570
-
571
- bundle "install --path vendor/bundle --no-clean"
572
- bundle "config dry_run false"
573
-
574
- gemfile <<-G
575
- source "file://#{gem_repo1}"
576
-
577
- gem "thin"
578
- G
579
-
580
- bundle :install
581
-
582
- bundle "clean"
583
-
584
- expect(out).to eq("Removing foo (1.0)")
585
- expect(out).not_to eq("Would have removed foo (1.0)")
586
-
587
- should_have_gems 'thin-1.0', 'rack-1.0.0'
588
- should_not_have_gems 'foo-1.0'
589
-
590
- expect(vendored_gems("bin/rackup")).to exist
591
- end
592
- end