bundler 1.0.22 → 1.1.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 (114) hide show
  1. data/CHANGELOG.md +15 -181
  2. data/ISSUES.md +11 -26
  3. data/LICENSE +0 -2
  4. data/Rakefile +67 -116
  5. data/UPGRADING.md +4 -4
  6. data/bin/bundle +10 -10
  7. data/bundler.gemspec +5 -5
  8. data/lib/bundler.rb +15 -25
  9. data/lib/bundler/capistrano.rb +2 -2
  10. data/lib/bundler/cli.rb +41 -72
  11. data/lib/bundler/definition.rb +11 -37
  12. data/lib/bundler/dependency.rb +9 -13
  13. data/lib/bundler/deployment.rb +3 -8
  14. data/lib/bundler/dsl.rb +10 -24
  15. data/lib/bundler/fetcher.rb +101 -0
  16. data/lib/bundler/gem_helper.rb +6 -11
  17. data/lib/bundler/index.rb +8 -15
  18. data/lib/bundler/installer.rb +55 -35
  19. data/lib/bundler/lazy_specification.rb +7 -10
  20. data/lib/bundler/remote_specification.rb +6 -8
  21. data/lib/bundler/resolver.rb +18 -12
  22. data/lib/bundler/rubygems_ext.rb +3 -20
  23. data/lib/bundler/runtime.rb +57 -8
  24. data/lib/bundler/settings.rb +6 -4
  25. data/lib/bundler/setup.rb +5 -12
  26. data/lib/bundler/shared_helpers.rb +100 -4
  27. data/lib/bundler/source.rb +61 -106
  28. data/lib/bundler/spec_set.rb +8 -9
  29. data/lib/bundler/templates/newgem/Rakefile.tt +2 -1
  30. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +0 -2
  31. data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -6
  32. data/lib/bundler/ui.rb +1 -4
  33. data/lib/bundler/vendor/net/http/faster.rb +27 -0
  34. data/lib/bundler/vendor/net/http/persistent.rb +464 -0
  35. data/lib/bundler/vendor/thor.rb +4 -43
  36. data/lib/bundler/vendor/thor/actions.rb +11 -28
  37. data/lib/bundler/vendor/thor/actions/create_file.rb +2 -2
  38. data/lib/bundler/vendor/thor/actions/directory.rb +2 -2
  39. data/lib/bundler/vendor/thor/actions/empty_directory.rb +0 -0
  40. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +15 -56
  41. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +10 -15
  42. data/lib/bundler/vendor/thor/base.rb +4 -24
  43. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +0 -0
  44. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +0 -0
  45. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +0 -0
  46. data/lib/bundler/vendor/thor/error.rb +0 -0
  47. data/lib/bundler/vendor/thor/invocation.rb +0 -0
  48. data/lib/bundler/vendor/thor/parser.rb +0 -0
  49. data/lib/bundler/vendor/thor/parser/argument.rb +0 -0
  50. data/lib/bundler/vendor/thor/parser/arguments.rb +2 -2
  51. data/lib/bundler/vendor/thor/parser/option.rb +1 -1
  52. data/lib/bundler/vendor/thor/parser/options.rb +16 -17
  53. data/lib/bundler/vendor/thor/shell.rb +0 -0
  54. data/lib/bundler/vendor/thor/shell/basic.rb +13 -40
  55. data/lib/bundler/vendor/thor/shell/color.rb +0 -0
  56. data/lib/bundler/vendor/thor/task.rb +4 -3
  57. data/lib/bundler/vendor/thor/util.rb +2 -2
  58. data/lib/bundler/vendor/thor/version.rb +1 -1
  59. data/lib/bundler/version.rb +1 -1
  60. data/lib/bundler/vlad.rb +0 -2
  61. data/man/bundle-install.ronn +3 -6
  62. data/man/gemfile.5.ronn +2 -7
  63. data/spec/cache/gems_spec.rb +0 -11
  64. data/spec/cache/git_spec.rb +2 -5
  65. data/spec/install/deploy_spec.rb +8 -8
  66. data/spec/install/gems/dependency_api_spec.rb +85 -0
  67. data/spec/install/gems/flex_spec.rb +4 -4
  68. data/spec/install/gems/groups_spec.rb +3 -17
  69. data/spec/install/gems/platform_spec.rb +16 -0
  70. data/spec/install/gems/simple_case_spec.rb +24 -88
  71. data/spec/install/gems/standalone_spec.rb +162 -0
  72. data/spec/install/gems/sudo_spec.rb +2 -3
  73. data/spec/install/gemspec_spec.rb +0 -38
  74. data/spec/install/git_spec.rb +4 -3
  75. data/spec/install/invalid_spec.rb +0 -18
  76. data/spec/install/path_spec.rb +1 -53
  77. data/spec/lock/git_spec.rb +1 -1
  78. data/spec/lock/lockfile_spec.rb +16 -72
  79. data/spec/other/check_spec.rb +6 -6
  80. data/spec/other/clean_spec.rb +202 -0
  81. data/spec/other/exec_spec.rb +7 -14
  82. data/spec/other/ext_spec.rb +0 -21
  83. data/spec/{bundler → other}/gem_helper_spec.rb +1 -16
  84. data/spec/other/help_spec.rb +1 -2
  85. data/spec/other/init_spec.rb +3 -3
  86. data/spec/other/newgem_spec.rb +1 -23
  87. data/spec/pack/gems_spec.rb +22 -0
  88. data/spec/quality_spec.rb +2 -6
  89. data/spec/runtime/require_spec.rb +10 -10
  90. data/spec/runtime/setup_spec.rb +12 -54
  91. data/spec/spec_helper.rb +7 -14
  92. data/spec/support/artifice/endpoint.rb +50 -0
  93. data/spec/support/artifice/endpoint_fallback.rb +22 -0
  94. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  95. data/spec/support/artifice/endpoint_redirect.rb +11 -0
  96. data/spec/support/builders.rb +2 -25
  97. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  98. data/spec/support/fakeweb/windows.rb +23 -0
  99. data/spec/support/helpers.rb +12 -5
  100. data/spec/support/matchers.rb +16 -4
  101. data/spec/support/path.rb +2 -0
  102. data/spec/support/rubygems_ext.rb +2 -6
  103. data/spec/update/gems_spec.rb +2 -3
  104. data/spec/update/git_spec.rb +2 -2
  105. metadata +41 -24
  106. data/.travis.yml +0 -31
  107. data/lib/bundler/gem_installer.rb +0 -9
  108. data/lib/bundler/gem_tasks.rb +0 -2
  109. data/lib/bundler/rubygems_integration.rb +0 -344
  110. data/lib/bundler/vendor/thor/actions/create_link.rb +0 -57
  111. data/lib/bundler/vendor/thor/group.rb +0 -273
  112. data/lib/bundler/vendor/thor/rake_compat.rb +0 -66
  113. data/lib/bundler/vendor/thor/runner.rb +0 -309
  114. data/lib/bundler/vendored_thor.rb +0 -7
@@ -10,11 +10,10 @@ describe "when using sudo", :sudo => true do
10
10
  install_gemfile <<-G
11
11
  source "file://#{gem_repo1}"
12
12
  gem "rack", '1.0'
13
- gem "thin"
14
13
  G
15
14
 
16
15
  system_gem_path("gems/rack-1.0.0").should exist
17
- system_gem_path("gems/rack-1.0.0").stat.uid.should eq(0)
16
+ check system_gem_path("gems/rack-1.0.0").stat.uid.should == 0
18
17
  should_be_installed "rack 1.0"
19
18
  end
20
19
 
@@ -30,7 +29,7 @@ describe "when using sudo", :sudo => true do
30
29
  G
31
30
 
32
31
  bundle_path.join("gems/rack-1.0.0").should exist
33
- bundle_path.join("gems/rack-1.0.0").stat.uid.should eq(0)
32
+ check bundle_path.join("gems/rack-1.0.0").stat.uid.should == 0
34
33
  should_be_installed "rack 1.0"
35
34
  end
36
35
 
@@ -22,23 +22,6 @@ describe "bundle install from an existing gemspec" do
22
22
  should_be_installed "bar-dev 1.0.0", :groups => :development
23
23
  end
24
24
 
25
- it "that is hidden should install runtime and development dependencies" do
26
- build_lib("foo", :path => tmp.join("foo")) do |s|
27
- s.write("Gemfile", "source :rubygems\ngemspec")
28
- s.add_dependency "bar", "=1.0.0"
29
- s.add_development_dependency "bar-dev", '=1.0.0'
30
- end
31
- FileUtils.mv tmp.join('foo', 'foo.gemspec'), tmp.join('foo', '.gemspec')
32
-
33
- install_gemfile <<-G
34
- source "file://#{gem_repo2}"
35
- gemspec :path => '#{tmp.join("foo")}'
36
- G
37
-
38
- should_be_installed "bar 1.0.0"
39
- should_be_installed "bar-dev 1.0.0", :groups => :development
40
- end
41
-
42
25
  it "should handle a list of requirements" do
43
26
  build_gem "baz", "1.0", :to_system => true
44
27
  build_gem "baz", "1.1", :to_system => true
@@ -110,27 +93,6 @@ describe "bundle install from an existing gemspec" do
110
93
  should_be_installed "bar-dev 1.0.0", :groups => :dev
111
94
  end
112
95
 
113
- it "should match a lockfile even if the gemspec defines development dependencies" do
114
- build_lib("foo", :path => tmp.join("foo")) do |s|
115
- s.write("Gemfile", "source 'file://#{gem_repo1}'\ngemspec")
116
- s.add_dependency "actionpack", "=2.3.2"
117
- s.add_development_dependency "rake", '=0.8.7'
118
- end
119
-
120
- Dir.chdir(tmp.join("foo")) do
121
- bundle "install"
122
- # This should really be able to rely on $stderr, but, it's not written
123
- # right, so we can't. In fact, this is a bug negation test, and so it'll
124
- # ghost pass in future, and will only catch a regression if the message
125
- # doesn't change. Exit codes should be used correctly (they can be more
126
- # than just 0 and 1).
127
- output = bundle("install --deployment")
128
- output.should_not match(/You have added to the Gemfile/)
129
- output.should_not match(/You have deleted from the Gemfile/)
130
- output.should_not match(/install in deployment mode after changing/)
131
- end
132
- end
133
-
134
96
  it "should evaluate the gemspec in its directory" do
135
97
  build_lib("foo", :path => tmp.join("foo"))
136
98
  File.open(tmp.join("foo/foo.gemspec"), "w") do |s|
@@ -145,7 +145,7 @@ describe "bundle install with git sources" do
145
145
  gem "foo"
146
146
  end
147
147
  G
148
- err.should eq("")
148
+ check err.should == ""
149
149
 
150
150
  run <<-RUBY
151
151
  require 'foo'
@@ -348,9 +348,10 @@ describe "bundle install with git sources" do
348
348
 
349
349
  bundle :install, :expect_err => true
350
350
 
351
- out.should include("Git error:")
351
+ out.should include("An error has occurred in git")
352
352
  err.should include("fatal")
353
353
  err.should include("omgomg")
354
+ err.should include("fatal: The remote end hung up unexpectedly")
354
355
  end
355
356
 
356
357
  it "works when the gem path has spaces in it" do
@@ -403,7 +404,7 @@ describe "bundle install with git sources" do
403
404
  gem "has_submodule"
404
405
  end
405
406
  G
406
- out.should =~ /could not find gem 'submodule/i
407
+ out.should =~ /Could not find gem 'submodule'/
407
408
 
408
409
  should_not_be_installed "has_submodule 1.0", :expect_err => true
409
410
  end
@@ -15,21 +15,3 @@ describe "bundle install with deprecated features" do
15
15
  end
16
16
 
17
17
  end
18
-
19
- describe "bundle install to a dead symlink" do
20
- before do
21
- in_app_root do
22
- `ln -s /tmp/idontexist bundle`
23
- end
24
- end
25
-
26
- it "reports the symlink is dead" do
27
- gemfile <<-G
28
- source "file://#{gem_repo1}"
29
- gem "rack"
30
- G
31
-
32
- bundle "install --path bundle"
33
- out.should =~ /invalid symlink/
34
- end
35
- end
@@ -141,47 +141,6 @@ describe "bundle install with explicit source paths" do
141
141
  should_be_installed "rack 1.0"
142
142
  end
143
143
 
144
- it "doesn't automatically unlock dependencies when using the gemspec syntax" do
145
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
146
- s.add_dependency "rack", ">= 1.0"
147
- end
148
-
149
- Dir.chdir lib_path("foo")
150
-
151
- install_gemfile lib_path("foo/Gemfile"), <<-G
152
- source "file://#{gem_repo1}"
153
- gemspec
154
- G
155
-
156
- build_gem "rack", "1.0.1", :to_system => true
157
-
158
- bundle "install"
159
-
160
- should_be_installed "foo 1.0"
161
- should_be_installed "rack 1.0"
162
- end
163
-
164
- it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do
165
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
166
- s.add_dependency "rack", ">= 1.0"
167
- s.add_development_dependency "activesupport"
168
- end
169
-
170
- Dir.chdir lib_path("foo")
171
-
172
- install_gemfile lib_path("foo/Gemfile"), <<-G
173
- source "file://#{gem_repo1}"
174
- gemspec
175
- G
176
-
177
- build_gem "rack", "1.0.1", :to_system => true
178
-
179
- bundle "install"
180
-
181
- should_be_installed "foo 1.0"
182
- should_be_installed "rack 1.0"
183
- end
184
-
185
144
  it "raises if there are multiple gemspecs" do
186
145
  build_lib "foo", "1.0", :path => lib_path("foo") do |s|
187
146
  s.write "bar.gemspec"
@@ -191,7 +150,7 @@ describe "bundle install with explicit source paths" do
191
150
  gemspec :path => "#{lib_path("foo")}"
192
151
  G
193
152
 
194
- exitstatus.should eq(15)
153
+ check exitstatus.should == 15
195
154
  out.should =~ /There are multiple gemspecs/
196
155
  end
197
156
 
@@ -223,17 +182,6 @@ describe "bundle install with explicit source paths" do
223
182
  out.should == "1.0"
224
183
  end
225
184
 
226
- it "handles directories in bin/" do
227
- build_lib "foo"
228
- lib_path("foo-1.0").join("foo.gemspec").rmtree
229
- lib_path("foo-1.0").join("bin/performance").mkpath
230
-
231
- install_gemfile <<-G
232
- gem 'foo', '1.0', :path => "#{lib_path('foo-1.0')}"
233
- G
234
- err.should == ""
235
- end
236
-
237
185
  it "removes the .gem file after installing" do
238
186
  build_lib "foo"
239
187
 
@@ -27,7 +27,7 @@ describe "bundle lock with git gems" do
27
27
 
28
28
  it "provides correct #full_gem_path" do
29
29
  run <<-RUBY
30
- puts Bundler.rubygems.find_name('foo').first.full_gem_path
30
+ puts Gem.source_index.find_name('foo').first.full_gem_path
31
31
  RUBY
32
32
  out.should == bundle("show foo")
33
33
  end
@@ -70,9 +70,10 @@ describe "the lockfile format" do
70
70
  G
71
71
  end
72
72
 
73
- it "generates lockfiles with multiple requirements" do
73
+ it "parses lockfiles w/ crazy shit" do
74
74
  install_gemfile <<-G
75
75
  source "file://#{gem_repo1}"
76
+
76
77
  gem "net-sftp"
77
78
  G
78
79
 
@@ -317,7 +318,7 @@ describe "the lockfile format" do
317
318
  actionpack (= 2.3.2)
318
319
  activerecord (= 2.3.2)
319
320
  activeresource (= 2.3.2)
320
- rake (= 0.8.7)
321
+ rake
321
322
  rake (0.8.7)
322
323
 
323
324
  PLATFORMS
@@ -328,29 +329,6 @@ describe "the lockfile format" do
328
329
  G
329
330
  end
330
331
 
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
332
  it "does not add the :require option to the lockfile" do
355
333
  install_gemfile <<-G
356
334
  source "file://#{gem_repo1}"
@@ -670,18 +648,13 @@ describe "the lockfile format" do
670
648
 
671
649
  end
672
650
 
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
651
+ context "line endings" do
678
652
  before(:each) do
679
653
  build_repo2
680
654
  install_gemfile <<-G
681
655
  source "file://#{gem_repo2}"
682
656
  gem "rack"
683
657
  G
684
- set_lockfile_mtime_to_known_value
685
658
  end
686
659
 
687
660
  it "generates Gemfile.lock with \\n line endings" do
@@ -689,51 +662,22 @@ describe "the lockfile format" do
689
662
  should_be_installed "rack 1.0"
690
663
  end
691
664
 
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
665
+ it "preserves Gemfile.lock \\n line endings" do
666
+ update_repo2
707
667
 
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
668
+ bundle "update"
669
+ File.read(bundled_app("Gemfile.lock")).should_not match("\r\n")
670
+ should_be_installed "rack 1.2"
712
671
  end
713
672
 
714
- context "when nothing changes" do
673
+ it "preserves Gemfile.lock \\n\\r line endings" do
674
+ update_repo2
675
+ win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
676
+ File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) }
715
677
 
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
678
+ bundle "update"
679
+ File.read(bundled_app("Gemfile.lock")).should match("\r\n")
680
+ should_be_installed "rack 1.2"
737
681
  end
738
682
  end
739
683
  end
@@ -8,7 +8,7 @@ describe "bundle check" do
8
8
  G
9
9
 
10
10
  bundle :check, :exitstatus => true
11
- @exitstatus.should eq(0)
11
+ check @exitstatus.should == 0
12
12
  out.should == "The Gemfile's dependencies are satisfied"
13
13
  end
14
14
 
@@ -55,7 +55,7 @@ describe "bundle check" do
55
55
  G
56
56
 
57
57
  bundle :check, :exitstatus => true
58
- @exitstatus.should be > 0
58
+ check @exitstatus.should > 0
59
59
  out.should include("could not be satisfied")
60
60
  end
61
61
 
@@ -89,7 +89,7 @@ describe "bundle check" do
89
89
 
90
90
  bundle "install --without foo"
91
91
  bundle "check", :exitstatus => true
92
- @exitstatus.should eq(0)
92
+ check @exitstatus.should == 0
93
93
  out.should include("The Gemfile's dependencies are satisfied")
94
94
  end
95
95
 
@@ -175,7 +175,7 @@ describe "bundle check" do
175
175
 
176
176
  it "outputs an error when the default Gemfile is not found" do
177
177
  bundle :check, :exitstatus => true
178
- @exitstatus.should eq(10)
178
+ check @exitstatus.should == 10
179
179
  out.should include("Could not locate Gemfile")
180
180
  end
181
181
 
@@ -190,7 +190,7 @@ describe "bundle check" do
190
190
  last_out = out
191
191
  3.times do |i|
192
192
  bundle :check
193
- out.should eq(last_out)
193
+ check out.should == last_out
194
194
  err.should be_empty
195
195
  end
196
196
  end
@@ -207,7 +207,7 @@ describe "bundle check" do
207
207
  it "returns success when the Gemfile is satisfied" do
208
208
  bundle :install
209
209
  bundle :check, :exitstatus => true
210
- @exitstatus.should eq(0)
210
+ check @exitstatus.should == 0
211
211
  out.should == "The Gemfile's dependencies are satisfied"
212
212
  end
213
213
 
@@ -0,0 +1,202 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle clean" do
4
+ it "removes unused gems that are different" do
5
+ gemfile = <<-G
6
+ source "file://#{gem_repo1}"
7
+
8
+ gem "thin"
9
+ gem "foo"
10
+ G
11
+
12
+ install_gemfile(gemfile, :path => "vendor/bundle")
13
+
14
+ install_gemfile <<-G
15
+ source "file://#{gem_repo1}"
16
+
17
+ gem "thin"
18
+ G
19
+
20
+ bundle :clean
21
+
22
+ out.should == "Removing foo (1.0)"
23
+
24
+ vendored_gems("gems/thin-1.0").should exist
25
+ vendored_gems("gems/rack-1.0.0").should exist
26
+ vendored_gems("gems/foo-1.0").should_not exist
27
+
28
+ vendored_gems("specifications/thin-1.0.gemspec").should exist
29
+ vendored_gems("specifications/rack-1.0.0.gemspec").should exist
30
+ vendored_gems("specifications/foo-1.0.gemspec").should_not exist
31
+
32
+ vendored_gems("bin/rackup").should exist
33
+ end
34
+
35
+ it "removes old version of gem if unused" do
36
+ gemfile = <<-G
37
+ source "file://#{gem_repo1}"
38
+
39
+ gem "rack", "0.9.1"
40
+ gem "foo"
41
+ G
42
+
43
+ install_gemfile(gemfile, :path => "vendor/bundle")
44
+
45
+ install_gemfile <<-G
46
+ source "file://#{gem_repo1}"
47
+
48
+ gem "rack", "1.0.0"
49
+ gem "foo"
50
+ G
51
+
52
+ bundle :clean
53
+
54
+ out.should == "Removing rack (0.9.1)"
55
+
56
+ vendored_gems("gems/foo-1.0").should exist
57
+ vendored_gems("gems/rack-1.0.0").should exist
58
+ vendored_gems("gems/rack-0.9.1").should_not exist
59
+
60
+ vendored_gems("specifications/foo-1.0.gemspec").should exist
61
+ vendored_gems("specifications/rack-1.0.0.gemspec").should exist
62
+ vendored_gems("specifications/rack-0.9.1.gemspec").should_not exist
63
+
64
+ vendored_gems("bin/rackup").should exist
65
+ end
66
+
67
+ it "removes new version of gem if unused" do
68
+ gemfile = <<-G
69
+ source "file://#{gem_repo1}"
70
+
71
+ gem "rack", "1.0.0"
72
+ gem "foo"
73
+ G
74
+
75
+ install_gemfile(gemfile, :path => "vendor/bundle")
76
+
77
+ install_gemfile <<-G
78
+ source "file://#{gem_repo1}"
79
+
80
+ gem "rack", "0.9.1"
81
+ gem "foo"
82
+ G
83
+
84
+ bundle :clean
85
+
86
+ out.should == "Removing rack (1.0.0)"
87
+
88
+ vendored_gems("gems/foo-1.0").should exist
89
+ vendored_gems("gems/rack-0.9.1").should exist
90
+ vendored_gems("gems/rack-1.0.0").should_not exist
91
+
92
+ vendored_gems("specifications/foo-1.0.gemspec").should exist
93
+ vendored_gems("specifications/rack-0.9.1.gemspec").should exist
94
+ vendored_gems("specifications/rack-1.0.0.gemspec").should_not exist
95
+
96
+ vendored_gems("bin/rackup").should exist
97
+ end
98
+
99
+ it "remove gems in bundle without groups" do
100
+ gemfile = <<-G
101
+ source "file://#{gem_repo1}"
102
+
103
+ gem "foo"
104
+
105
+ group :test_group do
106
+ gem "rack", "1.0.0"
107
+ end
108
+ G
109
+
110
+ install_gemfile(gemfile, :path => "vendor/bundle")
111
+ bundle "install --without test_group"
112
+ bundle :clean
113
+
114
+ out.should == "Removing rack (1.0.0)"
115
+
116
+ vendored_gems("gems/foo-1.0").should exist
117
+ vendored_gems("gems/rack-1.0.0").should_not exist
118
+
119
+ vendored_gems("specifications/foo-1.0.gemspec").should exist
120
+ vendored_gems("specifications/rack-1.0.0.gemspec").should_not exist
121
+
122
+ vendored_gems("bin/rackup").should_not exist
123
+ end
124
+
125
+ it "removes unused git gems" do
126
+ build_git "foo"
127
+ @revision = revision_for(lib_path("foo-1.0"))
128
+
129
+ gemfile = <<-G
130
+ source "file://#{gem_repo1}"
131
+
132
+ gem "rack", "1.0.0"
133
+ git "#{lib_path('foo-1.0')}", :ref => "#{@revision}" do
134
+ gem "foo"
135
+ end
136
+ G
137
+
138
+ install_gemfile(gemfile, :path => "vendor/bundle")
139
+
140
+ install_gemfile <<-G
141
+ source "file://#{gem_repo1}"
142
+
143
+ gem "rack", "1.0.0"
144
+ G
145
+
146
+ bundle :clean
147
+
148
+ out.should == "Removing foo (1.0 #{@revision[0..11]})"
149
+
150
+ vendored_gems("gems/rack-1.0.0").should exist
151
+ vendored_gems("bundler/gems/foo-1.0-#{@revision[0..11]}").should_not exist
152
+
153
+ vendored_gems("specifications/rack-1.0.0.gemspec").should exist
154
+
155
+ vendored_gems("bin/rackup").should exist
156
+ end
157
+
158
+ it "removes old git gems" do
159
+ build_git "foo"
160
+ revision = revision_for(lib_path("foo-1.0"))
161
+
162
+ gemfile = <<-G
163
+ source "file://#{gem_repo1}"
164
+
165
+ gem "rack", "1.0.0"
166
+ git "#{lib_path('foo-1.0')}" do
167
+ gem "foo"
168
+ end
169
+ G
170
+
171
+ install_gemfile(gemfile, :path => "vendor/bundle")
172
+
173
+ update_git "foo"
174
+ revision2 = revision_for(lib_path("foo-1.0"))
175
+
176
+ bundle :update
177
+ bundle :install
178
+ bundle :clean
179
+
180
+ out.should == "Removing foo (1.0 #{revision[0..11]})"
181
+
182
+ vendored_gems("gems/rack-1.0.0").should exist
183
+ vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
184
+ vendored_gems("bundler/gems/foo-1.0-#{revision2[0..11]}").should exist
185
+
186
+ vendored_gems("specifications/rack-1.0.0.gemspec").should exist
187
+
188
+ vendored_gems("bin/rackup").should exist
189
+ end
190
+
191
+ it "displays an error when used without --path" do
192
+ install_gemfile <<-G
193
+ source "file://#{gem_repo1}"
194
+
195
+ gem "rack", "1.0.0"
196
+ G
197
+
198
+ bundle :clean
199
+
200
+ out.should == "Can only use bundle clean when --path is set"
201
+ end
202
+ end