bundler 1.0.0 → 1.0.2

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 (108) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGELOG.md +28 -6
  3. data/ISSUES.md +1 -1
  4. data/README.md +7 -5
  5. data/Rakefile +173 -0
  6. data/UPGRADING.md +103 -0
  7. data/bundler.gemspec +28 -0
  8. data/lib/bundler.rb +1 -0
  9. data/lib/bundler/capistrano.rb +2 -31
  10. data/lib/bundler/cli.rb +18 -16
  11. data/lib/bundler/deployment.rb +37 -0
  12. data/lib/bundler/dsl.rb +3 -3
  13. data/lib/bundler/gem_helper.rb +4 -7
  14. data/lib/bundler/graph.rb +3 -3
  15. data/lib/bundler/installer.rb +1 -0
  16. data/lib/bundler/lockfile_parser.rb +1 -1
  17. data/lib/bundler/man/bundle +1 -1
  18. data/lib/bundler/man/bundle-config +92 -0
  19. data/lib/bundler/man/bundle-config.txt +72 -30
  20. data/lib/bundler/man/bundle-exec +1 -1
  21. data/lib/bundler/man/bundle-exec.txt +1 -1
  22. data/lib/bundler/man/bundle-install +1 -1
  23. data/lib/bundler/man/bundle-install.txt +1 -1
  24. data/lib/bundler/man/bundle-package +1 -1
  25. data/lib/bundler/man/bundle-package.txt +1 -1
  26. data/lib/bundler/man/bundle-update +1 -1
  27. data/lib/bundler/man/bundle-update.txt +1 -1
  28. data/lib/bundler/man/bundle.txt +1 -1
  29. data/lib/bundler/man/gemfile.5 +2 -2
  30. data/lib/bundler/man/gemfile.5.txt +2 -2
  31. data/lib/bundler/settings.rb +2 -2
  32. data/lib/bundler/source.rb +2 -3
  33. data/lib/bundler/templates/Executable +1 -1
  34. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  35. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  36. data/lib/bundler/templates/newgem/newgem.gemspec.tt +11 -12
  37. data/lib/bundler/version.rb +1 -1
  38. data/lib/bundler/vlad.rb +9 -0
  39. data/man/bundle-config.ronn +90 -0
  40. data/man/bundle-exec.ronn +98 -0
  41. data/man/bundle-install.ronn +310 -0
  42. data/man/bundle-package.ronn +59 -0
  43. data/man/bundle-update.ronn +176 -0
  44. data/man/bundle.ronn +77 -0
  45. data/man/gemfile.5.ronn +254 -0
  46. data/man/index.txt +6 -0
  47. data/spec/cache/gems_spec.rb +205 -0
  48. data/spec/cache/git_spec.rb +9 -0
  49. data/spec/cache/path_spec.rb +27 -0
  50. data/spec/cache/platform_spec.rb +57 -0
  51. data/spec/install/deploy_spec.rb +171 -0
  52. data/spec/install/deprecated_spec.rb +43 -0
  53. data/spec/install/gems/c_ext_spec.rb +48 -0
  54. data/spec/install/gems/env_spec.rb +107 -0
  55. data/spec/install/gems/flex_spec.rb +272 -0
  56. data/spec/install/gems/groups_spec.rb +209 -0
  57. data/spec/install/gems/locked_spec.rb +48 -0
  58. data/spec/install/gems/packed_spec.rb +72 -0
  59. data/spec/install/gems/platform_spec.rb +181 -0
  60. data/spec/install/gems/resolving_spec.rb +72 -0
  61. data/spec/install/gems/simple_case_spec.rb +709 -0
  62. data/spec/install/gems/sudo_spec.rb +77 -0
  63. data/spec/install/gems/win32_spec.rb +26 -0
  64. data/spec/install/gemspec_spec.rb +96 -0
  65. data/spec/install/git_spec.rb +552 -0
  66. data/spec/install/invalid_spec.rb +17 -0
  67. data/spec/install/path_spec.rb +335 -0
  68. data/spec/install/upgrade_spec.rb +26 -0
  69. data/spec/lock/flex_spec.rb +625 -0
  70. data/spec/lock/git_spec.rb +35 -0
  71. data/spec/other/check_spec.rb +221 -0
  72. data/spec/other/config_spec.rb +40 -0
  73. data/spec/other/console_spec.rb +102 -0
  74. data/spec/other/exec_spec.rb +241 -0
  75. data/spec/other/ext_spec.rb +16 -0
  76. data/spec/other/gem_helper_spec.rb +116 -0
  77. data/spec/other/help_spec.rb +36 -0
  78. data/spec/other/init_spec.rb +40 -0
  79. data/spec/other/newgem_spec.rb +24 -0
  80. data/spec/other/open_spec.rb +51 -0
  81. data/spec/other/show_spec.rb +99 -0
  82. data/spec/pack/gems_spec.rb +22 -0
  83. data/spec/quality_spec.rb +55 -0
  84. data/spec/resolver/basic_spec.rb +20 -0
  85. data/spec/resolver/platform_spec.rb +57 -0
  86. data/spec/runtime/environment_rb_spec.rb +170 -0
  87. data/spec/runtime/executable_spec.rb +110 -0
  88. data/spec/runtime/load_spec.rb +107 -0
  89. data/spec/runtime/platform_spec.rb +90 -0
  90. data/spec/runtime/require_spec.rb +261 -0
  91. data/spec/runtime/setup_spec.rb +412 -0
  92. data/spec/runtime/with_clean_env_spec.rb +15 -0
  93. data/spec/spec_helper.rb +81 -0
  94. data/spec/support/builders.rb +566 -0
  95. data/spec/support/helpers.rb +243 -0
  96. data/spec/support/indexes.rb +113 -0
  97. data/spec/support/matchers.rb +89 -0
  98. data/spec/support/path.rb +71 -0
  99. data/spec/support/platforms.rb +49 -0
  100. data/spec/support/ruby_ext.rb +19 -0
  101. data/spec/support/rubygems_ext.rb +30 -0
  102. data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
  103. data/spec/support/sudo.rb +21 -0
  104. data/spec/update/gems_spec.rb +86 -0
  105. data/spec/update/git_spec.rb +159 -0
  106. data/spec/update/source_spec.rb +50 -0
  107. metadata +170 -32
  108. data/ROADMAP.md +0 -36
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with deprecated features" do
4
+ before :each do
5
+ in_app_root
6
+ end
7
+
8
+ it "reports that lib is an invalid option" do
9
+ gemfile <<-G
10
+ gem "rack", :lib => "rack"
11
+ G
12
+
13
+ bundle :install
14
+ out.should =~ /You passed :lib as an option for gem 'rack', but it is invalid/
15
+ end
16
+
17
+ end
@@ -0,0 +1,335 @@
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 "installs dependencies from the path even if a newer gem is available elsewhere" do
50
+ system_gems "rack-1.0.0"
51
+
52
+ build_lib "rack", "1.0", :path => lib_path('nested/bar') do |s|
53
+ s.write "lib/rack.rb", "puts 'WIN OVERRIDE'"
54
+ end
55
+
56
+ build_lib "foo", :path => lib_path('nested') do |s|
57
+ s.add_dependency "rack", "= 1.0"
58
+ end
59
+
60
+ install_gemfile <<-G
61
+ source "file://#{gem_repo1}"
62
+ gem "foo", :path => "#{lib_path('nested')}"
63
+ G
64
+
65
+ run "require 'rack'"
66
+ out.should == 'WIN OVERRIDE'
67
+ end
68
+
69
+ it "works" do
70
+ build_gem "foo", "1.0.0", :to_system => true do |s|
71
+ s.write "lib/foo.rb", "puts 'FAIL'"
72
+ end
73
+
74
+ build_lib "omg", "1.0", :path => lib_path("omg") do |s|
75
+ s.add_dependency "foo"
76
+ end
77
+
78
+ build_lib "foo", "1.0.0", :path => lib_path("omg/foo")
79
+
80
+ install_gemfile <<-G
81
+ gem "omg", :path => "#{lib_path('omg')}"
82
+ G
83
+
84
+ should_be_installed "foo 1.0"
85
+ end
86
+
87
+ it "supports gemspec syntax" do
88
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
89
+ s.add_dependency "rack", "1.0"
90
+ end
91
+
92
+ gemfile = <<-G
93
+ source "file://#{gem_repo1}"
94
+ gemspec
95
+ G
96
+
97
+ File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts gemfile }
98
+
99
+ Dir.chdir(lib_path("foo")) do
100
+ bundle "install"
101
+ should_be_installed "foo 1.0"
102
+ should_be_installed "rack 1.0"
103
+ end
104
+ end
105
+
106
+ it "supports gemspec syntax with an alternative path" do
107
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
108
+ s.add_dependency "rack", "1.0"
109
+ end
110
+
111
+ install_gemfile <<-G
112
+ source "file://#{gem_repo1}"
113
+ gemspec :path => "#{lib_path("foo")}"
114
+ G
115
+
116
+ should_be_installed "foo 1.0"
117
+ should_be_installed "rack 1.0"
118
+ end
119
+
120
+ it "raises if there are multiple gemspecs" do
121
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
122
+ s.write "bar.gemspec"
123
+ end
124
+
125
+ install_gemfile <<-G, :exit_status => true
126
+ gemspec :path => "#{lib_path("foo")}"
127
+ G
128
+
129
+ @exitstatus.should == 15
130
+ out.should =~ /There are multiple gemspecs/
131
+ end
132
+
133
+ it "allows :name to be specified to resolve ambiguity" do
134
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
135
+ s.write "bar.gemspec"
136
+ end
137
+
138
+ install_gemfile <<-G, :exit_status => true
139
+ gemspec :path => "#{lib_path("foo")}", :name => "foo"
140
+ G
141
+
142
+ should_be_installed "foo 1.0"
143
+ end
144
+
145
+ it "sets up executables" do
146
+ pending_jruby_shebang_fix
147
+
148
+ build_lib "foo" do |s|
149
+ s.executables = "foobar"
150
+ end
151
+
152
+ install_gemfile <<-G
153
+ path "#{lib_path('foo-1.0')}"
154
+ gem 'foo'
155
+ G
156
+
157
+ bundle "exec foobar"
158
+ out.should == "1.0"
159
+ end
160
+
161
+ it "removes the .gem file after installing" do
162
+ build_lib "foo"
163
+
164
+ install_gemfile <<-G
165
+ gem 'foo', :path => "#{lib_path('foo-1.0')}"
166
+ G
167
+
168
+ lib_path('foo-1.0').join('foo-1.0.gem').should_not exist
169
+ end
170
+
171
+ describe "block syntax" do
172
+ it "pulls all gems from a path block" do
173
+ build_lib "omg"
174
+ build_lib "hi2u"
175
+
176
+ install_gemfile <<-G
177
+ path "#{lib_path}" do
178
+ gem "omg"
179
+ gem "hi2u"
180
+ end
181
+ G
182
+
183
+ should_be_installed "omg 1.0", "hi2u 1.0"
184
+ end
185
+ end
186
+
187
+ describe "when locked" do
188
+ it "keeps source pinning" do
189
+ build_lib "foo", "1.0", :path => lib_path('foo')
190
+ build_lib "omg", "1.0", :path => lib_path('omg')
191
+ build_lib "foo", "1.0", :path => lib_path('omg/foo') do |s|
192
+ s.write "lib/foo.rb", "puts 'FAIL'"
193
+ end
194
+
195
+ install_gemfile <<-G
196
+ gem "foo", :path => "#{lib_path('foo')}"
197
+ gem "omg", :path => "#{lib_path('omg')}"
198
+ G
199
+
200
+ bundle :lock
201
+
202
+ should_be_installed "foo 1.0"
203
+ end
204
+
205
+ it "works when the path does not have a gemspec" do
206
+ build_lib "foo", :gemspec => false
207
+
208
+ gemfile <<-G
209
+ gem "foo", "1.0", :path => "#{lib_path('foo-1.0')}"
210
+ G
211
+
212
+ should_be_installed "foo 1.0"
213
+
214
+ bundle :lock
215
+
216
+ should_be_installed "foo 1.0"
217
+ end
218
+ end
219
+
220
+ it "installs executable stubs" do
221
+ build_lib "foo" do |s|
222
+ s.executables = ['foo']
223
+ end
224
+
225
+ install_gemfile <<-G
226
+ gem "foo", :path => "#{lib_path('foo-1.0')}"
227
+ G
228
+
229
+ bundle "exec foo"
230
+ out.should == "1.0"
231
+ end
232
+
233
+ describe "when the gem version in the path is updated" do
234
+ before :each do
235
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
236
+ s.add_dependency "bar"
237
+ end
238
+ build_lib "bar", "1.0", :path => lib_path("foo/bar")
239
+
240
+ install_gemfile <<-G
241
+ gem "foo", :path => "#{lib_path('foo')}"
242
+ G
243
+ end
244
+
245
+ it "unlocks all gems when the top level gem is updated" do
246
+ build_lib "foo", "2.0", :path => lib_path("foo") do |s|
247
+ s.add_dependency "bar"
248
+ end
249
+
250
+ bundle "install"
251
+
252
+ should_be_installed "foo 2.0", "bar 1.0"
253
+ end
254
+
255
+ it "unlocks all gems when a child dependency gem is updated" do
256
+ build_lib "bar", "2.0", :path => lib_path("foo/bar")
257
+
258
+ bundle "install"
259
+
260
+ should_be_installed "foo 1.0", "bar 2.0"
261
+ end
262
+ end
263
+
264
+ describe "when dependencies in the path are updated" do
265
+ before :each do
266
+ build_lib "foo", "1.0", :path => lib_path("foo")
267
+
268
+ install_gemfile <<-G
269
+ source "file://#{gem_repo1}"
270
+ gem "foo", :path => "#{lib_path('foo')}"
271
+ G
272
+ end
273
+
274
+ it "gets dependencies that are updated in the path" do
275
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
276
+ s.add_dependency "rack"
277
+ end
278
+
279
+ bundle "install"
280
+
281
+ should_be_installed "rack 1.0.0"
282
+ end
283
+ end
284
+
285
+ describe "switching sources" do
286
+ it "doesn't switch pinned git sources to rubygems when pinning the parent gem to a path source" do
287
+ build_gem "foo", "1.0", :to_system => true do |s|
288
+ s.write "lib/foo.rb", "raise 'fail'"
289
+ end
290
+ build_lib "foo", "1.0", :path => lib_path('bar/foo')
291
+ build_git "bar", "1.0", :path => lib_path('bar') do |s|
292
+ s.add_dependency 'foo'
293
+ end
294
+
295
+ install_gemfile <<-G
296
+ source "http://#{gem_repo1}"
297
+ gem "bar", :git => "#{lib_path('bar')}"
298
+ G
299
+
300
+ install_gemfile <<-G
301
+ source "http://#{gem_repo1}"
302
+ gem "bar", :path => "#{lib_path('bar')}"
303
+ G
304
+
305
+ should_be_installed "foo 1.0", "bar 1.0"
306
+ end
307
+
308
+ it "switches the source when the gem existed in rubygems and the path was already being used for another gem" do
309
+ build_lib "foo", "1.0", :path => lib_path("foo")
310
+ build_gem "bar", "1.0", :to_system => true do |s|
311
+ s.write "lib/bar.rb", "raise 'fail'"
312
+ end
313
+
314
+ install_gemfile <<-G
315
+ source "http://#{gem_repo1}"
316
+ gem "bar"
317
+ path "#{lib_path('foo')}" do
318
+ gem "foo"
319
+ end
320
+ G
321
+
322
+ build_lib "bar", "1.0", :path => lib_path("foo/bar")
323
+
324
+ install_gemfile <<-G
325
+ source "http://#{gem_repo1}"
326
+ path "#{lib_path('foo')}" do
327
+ gem "foo"
328
+ gem "bar"
329
+ end
330
+ G
331
+
332
+ should_be_installed "bar 1.0"
333
+ end
334
+ end
335
+ end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install for the first time with v1.0" do
4
+ before :each do
5
+ in_app_root
6
+
7
+ gemfile <<-G
8
+ source "file://#{gem_repo1}"
9
+ gem "rack"
10
+ G
11
+ end
12
+
13
+ it "removes lockfiles in 0.9 YAML format" do
14
+ File.open("Gemfile.lock", "w"){|f| YAML.dump({}, f) }
15
+ bundle :install
16
+ File.read("Gemfile.lock").should_not =~ /^---/
17
+ end
18
+
19
+ it "removes env.rb if it exists" do
20
+ bundled_app.join(".bundle").mkdir
21
+ bundled_app.join(".bundle/environment.rb").open("w"){|f| f.write("raise 'nooo'") }
22
+ bundle :install
23
+ bundled_app.join(".bundle/environment.rb").should_not exist
24
+ end
25
+
26
+ end
@@ -0,0 +1,625 @@
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 "parses lockfiles w/ crazy shit" do
74
+ install_gemfile <<-G
75
+ source "file://#{gem_repo1}"
76
+
77
+ gem "net-sftp"
78
+ G
79
+
80
+ lockfile_should_be <<-G
81
+ GEM
82
+ remote: file:#{gem_repo1}/
83
+ specs:
84
+ net-sftp (1.1.1)
85
+ net-ssh (>= 1.0.0, < 1.99.0)
86
+ net-ssh (1.0)
87
+
88
+ PLATFORMS
89
+ ruby
90
+
91
+ DEPENDENCIES
92
+ net-sftp
93
+ G
94
+
95
+ should_be_installed "net-sftp 1.1.1", "net-ssh 1.0.0"
96
+ end
97
+
98
+ it "generates a simple lockfile for a single pinned source, gem with a version requirement" do
99
+ git = build_git "foo"
100
+
101
+ install_gemfile <<-G
102
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
103
+ G
104
+
105
+ lockfile_should_be <<-G
106
+ GIT
107
+ remote: #{lib_path("foo-1.0")}
108
+ revision: #{git.ref_for('master')}
109
+ specs:
110
+ foo (1.0)
111
+
112
+ GEM
113
+ specs:
114
+
115
+ PLATFORMS
116
+ #{generic(Gem::Platform.local)}
117
+
118
+ DEPENDENCIES
119
+ foo!
120
+ G
121
+ end
122
+
123
+ it "does not assplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do
124
+ build_lib "omg", :path => lib_path('omg')
125
+
126
+ gemfile <<-G
127
+ source "file://#{gem_repo1}"
128
+
129
+ platforms :#{not_local_tag} do
130
+ gem "omg", :path => "#{lib_path('omg')}"
131
+ end
132
+
133
+ gem "rack"
134
+ G
135
+
136
+ lockfile <<-L
137
+ GIT
138
+ remote: git://github.com/nex3/haml.git
139
+ revision: 8a2271f
140
+ specs:
141
+
142
+ GEM
143
+ remote: file://#{gem_repo1}/
144
+ specs:
145
+ rack (1.0.0)
146
+
147
+ PLATFORMS
148
+ #{not_local}
149
+
150
+ DEPENDENCIES
151
+ omg!
152
+ rack
153
+ L
154
+
155
+ bundle "install"
156
+ should_be_installed "rack 1.0.0"
157
+ end
158
+
159
+ it "serializes global git sources" do
160
+ git = build_git "foo"
161
+
162
+ install_gemfile <<-G
163
+ git "#{lib_path('foo-1.0')}" do
164
+ gem "foo"
165
+ end
166
+ G
167
+
168
+ lockfile_should_be <<-G
169
+ GIT
170
+ remote: #{lib_path('foo-1.0')}
171
+ revision: #{git.ref_for('master')}
172
+ specs:
173
+ foo (1.0)
174
+
175
+ GEM
176
+ specs:
177
+
178
+ PLATFORMS
179
+ #{generic(Gem::Platform.local)}
180
+
181
+ DEPENDENCIES
182
+ foo!
183
+ G
184
+ end
185
+
186
+ it "generates a lockfile with a ref for a single pinned source, git gem with a branch requirement" do
187
+ git = build_git "foo"
188
+ update_git "foo", :branch => "omg"
189
+
190
+ install_gemfile <<-G
191
+ gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
192
+ G
193
+
194
+ lockfile_should_be <<-G
195
+ GIT
196
+ remote: #{lib_path("foo-1.0")}
197
+ revision: #{git.ref_for('omg')}
198
+ branch: omg
199
+ specs:
200
+ foo (1.0)
201
+
202
+ GEM
203
+ specs:
204
+
205
+ PLATFORMS
206
+ #{generic(Gem::Platform.local)}
207
+
208
+ DEPENDENCIES
209
+ foo!
210
+ G
211
+ end
212
+
213
+ it "generates a lockfile with a ref for a single pinned source, git gem with a tag requirement" do
214
+ git = build_git "foo"
215
+ update_git "foo", :tag => "omg"
216
+
217
+ install_gemfile <<-G
218
+ gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg"
219
+ G
220
+
221
+ lockfile_should_be <<-G
222
+ GIT
223
+ remote: #{lib_path("foo-1.0")}
224
+ revision: #{git.ref_for('omg')}
225
+ tag: omg
226
+ specs:
227
+ foo (1.0)
228
+
229
+ GEM
230
+ specs:
231
+
232
+ PLATFORMS
233
+ #{generic(Gem::Platform.local)}
234
+
235
+ DEPENDENCIES
236
+ foo!
237
+ G
238
+ end
239
+
240
+ it "serializes pinned path sources to the lockfile" do
241
+ build_lib "foo"
242
+
243
+ install_gemfile <<-G
244
+ gem "foo", :path => "#{lib_path("foo-1.0")}"
245
+ G
246
+
247
+ lockfile_should_be <<-G
248
+ PATH
249
+ remote: #{lib_path("foo-1.0")}
250
+ specs:
251
+ foo (1.0)
252
+
253
+ GEM
254
+ specs:
255
+
256
+ PLATFORMS
257
+ #{generic(Gem::Platform.local)}
258
+
259
+ DEPENDENCIES
260
+ foo!
261
+ G
262
+ end
263
+
264
+ it "lists gems alphabetically" do
265
+ install_gemfile <<-G
266
+ source "file://#{gem_repo1}"
267
+
268
+ gem "thin"
269
+ gem "actionpack"
270
+ gem "rack-obama"
271
+ G
272
+
273
+ lockfile_should_be <<-G
274
+ GEM
275
+ remote: file:#{gem_repo1}/
276
+ specs:
277
+ actionpack (2.3.2)
278
+ activesupport (= 2.3.2)
279
+ activesupport (2.3.2)
280
+ rack (1.0.0)
281
+ rack-obama (1.0)
282
+ rack
283
+ thin (1.0)
284
+ rack
285
+
286
+ PLATFORMS
287
+ #{generic(Gem::Platform.local)}
288
+
289
+ DEPENDENCIES
290
+ actionpack
291
+ rack-obama
292
+ thin
293
+ G
294
+ end
295
+
296
+ it "order dependencies of dependencies in alphabetical order" do
297
+ install_gemfile <<-G
298
+ source "file://#{gem_repo1}"
299
+
300
+ gem "rails"
301
+ G
302
+
303
+ lockfile_should_be <<-G
304
+ GEM
305
+ remote: file:#{gem_repo1}/
306
+ specs:
307
+ actionmailer (2.3.2)
308
+ activesupport (= 2.3.2)
309
+ actionpack (2.3.2)
310
+ activesupport (= 2.3.2)
311
+ activerecord (2.3.2)
312
+ activesupport (= 2.3.2)
313
+ activeresource (2.3.2)
314
+ activesupport (= 2.3.2)
315
+ activesupport (2.3.2)
316
+ rails (2.3.2)
317
+ actionmailer (= 2.3.2)
318
+ actionpack (= 2.3.2)
319
+ activerecord (= 2.3.2)
320
+ activeresource (= 2.3.2)
321
+ rake
322
+ rake (0.8.7)
323
+
324
+ PLATFORMS
325
+ #{generic(Gem::Platform.local)}
326
+
327
+ DEPENDENCIES
328
+ rails
329
+ G
330
+ end
331
+
332
+ it "does not add the :require option to the lockfile" do
333
+ install_gemfile <<-G
334
+ source "file://#{gem_repo1}"
335
+
336
+ gem "rack-obama", ">= 1.0", :require => "rack/obama"
337
+ G
338
+
339
+ lockfile_should_be <<-G
340
+ GEM
341
+ remote: file:#{gem_repo1}/
342
+ specs:
343
+ rack (1.0.0)
344
+ rack-obama (1.0)
345
+ rack
346
+
347
+ PLATFORMS
348
+ #{generic(Gem::Platform.local)}
349
+
350
+ DEPENDENCIES
351
+ rack-obama (>= 1.0)
352
+ G
353
+ end
354
+
355
+ it "does not add the :group option to the lockfile" do
356
+ install_gemfile <<-G
357
+ source "file://#{gem_repo1}"
358
+
359
+ gem "rack-obama", ">= 1.0", :group => :test
360
+ G
361
+
362
+ lockfile_should_be <<-G
363
+ GEM
364
+ remote: file:#{gem_repo1}/
365
+ specs:
366
+ rack (1.0.0)
367
+ rack-obama (1.0)
368
+ rack
369
+
370
+ PLATFORMS
371
+ #{generic(Gem::Platform.local)}
372
+
373
+ DEPENDENCIES
374
+ rack-obama (>= 1.0)
375
+ G
376
+ end
377
+
378
+ it "stores relative paths when the path is provided in a relative fashion" do
379
+ build_lib "foo", :path => bundled_app('foo')
380
+
381
+ install_gemfile <<-G
382
+ path "foo"
383
+ gem "foo"
384
+ G
385
+
386
+ lockfile_should_be <<-G
387
+ PATH
388
+ remote: foo
389
+ specs:
390
+ foo (1.0)
391
+
392
+ GEM
393
+ specs:
394
+
395
+ PLATFORMS
396
+ #{generic(Gem::Platform.local)}
397
+
398
+ DEPENDENCIES
399
+ foo
400
+ G
401
+ end
402
+
403
+ it "stores relative paths when the path is provided in an absolute fashion but is relative" do
404
+ build_lib "foo", :path => bundled_app('foo')
405
+
406
+ install_gemfile <<-G
407
+ path File.expand_path("../foo", __FILE__)
408
+ gem "foo"
409
+ G
410
+
411
+ lockfile_should_be <<-G
412
+ PATH
413
+ remote: foo
414
+ specs:
415
+ foo (1.0)
416
+
417
+ GEM
418
+ specs:
419
+
420
+ PLATFORMS
421
+ #{generic(Gem::Platform.local)}
422
+
423
+ DEPENDENCIES
424
+ foo
425
+ G
426
+ end
427
+
428
+ it "keeps existing platforms in the lockfile" do
429
+ lockfile <<-G
430
+ GEM
431
+ remote: file:#{gem_repo1}/
432
+ specs:
433
+ rack (1.0.0)
434
+
435
+ PLATFORMS
436
+ java
437
+
438
+ DEPENDENCIES
439
+ rack
440
+ G
441
+
442
+ install_gemfile <<-G
443
+ source "file://#{gem_repo1}"
444
+
445
+ gem "rack"
446
+ G
447
+
448
+ platforms = ['java', generic(Gem::Platform.local).to_s].sort
449
+
450
+ lockfile_should_be <<-G
451
+ GEM
452
+ remote: file:#{gem_repo1}/
453
+ specs:
454
+ rack (1.0.0)
455
+
456
+ PLATFORMS
457
+ #{platforms[0]}
458
+ #{platforms[1]}
459
+
460
+ DEPENDENCIES
461
+ rack
462
+ G
463
+ end
464
+
465
+ it "persists the spec's platform to the lockfile" do
466
+ build_gem "platform_specific", "1.0.0", :to_system => true do |s|
467
+ s.platform = Gem::Platform.new('universal-java-16')
468
+ end
469
+
470
+ simulate_platform "universal-java-16"
471
+
472
+ install_gemfile <<-G
473
+ source "file://#{gem_repo1}"
474
+ gem "platform_specific"
475
+ G
476
+
477
+ lockfile_should_be <<-G
478
+ GEM
479
+ remote: file:#{gem_repo1}/
480
+ specs:
481
+ platform_specific (1.0-java)
482
+
483
+ PLATFORMS
484
+ java
485
+
486
+ DEPENDENCIES
487
+ platform_specific
488
+ G
489
+ end
490
+
491
+ it "does not add duplicate gems" do
492
+ install_gemfile <<-G
493
+ source "file://#{gem_repo1}"
494
+ gem "rack"
495
+ G
496
+
497
+ install_gemfile <<-G
498
+ source "file://#{gem_repo1}"
499
+ gem "rack"
500
+ gem "activesupport"
501
+ G
502
+
503
+ lockfile_should_be <<-G
504
+ GEM
505
+ remote: file:#{gem_repo1}/
506
+ specs:
507
+ activesupport (2.3.5)
508
+ rack (1.0.0)
509
+
510
+ PLATFORMS
511
+ ruby
512
+
513
+ DEPENDENCIES
514
+ activesupport
515
+ rack
516
+ G
517
+ end
518
+
519
+ it "does not add duplicate dependencies" do
520
+ install_gemfile <<-G
521
+ source "file://#{gem_repo1}"
522
+ gem "rack"
523
+ gem "rack"
524
+ G
525
+
526
+ lockfile_should_be <<-G
527
+ GEM
528
+ remote: file:#{gem_repo1}/
529
+ specs:
530
+ rack (1.0.0)
531
+
532
+ PLATFORMS
533
+ ruby
534
+
535
+ DEPENDENCIES
536
+ rack
537
+ G
538
+ end
539
+
540
+ it "does not add duplicate dependencies with versions" do
541
+ install_gemfile <<-G
542
+ source "file://#{gem_repo1}"
543
+ gem "rack", "1.0"
544
+ gem "rack", "1.0"
545
+ G
546
+
547
+ lockfile_should_be <<-G
548
+ GEM
549
+ remote: file:#{gem_repo1}/
550
+ specs:
551
+ rack (1.0.0)
552
+
553
+ PLATFORMS
554
+ ruby
555
+
556
+ DEPENDENCIES
557
+ rack (= 1.0)
558
+ G
559
+ end
560
+
561
+ it "does not add duplicate dependencies in different groups" do
562
+ install_gemfile <<-G
563
+ source "file://#{gem_repo1}"
564
+ gem "rack", "1.0", :group => :one
565
+ gem "rack", "1.0", :group => :two
566
+ G
567
+
568
+ lockfile_should_be <<-G
569
+ GEM
570
+ remote: file:#{gem_repo1}/
571
+ specs:
572
+ rack (1.0.0)
573
+
574
+ PLATFORMS
575
+ ruby
576
+
577
+ DEPENDENCIES
578
+ rack (= 1.0)
579
+ G
580
+ end
581
+
582
+ it "raises if two different versions are used" do
583
+ install_gemfile <<-G
584
+ source "file://#{gem_repo1}"
585
+ gem "rack", "1.0"
586
+ gem "rack", "1.1"
587
+ G
588
+
589
+ bundled_app("Gemfile.lock").should_not exist
590
+ out.should include "rack (= 1.0) and rack (= 1.1)"
591
+ end
592
+
593
+
594
+ it "raises if two different versions are used" do
595
+ install_gemfile <<-G
596
+ source "file://#{gem_repo1}"
597
+ gem "rack"
598
+ gem "rack", :git => "git://hubz.com"
599
+ G
600
+
601
+ bundled_app("Gemfile.lock").should_not exist
602
+ out.should include "rack (>= 0) should come from an unspecfied source and git://hubz.com (at master)"
603
+ end
604
+
605
+ it "works correctly with multiple version dependencies" do
606
+ install_gemfile <<-G
607
+ source "file://#{gem_repo1}"
608
+ gem "rack", "> 0.9", "< 1.0"
609
+ G
610
+
611
+ lockfile_should_be <<-G
612
+ GEM
613
+ remote: file:#{gem_repo1}/
614
+ specs:
615
+ rack (0.9.1)
616
+
617
+ PLATFORMS
618
+ ruby
619
+
620
+ DEPENDENCIES
621
+ rack (> 0.9, < 1.0)
622
+ G
623
+
624
+ end
625
+ end