bundler 1.0.21 → 1.1.rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +7 -0
- data/CHANGELOG.md +153 -1
- data/README.md +3 -3
- data/Rakefile +15 -27
- data/bin/bundle +7 -0
- data/bundler.gemspec +1 -1
- data/lib/bundler/cli.rb +126 -45
- data/lib/bundler/definition.rb +22 -5
- data/lib/bundler/dep_proxy.rb +35 -0
- data/lib/bundler/dsl.rb +17 -34
- data/lib/bundler/endpoint_specification.rb +69 -0
- data/lib/bundler/fetcher.rb +221 -0
- data/lib/bundler/gem_helper.rb +0 -1
- data/lib/bundler/gem_helpers.rb +23 -0
- data/lib/bundler/index.rb +77 -38
- data/lib/bundler/installer.rb +43 -1
- data/lib/bundler/man/bundle-benchmark +19 -0
- data/lib/bundler/man/bundle-benchmark.txt +27 -0
- data/lib/bundler/man/bundle-config +1 -1
- data/lib/bundler/man/bundle-config.txt +3 -3
- data/lib/bundler/man/bundle-install +288 -0
- data/lib/bundler/man/bundle-install.txt +74 -79
- data/lib/bundler/man/bundle-package +1 -1
- data/lib/bundler/man/bundle-package.txt +1 -1
- data/lib/bundler/man/bundle-update +1 -1
- data/lib/bundler/man/bundle-update.txt +41 -41
- data/lib/bundler/man/gemfile.5 +6 -7
- data/lib/bundler/man/gemfile.5.txt +9 -9
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/remote_specification.rb +6 -8
- data/lib/bundler/resolver.rb +32 -19
- data/lib/bundler/rubygems_ext.rb +2 -86
- data/lib/bundler/rubygems_integration.rb +35 -0
- data/lib/bundler/runtime.rb +84 -1
- data/lib/bundler/source.rb +85 -88
- data/lib/bundler/spec_set.rb +2 -0
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +1 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +1 -1
- data/lib/bundler/templates/newgem/gitignore.tt +14 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -20
- data/lib/bundler/ui.rb +32 -17
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +468 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler.rb +56 -23
- data/man/bundle-install.ronn +7 -0
- data/man/bundle.ronn +3 -0
- data/man/gemfile.5.ronn +6 -6
- data/spec/bundler/dsl_spec.rb +22 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/install/deprecated_spec.rb +2 -3
- data/spec/install/gems/dependency_api_spec.rb +358 -0
- data/spec/install/gems/flex_spec.rb +1 -1
- data/spec/install/gems/groups_spec.rb +17 -8
- data/spec/install/gems/platform_spec.rb +16 -0
- data/spec/install/gems/post_install_spec.rb +47 -0
- data/spec/install/gems/simple_case_spec.rb +61 -64
- data/spec/install/gems/standalone_spec.rb +238 -0
- data/spec/install/git_spec.rb +62 -0
- data/spec/other/check_spec.rb +30 -0
- data/spec/other/clean_spec.rb +397 -0
- data/spec/other/exec_spec.rb +0 -29
- data/spec/other/newgem_spec.rb +39 -0
- data/spec/other/outdated_spec.rb +93 -0
- data/spec/other/show_spec.rb +6 -0
- data/spec/quality_spec.rb +1 -1
- data/spec/realworld/edgecases_spec.rb +12 -0
- data/spec/runtime/executable_spec.rb +10 -0
- data/spec/runtime/require_spec.rb +8 -9
- data/spec/runtime/with_clean_env_spec.rb +60 -7
- data/spec/spec_helper.rb +8 -1
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +54 -0
- data/spec/support/artifice/endpoint_500.rb +37 -0
- data/spec/support/artifice/endpoint_api_missing.rb +16 -0
- data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint_extra.rb +27 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +18 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/builders.rb +7 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/helpers.rb +36 -3
- data/spec/support/path.rb +2 -0
- data/spec/support/rubygems_ext.rb +3 -3
- metadata +48 -74
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "bundle clean" do
|
|
4
|
+
def should_have_gems(*gems)
|
|
5
|
+
gems.each do |g|
|
|
6
|
+
vendored_gems("gems/#{g}").should exist
|
|
7
|
+
vendored_gems("specifications/#{g}.gemspec").should exist
|
|
8
|
+
vendored_gems("cache/#{g}.gem").should exist
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def should_not_have_gems(*gems)
|
|
13
|
+
gems.each do |g|
|
|
14
|
+
vendored_gems("gems/#{g}").should_not exist
|
|
15
|
+
vendored_gems("specifications/#{g}.gemspec").should_not exist
|
|
16
|
+
vendored_gems("cache/#{g}.gem").should_not 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 --no-clean"
|
|
36
|
+
|
|
37
|
+
bundle :clean
|
|
38
|
+
|
|
39
|
+
out.should 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
|
+
vendored_gems("bin/rackup").should 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 --no-clean"
|
|
64
|
+
|
|
65
|
+
bundle :clean
|
|
66
|
+
|
|
67
|
+
out.should 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
|
+
vendored_gems("bin/rackup").should 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 --no-clean"
|
|
92
|
+
|
|
93
|
+
bundle :clean
|
|
94
|
+
|
|
95
|
+
out.should 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
|
+
vendored_gems("bin/rackup").should exist
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "remove 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 --no-clean"
|
|
115
|
+
bundle "install --without test_group --no-clean"
|
|
116
|
+
bundle :clean
|
|
117
|
+
|
|
118
|
+
out.should 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
|
+
vendored_gems("bin/rackup").should_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 --no-clean"
|
|
141
|
+
|
|
142
|
+
bundle :clean
|
|
143
|
+
|
|
144
|
+
digest = Digest::SHA1.hexdigest(git_path.to_s)
|
|
145
|
+
vendored_gems("cache/bundler/git/foo-1.0-#{digest}").should exist
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it "removes unused git gems" do
|
|
149
|
+
build_git "foo"
|
|
150
|
+
revision = revision_for(lib_path("foo-1.0"))
|
|
151
|
+
git_path = lib_path('foo-1.0')
|
|
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 --no-clean"
|
|
163
|
+
|
|
164
|
+
gemfile <<-G
|
|
165
|
+
source "file://#{gem_repo1}"
|
|
166
|
+
|
|
167
|
+
gem "rack", "1.0.0"
|
|
168
|
+
G
|
|
169
|
+
bundle "install --no-clean"
|
|
170
|
+
|
|
171
|
+
bundle :clean
|
|
172
|
+
|
|
173
|
+
out.should eq("Removing foo (1.0 #{revision[0..11]})")
|
|
174
|
+
|
|
175
|
+
vendored_gems("gems/rack-1.0.0").should exist
|
|
176
|
+
vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
|
|
177
|
+
digest = Digest::SHA1.hexdigest(git_path.to_s)
|
|
178
|
+
vendored_gems("cache/bundler/git/foo-1.0-#{digest}").should_not exist
|
|
179
|
+
|
|
180
|
+
vendored_gems("specifications/rack-1.0.0.gemspec").should exist
|
|
181
|
+
|
|
182
|
+
vendored_gems("bin/rackup").should exist
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it "removes old git gems" do
|
|
186
|
+
build_git "foo"
|
|
187
|
+
revision = revision_for(lib_path("foo-1.0"))
|
|
188
|
+
|
|
189
|
+
gemfile <<-G
|
|
190
|
+
source "file://#{gem_repo1}"
|
|
191
|
+
|
|
192
|
+
gem "rack", "1.0.0"
|
|
193
|
+
git "#{lib_path('foo-1.0')}" do
|
|
194
|
+
gem "foo"
|
|
195
|
+
end
|
|
196
|
+
G
|
|
197
|
+
|
|
198
|
+
bundle "install --path vendor/bundle --no-clean"
|
|
199
|
+
|
|
200
|
+
update_git "foo"
|
|
201
|
+
revision2 = revision_for(lib_path("foo-1.0"))
|
|
202
|
+
|
|
203
|
+
bundle "update --no-clean"
|
|
204
|
+
bundle :clean
|
|
205
|
+
|
|
206
|
+
out.should eq("Removing foo (1.0 #{revision[0..11]})")
|
|
207
|
+
|
|
208
|
+
vendored_gems("gems/rack-1.0.0").should exist
|
|
209
|
+
vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
|
|
210
|
+
vendored_gems("bundler/gems/foo-1.0-#{revision2[0..11]}").should exist
|
|
211
|
+
|
|
212
|
+
vendored_gems("specifications/rack-1.0.0.gemspec").should exist
|
|
213
|
+
|
|
214
|
+
vendored_gems("bin/rackup").should 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 --no-clean"
|
|
229
|
+
bundle :clean
|
|
230
|
+
out.should eq("")
|
|
231
|
+
|
|
232
|
+
vendored_gems("bundler/gems/rails-#{revision[0..11]}").should exist
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
it "displays an error when used without --path" do
|
|
236
|
+
install_gemfile <<-G
|
|
237
|
+
source "file://#{gem_repo1}"
|
|
238
|
+
|
|
239
|
+
gem "rack", "1.0.0"
|
|
240
|
+
G
|
|
241
|
+
|
|
242
|
+
bundle :clean
|
|
243
|
+
|
|
244
|
+
out.should == "Can only use bundle clean when --path is set or --force is set"
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# handling bundle clean upgrade path from the pre's
|
|
248
|
+
it "removes .gem/.gemspec file even if there's no corresponding gem dir is already moved" do
|
|
249
|
+
gemfile <<-G
|
|
250
|
+
source "file://#{gem_repo1}"
|
|
251
|
+
|
|
252
|
+
gem "thin"
|
|
253
|
+
gem "foo"
|
|
254
|
+
G
|
|
255
|
+
|
|
256
|
+
bundle "install --path vendor/bundle --no-clean"
|
|
257
|
+
|
|
258
|
+
gemfile <<-G
|
|
259
|
+
source "file://#{gem_repo1}"
|
|
260
|
+
|
|
261
|
+
gem "foo"
|
|
262
|
+
G
|
|
263
|
+
bundle "install --no-clean"
|
|
264
|
+
|
|
265
|
+
FileUtils.rm(vendored_gems("bin/rackup"))
|
|
266
|
+
FileUtils.rm_rf(vendored_gems("gems/thin-1.0"))
|
|
267
|
+
FileUtils.rm_rf(vendored_gems("gems/rack-1.0.0"))
|
|
268
|
+
|
|
269
|
+
bundle :clean
|
|
270
|
+
|
|
271
|
+
should_not_have_gems 'thin-1.0', 'rack-1.0'
|
|
272
|
+
should_have_gems 'foo-1.0'
|
|
273
|
+
|
|
274
|
+
vendored_gems("bin/rackup").should_not exist
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
it "does not call clean automatically when using system gems" do
|
|
278
|
+
gemfile <<-G
|
|
279
|
+
source "file://#{gem_repo1}"
|
|
280
|
+
|
|
281
|
+
gem "thin"
|
|
282
|
+
gem "rack"
|
|
283
|
+
G
|
|
284
|
+
bundle :install
|
|
285
|
+
|
|
286
|
+
gemfile <<-G
|
|
287
|
+
source "file://#{gem_repo1}"
|
|
288
|
+
|
|
289
|
+
gem "rack"
|
|
290
|
+
G
|
|
291
|
+
bundle :install
|
|
292
|
+
|
|
293
|
+
sys_exec "gem list"
|
|
294
|
+
out.should include("rack (1.0.0)")
|
|
295
|
+
out.should include("thin (1.0)")
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
it "--clean should override the bundle setting" do
|
|
299
|
+
gemfile <<-G
|
|
300
|
+
source "file://#{gem_repo1}"
|
|
301
|
+
|
|
302
|
+
gem "thin"
|
|
303
|
+
gem "rack"
|
|
304
|
+
G
|
|
305
|
+
bundle "install --path vendor/bundle --no-clean"
|
|
306
|
+
|
|
307
|
+
gemfile <<-G
|
|
308
|
+
source "file://#{gem_repo1}"
|
|
309
|
+
|
|
310
|
+
gem "rack"
|
|
311
|
+
G
|
|
312
|
+
bundle "install --clean"
|
|
313
|
+
|
|
314
|
+
should_have_gems 'rack-1.0.0'
|
|
315
|
+
should_not_have_gems 'thin-1.0'
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
it "clean automatically on --path" do
|
|
319
|
+
gemfile <<-G
|
|
320
|
+
source "file://#{gem_repo1}"
|
|
321
|
+
|
|
322
|
+
gem "thin"
|
|
323
|
+
gem "rack"
|
|
324
|
+
G
|
|
325
|
+
bundle "install --path vendor/bundle"
|
|
326
|
+
|
|
327
|
+
gemfile <<-G
|
|
328
|
+
source "file://#{gem_repo1}"
|
|
329
|
+
|
|
330
|
+
gem "rack"
|
|
331
|
+
G
|
|
332
|
+
bundle "install"
|
|
333
|
+
|
|
334
|
+
should_have_gems 'rack-1.0.0'
|
|
335
|
+
should_not_have_gems 'thin-1.0'
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
it "cleans on bundle update with --path" do
|
|
339
|
+
build_repo2
|
|
340
|
+
|
|
341
|
+
gemfile <<-G
|
|
342
|
+
source "file://#{gem_repo2}"
|
|
343
|
+
|
|
344
|
+
gem "foo"
|
|
345
|
+
G
|
|
346
|
+
bundle "install --path vendor/bundle"
|
|
347
|
+
|
|
348
|
+
update_repo2 do
|
|
349
|
+
build_gem 'foo', '1.0.1'
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
bundle :update
|
|
353
|
+
should_not_have_gems 'foo-1.0'
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
it "does not clean on bundle update when using --system" do
|
|
357
|
+
build_repo2
|
|
358
|
+
|
|
359
|
+
gemfile <<-G
|
|
360
|
+
source "file://#{gem_repo2}"
|
|
361
|
+
|
|
362
|
+
gem "foo"
|
|
363
|
+
G
|
|
364
|
+
bundle "install"
|
|
365
|
+
|
|
366
|
+
update_repo2 do
|
|
367
|
+
build_gem 'foo', '1.0.1'
|
|
368
|
+
end
|
|
369
|
+
bundle :update
|
|
370
|
+
|
|
371
|
+
sys_exec "gem list"
|
|
372
|
+
out.should include("foo (1.0.1, 1.0)")
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
it "cleans system gems when --force is used" do
|
|
376
|
+
gemfile <<-G
|
|
377
|
+
source "file://#{gem_repo1}"
|
|
378
|
+
|
|
379
|
+
gem "foo"
|
|
380
|
+
gem "rack"
|
|
381
|
+
G
|
|
382
|
+
bundle :install
|
|
383
|
+
|
|
384
|
+
gemfile <<-G
|
|
385
|
+
source "file://#{gem_repo1}"
|
|
386
|
+
|
|
387
|
+
gem "rack"
|
|
388
|
+
G
|
|
389
|
+
bundle :install
|
|
390
|
+
bundle "clean --force"
|
|
391
|
+
|
|
392
|
+
out.should eq("Removing foo (1.0)")
|
|
393
|
+
sys_exec "gem list"
|
|
394
|
+
out.should_not include("foo (1.0)")
|
|
395
|
+
out.should include("rack (1.0.0)")
|
|
396
|
+
end
|
|
397
|
+
end
|
data/spec/other/exec_spec.rb
CHANGED
|
@@ -216,33 +216,4 @@ describe "bundle exec" do
|
|
|
216
216
|
end
|
|
217
217
|
|
|
218
218
|
end
|
|
219
|
-
|
|
220
|
-
describe "bundling bundler" do
|
|
221
|
-
before(:each) do
|
|
222
|
-
gemfile <<-G
|
|
223
|
-
source "file://#{gem_repo1}"
|
|
224
|
-
gem "rack"
|
|
225
|
-
G
|
|
226
|
-
|
|
227
|
-
bundle "install --path vendor/bundle --disable-shared-gems"
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
it "does not explode with --disable-shared-gems" do
|
|
231
|
-
bundle "exec bundle check", :exitstatus => true
|
|
232
|
-
exitstatus.should == 0
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
it "does not explode when starting with Bundler.setup" do
|
|
236
|
-
ruby <<-R
|
|
237
|
-
require "rubygems"
|
|
238
|
-
require "bundler"
|
|
239
|
-
Bundler.setup
|
|
240
|
-
puts `bundle check`
|
|
241
|
-
puts $?.exitstatus
|
|
242
|
-
R
|
|
243
|
-
|
|
244
|
-
out.should include("satisfied")
|
|
245
|
-
out.should include("\n0")
|
|
246
|
-
end
|
|
247
|
-
end
|
|
248
219
|
end
|
data/spec/other/newgem_spec.rb
CHANGED
|
@@ -2,9 +2,20 @@ require "spec_helper"
|
|
|
2
2
|
|
|
3
3
|
describe "bundle gem" do
|
|
4
4
|
before :each do
|
|
5
|
+
@git_name = `git config --global user.name`.chomp
|
|
6
|
+
`git config --global user.name "Bundler User"`
|
|
7
|
+
@git_email = `git config --global user.email`.chomp
|
|
8
|
+
`git config --global user.email user@example.com`
|
|
5
9
|
bundle 'gem test-gem'
|
|
6
10
|
end
|
|
7
11
|
|
|
12
|
+
after :each do
|
|
13
|
+
`git config --global user.name "#{@git_name}"`
|
|
14
|
+
`git config --global user.email #{@git_email}`
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
let(:generated_gem) { Bundler::GemHelper.new(bundled_app("test-gem").to_s) }
|
|
18
|
+
|
|
8
19
|
it "generates a gem skeleton" do
|
|
9
20
|
bundled_app("test-gem/test-gem.gemspec").should exist
|
|
10
21
|
bundled_app("test-gem/Gemfile").should exist
|
|
@@ -22,6 +33,34 @@ describe "bundle gem" do
|
|
|
22
33
|
bundled_app("test-gem/lib/test-gem.rb").read.should =~ /module Test\n module Gem/
|
|
23
34
|
end
|
|
24
35
|
|
|
36
|
+
context "git config user.{name,email} present" do
|
|
37
|
+
it "sets gemspec author to git user.name if available" do
|
|
38
|
+
generated_gem.gemspec.authors.first.should == "Bundler User"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "sets gemspec email to git user.email if available" do
|
|
42
|
+
generated_gem.gemspec.email.first.should == "user@example.com"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context "git config user.{name,email} is not set" do
|
|
47
|
+
before :each do
|
|
48
|
+
`git config --global --unset user.name`
|
|
49
|
+
`git config --global --unset user.email`
|
|
50
|
+
reset!
|
|
51
|
+
in_app_root
|
|
52
|
+
bundle 'gem test-gem'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "sets gemspec author to default message if git user.name is not set or empty" do
|
|
56
|
+
generated_gem.gemspec.authors.first.should == "TODO: Write your name"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "sets gemspec email to default message if git user.email is not set or empty" do
|
|
60
|
+
generated_gem.gemspec.email.first.should == "TODO: Write your email address"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
25
64
|
it "requires the version file" do
|
|
26
65
|
bundled_app("test-gem/lib/test-gem.rb").read.should =~ /require "test-gem\/version"/
|
|
27
66
|
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "bundle outdated" do
|
|
4
|
+
|
|
5
|
+
before :each do
|
|
6
|
+
build_repo2 do
|
|
7
|
+
build_git "foo", :path => lib_path("foo")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
install_gemfile <<-G
|
|
11
|
+
source "file://#{gem_repo2}"
|
|
12
|
+
gem "activesupport", "2.3.5"
|
|
13
|
+
gem "foo", :git => "#{lib_path('foo')}"
|
|
14
|
+
G
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "with no arguments" do
|
|
18
|
+
it "returns list of outdated gems" do
|
|
19
|
+
update_repo2 do
|
|
20
|
+
build_gem "activesupport", "3.0"
|
|
21
|
+
update_git "foo", :path => lib_path("foo")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
bundle "outdated"
|
|
25
|
+
out.should include("activesupport (3.0 > 2.3.5)")
|
|
26
|
+
out.should include("foo (1.0")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "with --local option" do
|
|
31
|
+
it "doesn't hit repo2" do
|
|
32
|
+
FileUtils.rm_rf(gem_repo2)
|
|
33
|
+
|
|
34
|
+
bundle "outdated --local"
|
|
35
|
+
out.should_not match(/Fetching source index/)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe "with specified gems" do
|
|
40
|
+
it "returns list of outdated gems" do
|
|
41
|
+
update_repo2 do
|
|
42
|
+
build_gem "activesupport", "3.0"
|
|
43
|
+
update_git "foo", :path => lib_path("foo")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
bundle "outdated foo"
|
|
47
|
+
out.should_not include("activesupport (3.0 > 2.3.5)")
|
|
48
|
+
out.should include("foo (1.0")
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe "pre-release gems" do
|
|
53
|
+
context "without the --pre option" do
|
|
54
|
+
it "ignores pre-release versions" do
|
|
55
|
+
update_repo2 do
|
|
56
|
+
build_gem "activesupport", "3.0.0.beta"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
bundle "outdated"
|
|
60
|
+
out.should_not include("activesupport (3.0.0.beta > 2.3.5)")
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
context "with the --pre option" do
|
|
65
|
+
it "includes pre-release versions" do
|
|
66
|
+
update_repo2 do
|
|
67
|
+
build_gem "activesupport", "3.0.0.beta"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
bundle "outdated --pre"
|
|
71
|
+
out.should include("activesupport (3.0.0.beta > 2.3.5)")
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
context "when current gem is a pre-release" do
|
|
76
|
+
it "includes the gem" do
|
|
77
|
+
update_repo2 do
|
|
78
|
+
build_gem "activesupport", "3.0.0.beta.1"
|
|
79
|
+
build_gem "activesupport", "3.0.0.beta.2"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
install_gemfile <<-G
|
|
83
|
+
source "file://#{gem_repo2}"
|
|
84
|
+
gem "activesupport", "3.0.0.beta.1"
|
|
85
|
+
G
|
|
86
|
+
|
|
87
|
+
bundle "outdated"
|
|
88
|
+
out.should include("activesupport (3.0.0.beta.2 > 3.0.0.beta.1)")
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
data/spec/other/show_spec.rb
CHANGED
|
@@ -38,6 +38,12 @@ describe "bundle show" do
|
|
|
38
38
|
bundle "show missing"
|
|
39
39
|
out.should =~ /could not find gem 'missing'/i
|
|
40
40
|
end
|
|
41
|
+
|
|
42
|
+
it "prints path of all gems in bundle" do
|
|
43
|
+
bundle "show --paths"
|
|
44
|
+
out.should include(default_bundle_path('gems', 'rake-0.8.7').to_s)
|
|
45
|
+
out.should include(default_bundle_path('gems', 'rails-2.3.2').to_s)
|
|
46
|
+
end
|
|
41
47
|
end
|
|
42
48
|
|
|
43
49
|
describe "bundle show with a git repo" do
|
data/spec/quality_spec.rb
CHANGED
|
@@ -42,7 +42,7 @@ describe "The library itself" do
|
|
|
42
42
|
error_messages = []
|
|
43
43
|
Dir.chdir(File.expand_path("../..", __FILE__)) do
|
|
44
44
|
`git ls-files`.split("\n").each do |filename|
|
|
45
|
-
next if filename =~ /\.gitmodules|fixtures/
|
|
45
|
+
next if filename =~ /\.gitmodules|\.marshal|fixtures|vendor/
|
|
46
46
|
error_messages << check_for_tab_characters(filename)
|
|
47
47
|
error_messages << check_for_extra_spaces(filename)
|
|
48
48
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
describe "real world edgecases", :realworld => true do
|
|
2
|
+
if RUBY_VERSION < "1.9"
|
|
3
|
+
# there is no rbx-relative-require gem that will install on 1.9
|
|
4
|
+
it "ignores extra gems with bad platforms" do
|
|
5
|
+
install_gemfile <<-G
|
|
6
|
+
source :rubygems
|
|
7
|
+
gem "linecache", "0.46"
|
|
8
|
+
G
|
|
9
|
+
err.should eq("")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -36,6 +36,16 @@ describe "Running bin/* commands" do
|
|
|
36
36
|
out.should == "1.0.0"
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
it "uses the default ruby install name when shebang is not specified" do
|
|
40
|
+
bundle "install --binstubs"
|
|
41
|
+
File.open("bin/rackup").gets.should == "#!/usr/bin/env #{RbConfig::CONFIG['ruby_install_name']}\n"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "allows the name of the shebang executable to be specified" do
|
|
45
|
+
bundle "install --binstubs --shebang ruby-foo"
|
|
46
|
+
File.open("bin/rackup").gets.should == "#!/usr/bin/env ruby-foo\n"
|
|
47
|
+
end
|
|
48
|
+
|
|
39
49
|
it "runs the bundled command when out of the bundle" do
|
|
40
50
|
bundle "install --binstubs"
|
|
41
51
|
|
|
@@ -82,14 +82,11 @@ describe "Bundler.require" do
|
|
|
82
82
|
gem "two", :require => 'fail'
|
|
83
83
|
G
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Bundler.require
|
|
88
|
-
rescue LoadError => e
|
|
89
|
-
puts e.message
|
|
90
|
-
end
|
|
85
|
+
load_error_run <<-R, 'fail'
|
|
86
|
+
Bundler.require
|
|
91
87
|
R
|
|
92
|
-
|
|
88
|
+
|
|
89
|
+
err.should == "ZOMG LOAD ERROR"
|
|
93
90
|
end
|
|
94
91
|
|
|
95
92
|
describe "using bundle exec" do
|
|
@@ -191,8 +188,10 @@ describe "Bundler.require" do
|
|
|
191
188
|
gem "busted_require"
|
|
192
189
|
G
|
|
193
190
|
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
load_error_run <<-R, 'no_such_file_omg'
|
|
192
|
+
Bundler.require
|
|
193
|
+
R
|
|
194
|
+
err.should == 'ZOMG LOAD ERROR'
|
|
196
195
|
end
|
|
197
196
|
end
|
|
198
197
|
end
|