bundler-maglev- 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/.gitignore +22 -0
  2. data/.travis.yml +32 -0
  3. data/CHANGELOG.md +805 -0
  4. data/ISSUES.md +62 -0
  5. data/LICENSE +23 -0
  6. data/README.md +29 -0
  7. data/Rakefile +212 -0
  8. data/UPGRADING.md +103 -0
  9. data/bin/bundle +22 -0
  10. data/bundler.gemspec +30 -0
  11. data/lib/bundler.rb +286 -0
  12. data/lib/bundler/capistrano.rb +11 -0
  13. data/lib/bundler/cli.rb +520 -0
  14. data/lib/bundler/definition.rb +438 -0
  15. data/lib/bundler/dependency.rb +134 -0
  16. data/lib/bundler/deployment.rb +58 -0
  17. data/lib/bundler/dsl.rb +257 -0
  18. data/lib/bundler/environment.rb +47 -0
  19. data/lib/bundler/gem_helper.rb +151 -0
  20. data/lib/bundler/gem_installer.rb +9 -0
  21. data/lib/bundler/gem_tasks.rb +2 -0
  22. data/lib/bundler/graph.rb +130 -0
  23. data/lib/bundler/index.rb +138 -0
  24. data/lib/bundler/installer.rb +97 -0
  25. data/lib/bundler/lazy_specification.rb +74 -0
  26. data/lib/bundler/lockfile_parser.rb +108 -0
  27. data/lib/bundler/remote_specification.rb +59 -0
  28. data/lib/bundler/resolver.rb +464 -0
  29. data/lib/bundler/rubygems_ext.rb +237 -0
  30. data/lib/bundler/rubygems_integration.rb +349 -0
  31. data/lib/bundler/runtime.rb +152 -0
  32. data/lib/bundler/settings.rb +115 -0
  33. data/lib/bundler/setup.rb +23 -0
  34. data/lib/bundler/shared_helpers.rb +71 -0
  35. data/lib/bundler/source.rb +708 -0
  36. data/lib/bundler/spec_set.rb +135 -0
  37. data/lib/bundler/templates/Executable +16 -0
  38. data/lib/bundler/templates/Gemfile +4 -0
  39. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  40. data/lib/bundler/templates/newgem/Rakefile.tt +1 -0
  41. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  42. data/lib/bundler/templates/newgem/gitignore.tt +4 -0
  43. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
  44. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  45. data/lib/bundler/templates/newgem/newgem.gemspec.tt +24 -0
  46. data/lib/bundler/ui.rb +73 -0
  47. data/lib/bundler/vendor/thor.rb +358 -0
  48. data/lib/bundler/vendor/thor/actions.rb +314 -0
  49. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  50. data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
  51. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  52. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  53. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
  54. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
  55. data/lib/bundler/vendor/thor/base.rb +576 -0
  56. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  57. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  58. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  59. data/lib/bundler/vendor/thor/error.rb +30 -0
  60. data/lib/bundler/vendor/thor/group.rb +273 -0
  61. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  62. data/lib/bundler/vendor/thor/parser.rb +4 -0
  63. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  64. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  65. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  66. data/lib/bundler/vendor/thor/parser/options.rb +175 -0
  67. data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
  68. data/lib/bundler/vendor/thor/runner.rb +309 -0
  69. data/lib/bundler/vendor/thor/shell.rb +88 -0
  70. data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
  71. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  72. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  73. data/lib/bundler/vendor/thor/task.rb +113 -0
  74. data/lib/bundler/vendor/thor/util.rb +229 -0
  75. data/lib/bundler/vendor/thor/version.rb +3 -0
  76. data/lib/bundler/vendored_thor.rb +7 -0
  77. data/lib/bundler/version.rb +6 -0
  78. data/lib/bundler/vlad.rb +11 -0
  79. data/man/bundle-config.ronn +90 -0
  80. data/man/bundle-exec.ronn +111 -0
  81. data/man/bundle-install.ronn +317 -0
  82. data/man/bundle-package.ronn +59 -0
  83. data/man/bundle-update.ronn +176 -0
  84. data/man/bundle.ronn +80 -0
  85. data/man/gemfile.5.ronn +284 -0
  86. data/man/index.txt +6 -0
  87. data/spec/bundler/gem_helper_spec.rb +143 -0
  88. data/spec/cache/gems_spec.rb +230 -0
  89. data/spec/cache/git_spec.rb +12 -0
  90. data/spec/cache/path_spec.rb +27 -0
  91. data/spec/cache/platform_spec.rb +57 -0
  92. data/spec/install/deploy_spec.rb +197 -0
  93. data/spec/install/deprecated_spec.rb +37 -0
  94. data/spec/install/gems/c_ext_spec.rb +48 -0
  95. data/spec/install/gems/env_spec.rb +107 -0
  96. data/spec/install/gems/flex_spec.rb +313 -0
  97. data/spec/install/gems/groups_spec.rb +259 -0
  98. data/spec/install/gems/packed_spec.rb +84 -0
  99. data/spec/install/gems/platform_spec.rb +192 -0
  100. data/spec/install/gems/resolving_spec.rb +72 -0
  101. data/spec/install/gems/simple_case_spec.rb +770 -0
  102. data/spec/install/gems/sudo_spec.rb +74 -0
  103. data/spec/install/gems/win32_spec.rb +26 -0
  104. data/spec/install/gemspec_spec.rb +125 -0
  105. data/spec/install/git_spec.rb +570 -0
  106. data/spec/install/invalid_spec.rb +35 -0
  107. data/spec/install/path_spec.rb +405 -0
  108. data/spec/install/upgrade_spec.rb +26 -0
  109. data/spec/lock/git_spec.rb +35 -0
  110. data/spec/lock/lockfile_spec.rb +739 -0
  111. data/spec/other/check_spec.rb +221 -0
  112. data/spec/other/config_spec.rb +40 -0
  113. data/spec/other/console_spec.rb +54 -0
  114. data/spec/other/exec_spec.rb +248 -0
  115. data/spec/other/ext_spec.rb +37 -0
  116. data/spec/other/help_spec.rb +39 -0
  117. data/spec/other/init_spec.rb +40 -0
  118. data/spec/other/newgem_spec.rb +46 -0
  119. data/spec/other/open_spec.rb +35 -0
  120. data/spec/other/show_spec.rb +82 -0
  121. data/spec/quality_spec.rb +62 -0
  122. data/spec/resolver/basic_spec.rb +20 -0
  123. data/spec/resolver/platform_spec.rb +82 -0
  124. data/spec/runtime/executable_spec.rb +110 -0
  125. data/spec/runtime/load_spec.rb +107 -0
  126. data/spec/runtime/platform_spec.rb +90 -0
  127. data/spec/runtime/require_spec.rb +231 -0
  128. data/spec/runtime/setup_spec.rb +730 -0
  129. data/spec/runtime/with_clean_env_spec.rb +15 -0
  130. data/spec/spec_helper.rb +92 -0
  131. data/spec/support/builders.rb +597 -0
  132. data/spec/support/helpers.rb +239 -0
  133. data/spec/support/indexes.rb +112 -0
  134. data/spec/support/matchers.rb +77 -0
  135. data/spec/support/path.rb +71 -0
  136. data/spec/support/platforms.rb +53 -0
  137. data/spec/support/ruby_ext.rb +20 -0
  138. data/spec/support/rubygems_ext.rb +37 -0
  139. data/spec/support/rubygems_hax/platform.rb +11 -0
  140. data/spec/support/sudo.rb +21 -0
  141. data/spec/update/gems_spec.rb +122 -0
  142. data/spec/update/git_spec.rb +196 -0
  143. data/spec/update/source_spec.rb +51 -0
  144. metadata +296 -0
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle lock with git gems" do
4
+ before :each do
5
+ build_git "foo"
6
+
7
+ install_gemfile <<-G
8
+ gem 'foo', :git => "#{lib_path('foo-1.0')}"
9
+ G
10
+ end
11
+
12
+ it "doesn't break right after running lock" do
13
+ should_be_installed "foo 1.0.0"
14
+ end
15
+
16
+ it "locks a git source to the current ref" do
17
+ update_git "foo"
18
+ bundle :install
19
+
20
+ run <<-RUBY
21
+ require 'foo'
22
+ puts "WIN" unless defined?(FOO_PREV_REF)
23
+ RUBY
24
+
25
+ out.should == "WIN"
26
+ end
27
+
28
+ it "provides correct #full_gem_path" do
29
+ run <<-RUBY
30
+ puts Bundler.rubygems.find_name('foo').first.full_gem_path
31
+ RUBY
32
+ out.should == bundle("show foo")
33
+ end
34
+
35
+ end
@@ -0,0 +1,739 @@
1
+ require "spec_helper"
2
+
3
+ describe "the lockfile format" do
4
+ include Bundler::GemHelpers
5
+
6
+ it "generates a simple lockfile for a single source, gem" do
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo1}"
9
+
10
+ gem "rack"
11
+ G
12
+
13
+ lockfile_should_be <<-G
14
+ GEM
15
+ remote: file:#{gem_repo1}/
16
+ specs:
17
+ rack (1.0.0)
18
+
19
+ PLATFORMS
20
+ #{generic(Gem::Platform.local)}
21
+
22
+ DEPENDENCIES
23
+ rack
24
+ G
25
+ end
26
+
27
+ it "generates a simple lockfile for a single source, gem with dependencies" do
28
+ install_gemfile <<-G
29
+ source "file://#{gem_repo1}"
30
+
31
+ gem "rack-obama"
32
+ G
33
+
34
+ lockfile_should_be <<-G
35
+ GEM
36
+ remote: file:#{gem_repo1}/
37
+ specs:
38
+ rack (1.0.0)
39
+ rack-obama (1.0)
40
+ rack
41
+
42
+ PLATFORMS
43
+ #{generic(Gem::Platform.local)}
44
+
45
+ DEPENDENCIES
46
+ rack-obama
47
+ G
48
+ end
49
+
50
+ it "generates a simple lockfile for a single source, gem with a version requirement" do
51
+ install_gemfile <<-G
52
+ source "file://#{gem_repo1}"
53
+
54
+ gem "rack-obama", ">= 1.0"
55
+ G
56
+
57
+ lockfile_should_be <<-G
58
+ GEM
59
+ remote: file:#{gem_repo1}/
60
+ specs:
61
+ rack (1.0.0)
62
+ rack-obama (1.0)
63
+ rack
64
+
65
+ PLATFORMS
66
+ #{generic(Gem::Platform.local)}
67
+
68
+ DEPENDENCIES
69
+ rack-obama (>= 1.0)
70
+ G
71
+ end
72
+
73
+ it "generates lockfiles with multiple requirements" do
74
+ install_gemfile <<-G
75
+ source "file://#{gem_repo1}"
76
+ gem "net-sftp"
77
+ G
78
+
79
+ lockfile_should_be <<-G
80
+ GEM
81
+ remote: file:#{gem_repo1}/
82
+ specs:
83
+ net-sftp (1.1.1)
84
+ net-ssh (>= 1.0.0, < 1.99.0)
85
+ net-ssh (1.0)
86
+
87
+ PLATFORMS
88
+ ruby
89
+
90
+ DEPENDENCIES
91
+ net-sftp
92
+ G
93
+
94
+ should_be_installed "net-sftp 1.1.1", "net-ssh 1.0.0"
95
+ end
96
+
97
+ it "generates a simple lockfile for a single pinned source, gem with a version requirement" do
98
+ git = build_git "foo"
99
+
100
+ install_gemfile <<-G
101
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
102
+ G
103
+
104
+ lockfile_should_be <<-G
105
+ GIT
106
+ remote: #{lib_path("foo-1.0")}
107
+ revision: #{git.ref_for('master')}
108
+ specs:
109
+ foo (1.0)
110
+
111
+ GEM
112
+ specs:
113
+
114
+ PLATFORMS
115
+ #{generic(Gem::Platform.local)}
116
+
117
+ DEPENDENCIES
118
+ foo!
119
+ G
120
+ end
121
+
122
+ it "does not assplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do
123
+ build_lib "omg", :path => lib_path('omg')
124
+
125
+ gemfile <<-G
126
+ source "file://#{gem_repo1}"
127
+
128
+ platforms :#{not_local_tag} do
129
+ gem "omg", :path => "#{lib_path('omg')}"
130
+ end
131
+
132
+ gem "rack"
133
+ G
134
+
135
+ lockfile <<-L
136
+ GIT
137
+ remote: git://github.com/nex3/haml.git
138
+ revision: 8a2271f
139
+ specs:
140
+
141
+ GEM
142
+ remote: file://#{gem_repo1}/
143
+ specs:
144
+ rack (1.0.0)
145
+
146
+ PLATFORMS
147
+ #{not_local}
148
+
149
+ DEPENDENCIES
150
+ omg!
151
+ rack
152
+ L
153
+
154
+ bundle "install"
155
+ should_be_installed "rack 1.0.0"
156
+ end
157
+
158
+ it "serializes global git sources" do
159
+ git = build_git "foo"
160
+
161
+ install_gemfile <<-G
162
+ git "#{lib_path('foo-1.0')}" do
163
+ gem "foo"
164
+ end
165
+ G
166
+
167
+ lockfile_should_be <<-G
168
+ GIT
169
+ remote: #{lib_path('foo-1.0')}
170
+ revision: #{git.ref_for('master')}
171
+ specs:
172
+ foo (1.0)
173
+
174
+ GEM
175
+ specs:
176
+
177
+ PLATFORMS
178
+ #{generic(Gem::Platform.local)}
179
+
180
+ DEPENDENCIES
181
+ foo!
182
+ G
183
+ end
184
+
185
+ it "generates a lockfile with a ref for a single pinned source, git gem with a branch requirement" do
186
+ git = build_git "foo"
187
+ update_git "foo", :branch => "omg"
188
+
189
+ install_gemfile <<-G
190
+ gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
191
+ G
192
+
193
+ lockfile_should_be <<-G
194
+ GIT
195
+ remote: #{lib_path("foo-1.0")}
196
+ revision: #{git.ref_for('omg')}
197
+ branch: omg
198
+ specs:
199
+ foo (1.0)
200
+
201
+ GEM
202
+ specs:
203
+
204
+ PLATFORMS
205
+ #{generic(Gem::Platform.local)}
206
+
207
+ DEPENDENCIES
208
+ foo!
209
+ G
210
+ end
211
+
212
+ it "generates a lockfile with a ref for a single pinned source, git gem with a tag requirement" do
213
+ git = build_git "foo"
214
+ update_git "foo", :tag => "omg"
215
+
216
+ install_gemfile <<-G
217
+ gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg"
218
+ G
219
+
220
+ lockfile_should_be <<-G
221
+ GIT
222
+ remote: #{lib_path("foo-1.0")}
223
+ revision: #{git.ref_for('omg')}
224
+ tag: omg
225
+ specs:
226
+ foo (1.0)
227
+
228
+ GEM
229
+ specs:
230
+
231
+ PLATFORMS
232
+ #{generic(Gem::Platform.local)}
233
+
234
+ DEPENDENCIES
235
+ foo!
236
+ G
237
+ end
238
+
239
+ it "serializes pinned path sources to the lockfile" do
240
+ build_lib "foo"
241
+
242
+ install_gemfile <<-G
243
+ gem "foo", :path => "#{lib_path("foo-1.0")}"
244
+ G
245
+
246
+ lockfile_should_be <<-G
247
+ PATH
248
+ remote: #{lib_path("foo-1.0")}
249
+ specs:
250
+ foo (1.0)
251
+
252
+ GEM
253
+ specs:
254
+
255
+ PLATFORMS
256
+ #{generic(Gem::Platform.local)}
257
+
258
+ DEPENDENCIES
259
+ foo!
260
+ G
261
+ end
262
+
263
+ it "lists gems alphabetically" do
264
+ install_gemfile <<-G
265
+ source "file://#{gem_repo1}"
266
+
267
+ gem "thin"
268
+ gem "actionpack"
269
+ gem "rack-obama"
270
+ G
271
+
272
+ lockfile_should_be <<-G
273
+ GEM
274
+ remote: file:#{gem_repo1}/
275
+ specs:
276
+ actionpack (2.3.2)
277
+ activesupport (= 2.3.2)
278
+ activesupport (2.3.2)
279
+ rack (1.0.0)
280
+ rack-obama (1.0)
281
+ rack
282
+ thin (1.0)
283
+ rack
284
+
285
+ PLATFORMS
286
+ #{generic(Gem::Platform.local)}
287
+
288
+ DEPENDENCIES
289
+ actionpack
290
+ rack-obama
291
+ thin
292
+ G
293
+ end
294
+
295
+ it "order dependencies of dependencies in alphabetical order" do
296
+ install_gemfile <<-G
297
+ source "file://#{gem_repo1}"
298
+
299
+ gem "rails"
300
+ G
301
+
302
+ lockfile_should_be <<-G
303
+ GEM
304
+ remote: file:#{gem_repo1}/
305
+ specs:
306
+ actionmailer (2.3.2)
307
+ activesupport (= 2.3.2)
308
+ actionpack (2.3.2)
309
+ activesupport (= 2.3.2)
310
+ activerecord (2.3.2)
311
+ activesupport (= 2.3.2)
312
+ activeresource (2.3.2)
313
+ activesupport (= 2.3.2)
314
+ activesupport (2.3.2)
315
+ rails (2.3.2)
316
+ actionmailer (= 2.3.2)
317
+ actionpack (= 2.3.2)
318
+ activerecord (= 2.3.2)
319
+ activeresource (= 2.3.2)
320
+ rake (= 0.8.7)
321
+ rake (0.8.7)
322
+
323
+ PLATFORMS
324
+ #{generic(Gem::Platform.local)}
325
+
326
+ DEPENDENCIES
327
+ rails
328
+ G
329
+ end
330
+
331
+ it "orders dependencies according to version" do
332
+ install_gemfile <<-G
333
+ source "file://#{gem_repo1}"
334
+ gem 'double_deps'
335
+ G
336
+
337
+ lockfile_should_be <<-G
338
+ GEM
339
+ remote: file:#{gem_repo1}/
340
+ specs:
341
+ double_deps (1.0)
342
+ net-ssh
343
+ net-ssh (>= 1.0.0)
344
+ net-ssh (1.0)
345
+
346
+ PLATFORMS
347
+ #{generic(Gem::Platform.local)}
348
+
349
+ DEPENDENCIES
350
+ double_deps
351
+ G
352
+ end
353
+
354
+ it "does not add the :require option to the lockfile" do
355
+ install_gemfile <<-G
356
+ source "file://#{gem_repo1}"
357
+
358
+ gem "rack-obama", ">= 1.0", :require => "rack/obama"
359
+ G
360
+
361
+ lockfile_should_be <<-G
362
+ GEM
363
+ remote: file:#{gem_repo1}/
364
+ specs:
365
+ rack (1.0.0)
366
+ rack-obama (1.0)
367
+ rack
368
+
369
+ PLATFORMS
370
+ #{generic(Gem::Platform.local)}
371
+
372
+ DEPENDENCIES
373
+ rack-obama (>= 1.0)
374
+ G
375
+ end
376
+
377
+ it "does not add the :group option to the lockfile" do
378
+ install_gemfile <<-G
379
+ source "file://#{gem_repo1}"
380
+
381
+ gem "rack-obama", ">= 1.0", :group => :test
382
+ G
383
+
384
+ lockfile_should_be <<-G
385
+ GEM
386
+ remote: file:#{gem_repo1}/
387
+ specs:
388
+ rack (1.0.0)
389
+ rack-obama (1.0)
390
+ rack
391
+
392
+ PLATFORMS
393
+ #{generic(Gem::Platform.local)}
394
+
395
+ DEPENDENCIES
396
+ rack-obama (>= 1.0)
397
+ G
398
+ end
399
+
400
+ it "stores relative paths when the path is provided in a relative fashion and in Gemfile dir" do
401
+ build_lib "foo", :path => bundled_app('foo')
402
+
403
+ install_gemfile <<-G
404
+ path "foo"
405
+ gem "foo"
406
+ G
407
+
408
+ lockfile_should_be <<-G
409
+ PATH
410
+ remote: foo
411
+ specs:
412
+ foo (1.0)
413
+
414
+ GEM
415
+ specs:
416
+
417
+ PLATFORMS
418
+ #{generic(Gem::Platform.local)}
419
+
420
+ DEPENDENCIES
421
+ foo
422
+ G
423
+ end
424
+
425
+ it "stores relative paths when the path is provided in a relative fashion and is above Gemfile dir" do
426
+ build_lib "foo", :path => bundled_app(File.join('..', 'foo'))
427
+
428
+ install_gemfile <<-G
429
+ path "../foo"
430
+ gem "foo"
431
+ G
432
+
433
+ lockfile_should_be <<-G
434
+ PATH
435
+ remote: ../foo
436
+ specs:
437
+ foo (1.0)
438
+
439
+ GEM
440
+ specs:
441
+
442
+ PLATFORMS
443
+ #{generic(Gem::Platform.local)}
444
+
445
+ DEPENDENCIES
446
+ foo
447
+ G
448
+ end
449
+
450
+ it "stores relative paths when the path is provided in an absolute fashion but is relative" do
451
+ build_lib "foo", :path => bundled_app('foo')
452
+
453
+ install_gemfile <<-G
454
+ path File.expand_path("../foo", __FILE__)
455
+ gem "foo"
456
+ G
457
+
458
+ lockfile_should_be <<-G
459
+ PATH
460
+ remote: foo
461
+ specs:
462
+ foo (1.0)
463
+
464
+ GEM
465
+ specs:
466
+
467
+ PLATFORMS
468
+ #{generic(Gem::Platform.local)}
469
+
470
+ DEPENDENCIES
471
+ foo
472
+ G
473
+ end
474
+
475
+ it "keeps existing platforms in the lockfile" do
476
+ lockfile <<-G
477
+ GEM
478
+ remote: file:#{gem_repo1}/
479
+ specs:
480
+ rack (1.0.0)
481
+
482
+ PLATFORMS
483
+ java
484
+
485
+ DEPENDENCIES
486
+ rack
487
+ G
488
+
489
+ install_gemfile <<-G
490
+ source "file://#{gem_repo1}"
491
+
492
+ gem "rack"
493
+ G
494
+
495
+ platforms = ['java', generic(Gem::Platform.local).to_s].sort
496
+
497
+ lockfile_should_be <<-G
498
+ GEM
499
+ remote: file:#{gem_repo1}/
500
+ specs:
501
+ rack (1.0.0)
502
+
503
+ PLATFORMS
504
+ #{platforms[0]}
505
+ #{platforms[1]}
506
+
507
+ DEPENDENCIES
508
+ rack
509
+ G
510
+ end
511
+
512
+ it "persists the spec's platform to the lockfile" do
513
+ build_gem "platform_specific", "1.0.0", :to_system => true do |s|
514
+ s.platform = Gem::Platform.new('universal-java-16')
515
+ end
516
+
517
+ simulate_platform "universal-java-16"
518
+
519
+ install_gemfile <<-G
520
+ source "file://#{gem_repo1}"
521
+ gem "platform_specific"
522
+ G
523
+
524
+ lockfile_should_be <<-G
525
+ GEM
526
+ remote: file:#{gem_repo1}/
527
+ specs:
528
+ platform_specific (1.0-java)
529
+
530
+ PLATFORMS
531
+ java
532
+
533
+ DEPENDENCIES
534
+ platform_specific
535
+ G
536
+ end
537
+
538
+ it "does not add duplicate gems" do
539
+ install_gemfile <<-G
540
+ source "file://#{gem_repo1}"
541
+ gem "rack"
542
+ G
543
+
544
+ install_gemfile <<-G
545
+ source "file://#{gem_repo1}"
546
+ gem "rack"
547
+ gem "activesupport"
548
+ G
549
+
550
+ lockfile_should_be <<-G
551
+ GEM
552
+ remote: file:#{gem_repo1}/
553
+ specs:
554
+ activesupport (2.3.5)
555
+ rack (1.0.0)
556
+
557
+ PLATFORMS
558
+ ruby
559
+
560
+ DEPENDENCIES
561
+ activesupport
562
+ rack
563
+ G
564
+ end
565
+
566
+ it "does not add duplicate dependencies" do
567
+ install_gemfile <<-G
568
+ source "file://#{gem_repo1}"
569
+ gem "rack"
570
+ gem "rack"
571
+ G
572
+
573
+ lockfile_should_be <<-G
574
+ GEM
575
+ remote: file:#{gem_repo1}/
576
+ specs:
577
+ rack (1.0.0)
578
+
579
+ PLATFORMS
580
+ ruby
581
+
582
+ DEPENDENCIES
583
+ rack
584
+ G
585
+ end
586
+
587
+ it "does not add duplicate dependencies with versions" do
588
+ install_gemfile <<-G
589
+ source "file://#{gem_repo1}"
590
+ gem "rack", "1.0"
591
+ gem "rack", "1.0"
592
+ G
593
+
594
+ lockfile_should_be <<-G
595
+ GEM
596
+ remote: file:#{gem_repo1}/
597
+ specs:
598
+ rack (1.0.0)
599
+
600
+ PLATFORMS
601
+ ruby
602
+
603
+ DEPENDENCIES
604
+ rack (= 1.0)
605
+ G
606
+ end
607
+
608
+ it "does not add duplicate dependencies in different groups" do
609
+ install_gemfile <<-G
610
+ source "file://#{gem_repo1}"
611
+ gem "rack", "1.0", :group => :one
612
+ gem "rack", "1.0", :group => :two
613
+ G
614
+
615
+ lockfile_should_be <<-G
616
+ GEM
617
+ remote: file:#{gem_repo1}/
618
+ specs:
619
+ rack (1.0.0)
620
+
621
+ PLATFORMS
622
+ ruby
623
+
624
+ DEPENDENCIES
625
+ rack (= 1.0)
626
+ G
627
+ end
628
+
629
+ it "raises if two different versions are used" do
630
+ install_gemfile <<-G
631
+ source "file://#{gem_repo1}"
632
+ gem "rack", "1.0"
633
+ gem "rack", "1.1"
634
+ G
635
+
636
+ bundled_app("Gemfile.lock").should_not exist
637
+ out.should include "rack (= 1.0) and rack (= 1.1)"
638
+ end
639
+
640
+
641
+ it "raises if two different versions are used" do
642
+ install_gemfile <<-G
643
+ source "file://#{gem_repo1}"
644
+ gem "rack"
645
+ gem "rack", :git => "git://hubz.com"
646
+ G
647
+
648
+ bundled_app("Gemfile.lock").should_not exist
649
+ out.should include "rack (>= 0) should come from an unspecfied source and git://hubz.com (at master)"
650
+ end
651
+
652
+ it "works correctly with multiple version dependencies" do
653
+ install_gemfile <<-G
654
+ source "file://#{gem_repo1}"
655
+ gem "rack", "> 0.9", "< 1.0"
656
+ G
657
+
658
+ lockfile_should_be <<-G
659
+ GEM
660
+ remote: file:#{gem_repo1}/
661
+ specs:
662
+ rack (0.9.1)
663
+
664
+ PLATFORMS
665
+ ruby
666
+
667
+ DEPENDENCIES
668
+ rack (> 0.9, < 1.0)
669
+ G
670
+
671
+ end
672
+
673
+ describe "line endings" do
674
+ def set_lockfile_mtime_to_known_value
675
+ time = Time.local(2000, 1, 1, 0, 0, 0)
676
+ File.utime(time, time, bundled_app('Gemfile.lock'))
677
+ end
678
+ before(:each) do
679
+ build_repo2
680
+ install_gemfile <<-G
681
+ source "file://#{gem_repo2}"
682
+ gem "rack"
683
+ G
684
+ set_lockfile_mtime_to_known_value
685
+ end
686
+
687
+ it "generates Gemfile.lock with \\n line endings" do
688
+ File.read(bundled_app("Gemfile.lock")).should_not match("\r\n")
689
+ should_be_installed "rack 1.0"
690
+ end
691
+
692
+ context "during updates" do
693
+
694
+ it "preserves Gemfile.lock \\n line endings" do
695
+ update_repo2
696
+
697
+ lambda { bundle "update" }.should change { File.mtime(bundled_app('Gemfile.lock')) }
698
+ File.read(bundled_app("Gemfile.lock")).should_not match("\r\n")
699
+ should_be_installed "rack 1.2"
700
+ end
701
+
702
+ it "preserves Gemfile.lock \\n\\r line endings" do
703
+ update_repo2
704
+ win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
705
+ File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
706
+ set_lockfile_mtime_to_known_value
707
+
708
+ lambda { bundle "update" }.should change { File.mtime(bundled_app('Gemfile.lock')) }
709
+ File.read(bundled_app("Gemfile.lock")).should match("\r\n")
710
+ should_be_installed "rack 1.2"
711
+ end
712
+ end
713
+
714
+ context "when nothing changes" do
715
+
716
+ it "preserves Gemfile.lock \\n line endings" do
717
+ lambda { ruby <<-RUBY
718
+ require 'rubygems'
719
+ require 'bundler'
720
+ Bundler.setup
721
+ RUBY
722
+ }.should_not change { File.mtime(bundled_app('Gemfile.lock')) }
723
+ end
724
+
725
+ it "preserves Gemfile.lock \\n\\r line endings" do
726
+ win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
727
+ File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
728
+ set_lockfile_mtime_to_known_value
729
+
730
+ lambda { ruby <<-RUBY
731
+ require 'rubygems'
732
+ require 'bundler'
733
+ Bundler.setup
734
+ RUBY
735
+ }.should_not change { File.mtime(bundled_app('Gemfile.lock')) }
736
+ end
737
+ end
738
+ end
739
+ end