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,500 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "bundle install with explicit source paths" do
4
- it "fetches gems" do
5
- build_lib "foo"
6
-
7
- install_gemfile <<-G
8
- path "#{lib_path('foo-1.0')}"
9
- gem 'foo'
10
- G
11
-
12
- should_be_installed("foo 1.0")
13
- end
14
-
15
- it "supports pinned paths" do
16
- build_lib "foo"
17
-
18
- install_gemfile <<-G
19
- gem 'foo', :path => "#{lib_path('foo-1.0')}"
20
- G
21
-
22
- should_be_installed("foo 1.0")
23
- end
24
-
25
- it "supports relative paths" do
26
- build_lib "foo"
27
-
28
- relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new(Dir.pwd))
29
-
30
- install_gemfile <<-G
31
- gem 'foo', :path => "#{relative_path}"
32
- G
33
-
34
- should_be_installed("foo 1.0")
35
- end
36
-
37
- it "expands paths" do
38
- build_lib "foo"
39
-
40
- relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new('~').expand_path)
41
-
42
- install_gemfile <<-G
43
- gem 'foo', :path => "~/#{relative_path}"
44
- G
45
-
46
- should_be_installed("foo 1.0")
47
- end
48
-
49
- it "expands paths raise error with not existing user's home dir" do
50
- build_lib "foo"
51
- username = 'some_unexisting_user'
52
- relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new("/home/#{username}").expand_path)
53
-
54
- install_gemfile <<-G
55
- gem 'foo', :path => "~#{username}/#{relative_path}"
56
- G
57
- expect(out).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
58
- expect(out).to match("user #{username} doesn't exist")
59
- end
60
-
61
- it "expands paths relative to Bundler.root" do
62
- build_lib "foo", :path => bundled_app("foo-1.0")
63
-
64
- install_gemfile <<-G
65
- gem 'foo', :path => "./foo-1.0"
66
- G
67
-
68
- bundled_app("subdir").mkpath
69
- Dir.chdir(bundled_app("subdir")) do
70
- should_be_installed("foo 1.0")
71
- end
72
- end
73
-
74
- it "expands paths when comparing locked paths to Gemfile paths" do
75
- build_lib "foo", :path => bundled_app("foo-1.0")
76
-
77
- install_gemfile <<-G
78
- gem 'foo', :path => File.expand_path("../foo-1.0", __FILE__)
79
- G
80
-
81
- bundle "install --frozen", :exitstatus => true
82
- expect(exitstatus).to eq(0)
83
- end
84
-
85
- it "installs dependencies from the path even if a newer gem is available elsewhere" do
86
- system_gems "rack-1.0.0"
87
-
88
- build_lib "rack", "1.0", :path => lib_path('nested/bar') do |s|
89
- s.write "lib/rack.rb", "puts 'WIN OVERRIDE'"
90
- end
91
-
92
- build_lib "foo", :path => lib_path('nested') do |s|
93
- s.add_dependency "rack", "= 1.0"
94
- end
95
-
96
- install_gemfile <<-G
97
- source "file://#{gem_repo1}"
98
- gem "foo", :path => "#{lib_path('nested')}"
99
- G
100
-
101
- run "require 'rack'"
102
- expect(out).to eq('WIN OVERRIDE')
103
- end
104
-
105
- it "works" do
106
- build_gem "foo", "1.0.0", :to_system => true do |s|
107
- s.write "lib/foo.rb", "puts 'FAIL'"
108
- end
109
-
110
- build_lib "omg", "1.0", :path => lib_path("omg") do |s|
111
- s.add_dependency "foo"
112
- end
113
-
114
- build_lib "foo", "1.0.0", :path => lib_path("omg/foo")
115
-
116
- install_gemfile <<-G
117
- gem "omg", :path => "#{lib_path('omg')}"
118
- G
119
-
120
- should_be_installed "foo 1.0"
121
- end
122
-
123
- it "supports gemspec syntax" do
124
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
125
- s.add_dependency "rack", "1.0"
126
- end
127
-
128
- gemfile = <<-G
129
- source "file://#{gem_repo1}"
130
- gemspec
131
- G
132
-
133
- File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts gemfile }
134
-
135
- Dir.chdir(lib_path("foo")) do
136
- bundle "install"
137
- should_be_installed "foo 1.0"
138
- should_be_installed "rack 1.0"
139
- end
140
- end
141
-
142
- it "supports gemspec syntax with an alternative path" do
143
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
144
- s.add_dependency "rack", "1.0"
145
- end
146
-
147
- install_gemfile <<-G
148
- source "file://#{gem_repo1}"
149
- gemspec :path => "#{lib_path("foo")}"
150
- G
151
-
152
- should_be_installed "foo 1.0"
153
- should_be_installed "rack 1.0"
154
- end
155
-
156
- it "doesn't automatically unlock dependencies when using the gemspec syntax" do
157
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
158
- s.add_dependency "rack", ">= 1.0"
159
- end
160
-
161
- Dir.chdir lib_path("foo")
162
-
163
- install_gemfile lib_path("foo/Gemfile"), <<-G
164
- source "file://#{gem_repo1}"
165
- gemspec
166
- G
167
-
168
- build_gem "rack", "1.0.1", :to_system => true
169
-
170
- bundle "install"
171
-
172
- should_be_installed "foo 1.0"
173
- should_be_installed "rack 1.0"
174
- end
175
-
176
- it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do
177
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
178
- s.add_dependency "rack", ">= 1.0"
179
- s.add_development_dependency "activesupport"
180
- end
181
-
182
- Dir.chdir lib_path("foo")
183
-
184
- install_gemfile lib_path("foo/Gemfile"), <<-G
185
- source "file://#{gem_repo1}"
186
- gemspec
187
- G
188
-
189
- build_gem "rack", "1.0.1", :to_system => true
190
-
191
- bundle "install"
192
-
193
- should_be_installed "foo 1.0"
194
- should_be_installed "rack 1.0"
195
- end
196
-
197
- it "raises if there are multiple gemspecs" do
198
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
199
- s.write "bar.gemspec"
200
- end
201
-
202
- install_gemfile <<-G, :exitstatus => true
203
- gemspec :path => "#{lib_path("foo")}"
204
- G
205
-
206
- expect(exitstatus).to eq(15)
207
- expect(out).to match(/There are multiple gemspecs/)
208
- end
209
-
210
- it "allows :name to be specified to resolve ambiguity" do
211
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
212
- s.write "bar.gemspec"
213
- end
214
-
215
- install_gemfile <<-G, :exitstatus => true
216
- gemspec :path => "#{lib_path("foo")}", :name => "foo"
217
- G
218
-
219
- should_be_installed "foo 1.0"
220
- end
221
-
222
- it "sets up executables" do
223
- pending_jruby_shebang_fix
224
-
225
- build_lib "foo" do |s|
226
- s.executables = "foobar"
227
- end
228
-
229
- install_gemfile <<-G
230
- path "#{lib_path('foo-1.0')}"
231
- gem 'foo'
232
- G
233
-
234
- bundle "exec foobar"
235
- expect(out).to eq("1.0")
236
- end
237
-
238
- it "handles directories in bin/" do
239
- build_lib "foo"
240
- lib_path("foo-1.0").join("foo.gemspec").rmtree
241
- lib_path("foo-1.0").join("bin/performance").mkpath
242
-
243
- install_gemfile <<-G
244
- gem 'foo', '1.0', :path => "#{lib_path('foo-1.0')}"
245
- G
246
- expect(err).to eq("")
247
- end
248
-
249
- it "removes the .gem file after installing" do
250
- build_lib "foo"
251
-
252
- install_gemfile <<-G
253
- gem 'foo', :path => "#{lib_path('foo-1.0')}"
254
- G
255
-
256
- expect(lib_path('foo-1.0').join('foo-1.0.gem')).not_to exist
257
- end
258
-
259
- describe "block syntax" do
260
- it "pulls all gems from a path block" do
261
- build_lib "omg"
262
- build_lib "hi2u"
263
-
264
- install_gemfile <<-G
265
- path "#{lib_path}" do
266
- gem "omg"
267
- gem "hi2u"
268
- end
269
- G
270
-
271
- should_be_installed "omg 1.0", "hi2u 1.0"
272
- end
273
- end
274
-
275
- it "keeps source pinning" do
276
- build_lib "foo", "1.0", :path => lib_path('foo')
277
- build_lib "omg", "1.0", :path => lib_path('omg')
278
- build_lib "foo", "1.0", :path => lib_path('omg/foo') do |s|
279
- s.write "lib/foo.rb", "puts 'FAIL'"
280
- end
281
-
282
- install_gemfile <<-G
283
- gem "foo", :path => "#{lib_path('foo')}"
284
- gem "omg", :path => "#{lib_path('omg')}"
285
- G
286
-
287
- should_be_installed "foo 1.0"
288
- end
289
-
290
- it "works when the path does not have a gemspec" do
291
- build_lib "foo", :gemspec => false
292
-
293
- gemfile <<-G
294
- gem "foo", "1.0", :path => "#{lib_path('foo-1.0')}"
295
- G
296
-
297
- should_be_installed "foo 1.0"
298
-
299
- should_be_installed "foo 1.0"
300
- end
301
-
302
- it "installs executable stubs" do
303
- build_lib "foo" do |s|
304
- s.executables = ['foo']
305
- end
306
-
307
- install_gemfile <<-G
308
- gem "foo", :path => "#{lib_path('foo-1.0')}"
309
- G
310
-
311
- bundle "exec foo"
312
- expect(out).to eq("1.0")
313
- end
314
-
315
- describe "when the gem version in the path is updated" do
316
- before :each do
317
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
318
- s.add_dependency "bar"
319
- end
320
- build_lib "bar", "1.0", :path => lib_path("foo/bar")
321
-
322
- install_gemfile <<-G
323
- gem "foo", :path => "#{lib_path('foo')}"
324
- G
325
- end
326
-
327
- it "unlocks all gems when the top level gem is updated" do
328
- build_lib "foo", "2.0", :path => lib_path("foo") do |s|
329
- s.add_dependency "bar"
330
- end
331
-
332
- bundle "install"
333
-
334
- should_be_installed "foo 2.0", "bar 1.0"
335
- end
336
-
337
- it "unlocks all gems when a child dependency gem is updated" do
338
- build_lib "bar", "2.0", :path => lib_path("foo/bar")
339
-
340
- bundle "install"
341
-
342
- should_be_installed "foo 1.0", "bar 2.0"
343
- end
344
- end
345
-
346
- describe "when dependencies in the path are updated" do
347
- before :each do
348
- build_lib "foo", "1.0", :path => lib_path("foo")
349
-
350
- install_gemfile <<-G
351
- source "file://#{gem_repo1}"
352
- gem "foo", :path => "#{lib_path('foo')}"
353
- G
354
- end
355
-
356
- it "gets dependencies that are updated in the path" do
357
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
358
- s.add_dependency "rack"
359
- end
360
-
361
- bundle "install"
362
-
363
- should_be_installed "rack 1.0.0"
364
- end
365
- end
366
-
367
- describe "switching sources" do
368
- it "doesn't switch pinned git sources to rubygems when pinning the parent gem to a path source" do
369
- build_gem "foo", "1.0", :to_system => true do |s|
370
- s.write "lib/foo.rb", "raise 'fail'"
371
- end
372
- build_lib "foo", "1.0", :path => lib_path('bar/foo')
373
- build_git "bar", "1.0", :path => lib_path('bar') do |s|
374
- s.add_dependency 'foo'
375
- end
376
-
377
- install_gemfile <<-G
378
- source "file://#{gem_repo1}"
379
- gem "bar", :git => "#{lib_path('bar')}"
380
- G
381
-
382
- install_gemfile <<-G
383
- source "file://#{gem_repo1}"
384
- gem "bar", :path => "#{lib_path('bar')}"
385
- G
386
-
387
- should_be_installed "foo 1.0", "bar 1.0"
388
- end
389
-
390
- it "switches the source when the gem existed in rubygems and the path was already being used for another gem" do
391
- build_lib "foo", "1.0", :path => lib_path("foo")
392
- build_gem "bar", "1.0", :to_system => true do |s|
393
- s.write "lib/bar.rb", "raise 'fail'"
394
- end
395
-
396
- install_gemfile <<-G
397
- source "file://#{gem_repo1}"
398
- gem "bar"
399
- path "#{lib_path('foo')}" do
400
- gem "foo"
401
- end
402
- G
403
-
404
- build_lib "bar", "1.0", :path => lib_path("foo/bar")
405
-
406
- install_gemfile <<-G
407
- source "file://#{gem_repo1}"
408
- path "#{lib_path('foo')}" do
409
- gem "foo"
410
- gem "bar"
411
- end
412
- G
413
-
414
- should_be_installed "bar 1.0"
415
- end
416
- end
417
-
418
- describe "when there are both a gemspec and remote gems" do
419
- it "doesn't query rubygems for local gemspec name" do
420
- build_lib "private_lib", "2.2", :path => lib_path("private_lib")
421
- gemfile = <<-G
422
- source "http://localgemserver.test"
423
- gemspec
424
- gem 'rack'
425
- G
426
- File.open(lib_path("private_lib/Gemfile"), "w") {|f| f.puts gemfile }
427
-
428
- Dir.chdir(lib_path("private_lib")) do
429
- bundle :install, :env => {"DEBUG" => 1}, :artifice => "endpoint"
430
- expect(out).to match(/^HTTP GET http:\/\/localgemserver\.test\/api\/v1\/dependencies\?gems=rack$/)
431
- expect(out).not_to match(/^HTTP GET.*private_lib/)
432
- should_be_installed "private_lib 2.2"
433
- should_be_installed "rack 1.0"
434
- end
435
- end
436
- end
437
-
438
- describe "gem install hooks" do
439
- it "runs pre-install hooks" do
440
- build_git "foo"
441
- gemfile <<-G
442
- gem "foo", :git => "#{lib_path('foo-1.0')}"
443
- G
444
-
445
- File.open(lib_path("install_hooks.rb"), "w") do |h|
446
- h.write <<-H
447
- require 'rubygems'
448
- Gem.pre_install_hooks << lambda do |inst|
449
- STDERR.puts "Ran pre-install hook: \#{inst.spec.full_name}"
450
- end
451
- H
452
- end
453
-
454
- bundle :install, :expect_err => true,
455
- :requires => [lib_path('install_hooks.rb')]
456
- expect(err).to eq("Ran pre-install hook: foo-1.0")
457
- end
458
-
459
- it "runs post-install hooks" do
460
- build_git "foo"
461
- gemfile <<-G
462
- gem "foo", :git => "#{lib_path('foo-1.0')}"
463
- G
464
-
465
- File.open(lib_path("install_hooks.rb"), "w") do |h|
466
- h.write <<-H
467
- require 'rubygems'
468
- Gem.post_install_hooks << lambda do |inst|
469
- STDERR.puts "Ran post-install hook: \#{inst.spec.full_name}"
470
- end
471
- H
472
- end
473
-
474
- bundle :install, :expect_err => true,
475
- :requires => [lib_path('install_hooks.rb')]
476
- expect(err).to eq("Ran post-install hook: foo-1.0")
477
- end
478
-
479
- it "complains if the install hook fails" do
480
- build_git "foo"
481
- gemfile <<-G
482
- gem "foo", :git => "#{lib_path('foo-1.0')}"
483
- G
484
-
485
- File.open(lib_path("install_hooks.rb"), "w") do |h|
486
- h.write <<-H
487
- require 'rubygems'
488
- Gem.pre_install_hooks << lambda do |inst|
489
- false
490
- end
491
- H
492
- end
493
-
494
- bundle :install, :expect_err => true,
495
- :requires => [lib_path('install_hooks.rb')]
496
- expect(out).to include("failed for foo-1.0")
497
- end
498
- end
499
-
500
- end