blob: 2b5f27c29dda15b8a5a55f7814e6611cda390c35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
require "spec_helper"
describe "bundle clean" do
it "removes unused gems that are different" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "thin"
gem "foo"
G
bundle "install --path vendor"
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "thin"
G
bundle :install
bundle :clean
out.should == "Removing foo (1.0)"
vendored_gems("gems/thin-1.0").should exist
vendored_gems("gems/rack-1.0.0").should exist
vendored_gems("gems/foo-1.0").should_not exist
vendored_gems("specifications/thin-1.0.gemspec").should exist
vendored_gems("specifications/rack-1.0.0.gemspec").should exist
vendored_gems("specifications/foo-1.0.gemspec").should_not exist
vendored_gems("bin/rackup").should exist
end
it "removes old version of gem if unused" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "0.9.1"
gem "foo"
G
bundle "install --path vendor"
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
gem "foo"
G
bundle :install
bundle :clean
out.should == "Removing rack (0.9.1)"
vendored_gems("gems/foo-1.0").should exist
vendored_gems("gems/rack-1.0.0").should exist
vendored_gems("gems/rack-0.9.1").should_not exist
vendored_gems("specifications/foo-1.0.gemspec").should exist
vendored_gems("specifications/rack-1.0.0.gemspec").should exist
vendored_gems("specifications/rack-0.9.1.gemspec").should_not exist
vendored_gems("bin/rackup").should exist
end
it "removes new version of gem if unused" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
gem "foo"
G
bundle "install --path vendor"
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "0.9.1"
gem "foo"
G
bundle :install
bundle :clean
out.should == "Removing rack (1.0.0)"
vendored_gems("gems/foo-1.0").should exist
vendored_gems("gems/rack-0.9.1").should exist
vendored_gems("gems/rack-1.0.0").should_not exist
vendored_gems("specifications/foo-1.0.gemspec").should exist
vendored_gems("specifications/rack-0.9.1.gemspec").should exist
vendored_gems("specifications/rack-1.0.0.gemspec").should_not exist
vendored_gems("bin/rackup").should exist
end
it "remove gems in bundle without groups" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "foo"
group :test_group do
gem "rack", "1.0.0"
end
G
bundle "install --path vendor"
bundle "install --without test_group"
bundle :clean
out.should == "Removing rack (1.0.0)"
vendored_gems("gems/foo-1.0").should exist
vendored_gems("gems/rack-1.0.0").should_not exist
vendored_gems("specifications/foo-1.0.gemspec").should exist
vendored_gems("specifications/rack-1.0.0.gemspec").should_not exist
vendored_gems("bin/rackup").should_not exist
end
it "removes unused git gems" do
build_git "foo"
@revision = revision_for(lib_path("foo-1.0"))
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
git "#{lib_path('foo-1.0')}", :ref => "#{@revision}" do
gem "foo"
end
G
bundle "install --path vendor"
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
G
bundle :install
bundle :clean
out.should == "Removing foo (1.0 #{@revision[0..11]})"
vendored_gems("gems/rack-1.0.0").should exist
vendored_gems("bundler/gems/foo-1.0-#{@revision[0..11]}").should_not exist
vendored_gems("specifications/rack-1.0.0.gemspec").should exist
vendored_gems("bin/rackup").should exist
end
it "removes old git gems" do
build_git "foo"
revision = revision_for(lib_path("foo-1.0"))
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
git "#{lib_path('foo-1.0')}" do
gem "foo"
end
G
bundle "install --path vendor"
update_git "foo"
revision2 = revision_for(lib_path("foo-1.0"))
bundle :update
bundle :install
bundle :clean
out.should == "Removing foo (1.0 #{revision[0..11]})"
vendored_gems("gems/rack-1.0.0").should exist
vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
vendored_gems("bundler/gems/foo-1.0-#{revision2[0..11]}").should exist
vendored_gems("specifications/rack-1.0.0.gemspec").should exist
vendored_gems("bin/rackup").should exist
end
end
|