rkh-bundler 1.2.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.travis.yml +42 -0
- data/CHANGELOG.md +1105 -0
- data/ISSUES.md +67 -0
- data/LICENSE +23 -0
- data/README.md +31 -0
- data/Rakefile +208 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +31 -0
- data/bundler.gemspec +31 -0
- data/lib/bundler.rb +353 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +693 -0
- data/lib/bundler/definition.rb +568 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +134 -0
- data/lib/bundler/deployment.rb +58 -0
- data/lib/bundler/dsl.rb +256 -0
- data/lib/bundler/endpoint_specification.rb +78 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/fetcher.rb +225 -0
- data/lib/bundler/gem_helper.rb +162 -0
- data/lib/bundler/gem_helpers.rb +23 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +148 -0
- data/lib/bundler/index.rb +187 -0
- data/lib/bundler/installer.rb +190 -0
- data/lib/bundler/lazy_specification.rb +79 -0
- data/lib/bundler/lockfile_parser.rb +127 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/psyched_yaml.rb +15 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +486 -0
- data/lib/bundler/ruby_version.rb +94 -0
- data/lib/bundler/rubygems_ext.rb +153 -0
- data/lib/bundler/rubygems_integration.rb +394 -0
- data/lib/bundler/runtime.rb +233 -0
- data/lib/bundler/settings.rb +128 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +71 -0
- data/lib/bundler/source.rb +869 -0
- data/lib/bundler/spec_set.rb +137 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +29 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +17 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -0
- data/lib/bundler/ui.rb +88 -0
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +468 -0
- data/lib/bundler/vendor/thor.rb +358 -0
- data/lib/bundler/vendor/thor/actions.rb +314 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
- data/lib/bundler/vendor/thor/base.rb +576 -0
- data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
- data/lib/bundler/vendor/thor/error.rb +30 -0
- data/lib/bundler/vendor/thor/group.rb +273 -0
- data/lib/bundler/vendor/thor/invocation.rb +168 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
- data/lib/bundler/vendor/thor/parser/option.rb +120 -0
- data/lib/bundler/vendor/thor/parser/options.rb +172 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
- data/lib/bundler/vendor/thor/runner.rb +309 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
- data/lib/bundler/vendor/thor/shell/color.rb +108 -0
- data/lib/bundler/vendor/thor/shell/html.rb +121 -0
- data/lib/bundler/vendor/thor/task.rb +113 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_thor.rb +7 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +130 -0
- data/man/bundle-exec.ronn +111 -0
- data/man/bundle-install.ronn +335 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +83 -0
- data/man/gemfile.5.ronn +324 -0
- data/man/index.txt +6 -0
- data/spec/bundler/dsl_spec.rb +48 -0
- data/spec/bundler/gem_helper_spec.rb +174 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +239 -0
- data/spec/cache/git_spec.rb +124 -0
- data/spec/cache/path_spec.rb +103 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +211 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +402 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +313 -0
- data/spec/install/gems/groups_spec.rb +268 -0
- data/spec/install/gems/packed_spec.rb +84 -0
- data/spec/install/gems/platform_spec.rb +208 -0
- data/spec/install/gems/post_install_spec.rb +47 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +814 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +74 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +170 -0
- data/spec/install/git_spec.rb +796 -0
- data/spec/install/invalid_spec.rb +35 -0
- data/spec/install/path_spec.rb +405 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/lock/lockfile_spec.rb +809 -0
- data/spec/other/check_spec.rb +265 -0
- data/spec/other/clean_spec.rb +492 -0
- data/spec/other/config_spec.rb +138 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +229 -0
- data/spec/other/ext_spec.rb +37 -0
- data/spec/other/help_spec.rb +39 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +87 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/outdated_spec.rb +93 -0
- data/spec/other/platform_spec.rb +881 -0
- data/spec/other/show_spec.rb +88 -0
- data/spec/quality_spec.rb +62 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +82 -0
- data/spec/runtime/executable_spec.rb +120 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +261 -0
- data/spec/runtime/setup_spec.rb +755 -0
- data/spec/runtime/with_clean_env_spec.rb +80 -0
- data/spec/spec_helper.rb +98 -0
- 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 +604 -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 +317 -0
- data/spec/support/indexes.rb +112 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +73 -0
- data/spec/support/platforms.rb +86 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +37 -0
- data/spec/support/rubygems_hax/platform.rb +22 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +134 -0
- data/spec/update/git_spec.rb +196 -0
- data/spec/update/source_spec.rb +51 -0
- metadata +338 -0
@@ -0,0 +1,265 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle check" do
|
4
|
+
it "returns success when the Gemfile is satisfied" do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rails"
|
8
|
+
G
|
9
|
+
|
10
|
+
bundle :check, :exitstatus => true
|
11
|
+
@exitstatus.should eq(0)
|
12
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "works with the --gemfile flag when not in the directory" do
|
16
|
+
install_gemfile <<-G
|
17
|
+
source "file://#{gem_repo1}"
|
18
|
+
gem "rails"
|
19
|
+
G
|
20
|
+
|
21
|
+
Dir.chdir tmp
|
22
|
+
bundle "check --gemfile bundled_app/Gemfile"
|
23
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "creates a Gemfile.lock if one did not exist" do
|
27
|
+
install_gemfile <<-G
|
28
|
+
source "file://#{gem_repo1}"
|
29
|
+
gem "rails"
|
30
|
+
G
|
31
|
+
|
32
|
+
FileUtils.rm("Gemfile.lock")
|
33
|
+
|
34
|
+
bundle "check"
|
35
|
+
|
36
|
+
bundled_app("Gemfile.lock").should exist
|
37
|
+
end
|
38
|
+
|
39
|
+
it "prints a generic error if the missing gems are unresolvable" do
|
40
|
+
system_gems ["rails-2.3.2"]
|
41
|
+
|
42
|
+
gemfile <<-G
|
43
|
+
source "file://#{gem_repo1}"
|
44
|
+
gem "rails"
|
45
|
+
G
|
46
|
+
|
47
|
+
bundle :check
|
48
|
+
out.should include("Your Gemfile's dependencies could not be satisfied")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "prints a generic error if a Gemfile.lock does not exist and a toplevel dependency does not exist" do
|
52
|
+
gemfile <<-G
|
53
|
+
source "file://#{gem_repo1}"
|
54
|
+
gem "rails"
|
55
|
+
G
|
56
|
+
|
57
|
+
bundle :check, :exitstatus => true
|
58
|
+
@exitstatus.should be > 0
|
59
|
+
out.should include("could not be satisfied")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "prints a generic message if you changed your lockfile" do
|
63
|
+
install_gemfile <<-G
|
64
|
+
source "file://#{gem_repo1}"
|
65
|
+
gem 'rails'
|
66
|
+
G
|
67
|
+
install_gemfile <<-G
|
68
|
+
source "file://#{gem_repo1}"
|
69
|
+
gem 'rails_fail'
|
70
|
+
G
|
71
|
+
|
72
|
+
gemfile <<-G
|
73
|
+
source "file://#{gem_repo1}"
|
74
|
+
gem "rails"
|
75
|
+
gem "rails_fail"
|
76
|
+
G
|
77
|
+
|
78
|
+
bundle :check
|
79
|
+
out.should include("Your Gemfile's dependencies could not be satisfied")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "remembers --without option from install" do
|
83
|
+
gemfile <<-G
|
84
|
+
source "file://#{gem_repo1}"
|
85
|
+
group :foo do
|
86
|
+
gem "rack"
|
87
|
+
end
|
88
|
+
G
|
89
|
+
|
90
|
+
bundle "install --without foo"
|
91
|
+
bundle "check", :exitstatus => true
|
92
|
+
@exitstatus.should eq(0)
|
93
|
+
out.should include("The Gemfile's dependencies are satisfied")
|
94
|
+
end
|
95
|
+
|
96
|
+
it "ensures that gems are actually installed and not just cached" do
|
97
|
+
gemfile <<-G
|
98
|
+
source "file://#{gem_repo1}"
|
99
|
+
gem "rack", :group => :foo
|
100
|
+
G
|
101
|
+
|
102
|
+
bundle "install --without foo"
|
103
|
+
|
104
|
+
gemfile <<-G
|
105
|
+
source "file://#{gem_repo1}"
|
106
|
+
gem "rack"
|
107
|
+
G
|
108
|
+
|
109
|
+
bundle "check", :exitstatus => true
|
110
|
+
out.should include("* rack (1.0.0)")
|
111
|
+
@exitstatus.should == 1
|
112
|
+
end
|
113
|
+
|
114
|
+
it "ignores missing gems restricted to other platforms" do
|
115
|
+
system_gems "rack-1.0.0"
|
116
|
+
|
117
|
+
gemfile <<-G
|
118
|
+
source "file://#{gem_repo1}"
|
119
|
+
gem "rack"
|
120
|
+
platforms :#{not_local_tag} do
|
121
|
+
gem "activesupport"
|
122
|
+
end
|
123
|
+
G
|
124
|
+
|
125
|
+
lockfile <<-G
|
126
|
+
GEM
|
127
|
+
remote: file:#{gem_repo1}/
|
128
|
+
specs:
|
129
|
+
activesupport (2.3.5)
|
130
|
+
rack (1.0.0)
|
131
|
+
|
132
|
+
PLATFORMS
|
133
|
+
#{local}
|
134
|
+
#{not_local}
|
135
|
+
|
136
|
+
DEPENDENCIES
|
137
|
+
rack
|
138
|
+
activesupport
|
139
|
+
G
|
140
|
+
|
141
|
+
bundle :check
|
142
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
143
|
+
end
|
144
|
+
|
145
|
+
it "works with env conditionals" do
|
146
|
+
system_gems "rack-1.0.0"
|
147
|
+
|
148
|
+
gemfile <<-G
|
149
|
+
source "file://#{gem_repo1}"
|
150
|
+
gem "rack"
|
151
|
+
env :NOT_GOING_TO_BE_SET do
|
152
|
+
gem "activesupport"
|
153
|
+
end
|
154
|
+
G
|
155
|
+
|
156
|
+
lockfile <<-G
|
157
|
+
GEM
|
158
|
+
remote: file:#{gem_repo1}/
|
159
|
+
specs:
|
160
|
+
activesupport (2.3.5)
|
161
|
+
rack (1.0.0)
|
162
|
+
|
163
|
+
PLATFORMS
|
164
|
+
#{local}
|
165
|
+
#{not_local}
|
166
|
+
|
167
|
+
DEPENDENCIES
|
168
|
+
rack
|
169
|
+
activesupport
|
170
|
+
G
|
171
|
+
|
172
|
+
bundle :check
|
173
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
174
|
+
end
|
175
|
+
|
176
|
+
it "outputs an error when the default Gemfile is not found" do
|
177
|
+
bundle :check, :exitstatus => true
|
178
|
+
@exitstatus.should eq(10)
|
179
|
+
out.should include("Could not locate Gemfile")
|
180
|
+
end
|
181
|
+
|
182
|
+
it "does not output fatal error message" do
|
183
|
+
bundle :check, :exitstatus => true
|
184
|
+
@exitstatus.should eq(10)
|
185
|
+
out.should_not include("Unfortunately, a fatal error has occurred. ")
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should not crash when called multiple times on a new machine" do
|
189
|
+
gemfile <<-G
|
190
|
+
gem 'rails', '3.0.0.beta3'
|
191
|
+
gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
|
192
|
+
G
|
193
|
+
|
194
|
+
simulate_new_machine
|
195
|
+
bundle "check"
|
196
|
+
last_out = out
|
197
|
+
3.times do |i|
|
198
|
+
bundle :check
|
199
|
+
out.should eq(last_out)
|
200
|
+
err.should be_empty
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
it "fails when there's no lock file and frozen is set" do
|
205
|
+
gemfile <<-G
|
206
|
+
source "file://#{gem_repo1}"
|
207
|
+
gem "foo"
|
208
|
+
G
|
209
|
+
|
210
|
+
bundle "install"
|
211
|
+
bundle "install --deployment"
|
212
|
+
FileUtils.rm(bundled_app("Gemfile.lock"))
|
213
|
+
|
214
|
+
bundle :check, :exitstatus => true
|
215
|
+
exitstatus.should_not eq(0)
|
216
|
+
end
|
217
|
+
|
218
|
+
context "--path" do
|
219
|
+
before do
|
220
|
+
gemfile <<-G
|
221
|
+
source "file://#{gem_repo1}"
|
222
|
+
gem "rails"
|
223
|
+
G
|
224
|
+
bundle "install --path vendor/bundle"
|
225
|
+
|
226
|
+
FileUtils.rm_rf(bundled_app(".bundle"))
|
227
|
+
end
|
228
|
+
|
229
|
+
it "returns success" do
|
230
|
+
bundle "check --path vendor/bundle", :exitstatus => true
|
231
|
+
@exitstatus.should eq(0)
|
232
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
233
|
+
end
|
234
|
+
|
235
|
+
it "should write to .bundle/config" do
|
236
|
+
bundle "check --path vendor/bundle", :exitstatus => true
|
237
|
+
bundle "check", :exitstatus => true
|
238
|
+
@exitstatus.should eq(0)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
describe "when locked" do
|
243
|
+
before :each do
|
244
|
+
system_gems "rack-1.0.0"
|
245
|
+
install_gemfile <<-G
|
246
|
+
source "file://#{gem_repo1}"
|
247
|
+
gem "rack", "1.0"
|
248
|
+
G
|
249
|
+
end
|
250
|
+
|
251
|
+
it "returns success when the Gemfile is satisfied" do
|
252
|
+
bundle :install
|
253
|
+
bundle :check, :exitstatus => true
|
254
|
+
@exitstatus.should eq(0)
|
255
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
256
|
+
end
|
257
|
+
|
258
|
+
it "shows what is missing with the current Gemfile if it is not satisfied" do
|
259
|
+
simulate_new_machine
|
260
|
+
bundle :check
|
261
|
+
out.should match(/The following gems are missing/)
|
262
|
+
out.should include("* rack (1.0")
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
@@ -0,0 +1,492 @@
|
|
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"
|
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"
|
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"
|
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"
|
115
|
+
bundle "install --without test_group"
|
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"
|
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", :path => lib_path("foo")
|
150
|
+
git_path = lib_path('foo')
|
151
|
+
revision = revision_for(git_path)
|
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"
|
163
|
+
|
164
|
+
gemfile <<-G
|
165
|
+
source "file://#{gem_repo1}"
|
166
|
+
|
167
|
+
gem "rack", "1.0.0"
|
168
|
+
G
|
169
|
+
bundle "install"
|
170
|
+
|
171
|
+
bundle :clean
|
172
|
+
|
173
|
+
out.should eq("Removing foo (#{revision[0..11]})")
|
174
|
+
|
175
|
+
vendored_gems("gems/rack-1.0.0").should exist
|
176
|
+
vendored_gems("bundler/gems/foo-#{revision[0..11]}").should_not exist
|
177
|
+
digest = Digest::SHA1.hexdigest(git_path.to_s)
|
178
|
+
vendored_gems("cache/bundler/git/foo-#{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-bar", :path => lib_path("foo-bar")
|
187
|
+
revision = revision_for(lib_path("foo-bar"))
|
188
|
+
|
189
|
+
gemfile <<-G
|
190
|
+
source "file://#{gem_repo1}"
|
191
|
+
|
192
|
+
gem "rack", "1.0.0"
|
193
|
+
git "#{lib_path('foo-bar')}" do
|
194
|
+
gem "foo-bar"
|
195
|
+
end
|
196
|
+
G
|
197
|
+
|
198
|
+
bundle "install --path vendor/bundle"
|
199
|
+
|
200
|
+
update_git "foo", :path => lib_path("foo-bar")
|
201
|
+
revision2 = revision_for(lib_path("foo-bar"))
|
202
|
+
|
203
|
+
bundle "update"
|
204
|
+
bundle :clean
|
205
|
+
|
206
|
+
out.should eq("Removing foo-bar (#{revision[0..11]})")
|
207
|
+
|
208
|
+
vendored_gems("gems/rack-1.0.0").should exist
|
209
|
+
vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}").should_not exist
|
210
|
+
vendored_gems("bundler/gems/foo-bar-#{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"
|
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, :exitstatus => true
|
243
|
+
|
244
|
+
exitstatus.should eq(1)
|
245
|
+
out.should == "Can only use bundle clean when --path is set or --force is set"
|
246
|
+
end
|
247
|
+
|
248
|
+
# handling bundle clean upgrade path from the pre's
|
249
|
+
it "removes .gem/.gemspec file even if there's no corresponding gem dir is already moved" do
|
250
|
+
gemfile <<-G
|
251
|
+
source "file://#{gem_repo1}"
|
252
|
+
|
253
|
+
gem "thin"
|
254
|
+
gem "foo"
|
255
|
+
G
|
256
|
+
|
257
|
+
bundle "install --path vendor/bundle"
|
258
|
+
|
259
|
+
gemfile <<-G
|
260
|
+
source "file://#{gem_repo1}"
|
261
|
+
|
262
|
+
gem "foo"
|
263
|
+
G
|
264
|
+
bundle "install"
|
265
|
+
|
266
|
+
FileUtils.rm(vendored_gems("bin/rackup"))
|
267
|
+
FileUtils.rm_rf(vendored_gems("gems/thin-1.0"))
|
268
|
+
FileUtils.rm_rf(vendored_gems("gems/rack-1.0.0"))
|
269
|
+
|
270
|
+
bundle :clean
|
271
|
+
|
272
|
+
should_not_have_gems 'thin-1.0', 'rack-1.0'
|
273
|
+
should_have_gems 'foo-1.0'
|
274
|
+
|
275
|
+
vendored_gems("bin/rackup").should_not exist
|
276
|
+
end
|
277
|
+
|
278
|
+
it "does not call clean automatically when using system gems" do
|
279
|
+
gemfile <<-G
|
280
|
+
source "file://#{gem_repo1}"
|
281
|
+
|
282
|
+
gem "thin"
|
283
|
+
gem "rack"
|
284
|
+
G
|
285
|
+
bundle :install
|
286
|
+
|
287
|
+
gemfile <<-G
|
288
|
+
source "file://#{gem_repo1}"
|
289
|
+
|
290
|
+
gem "rack"
|
291
|
+
G
|
292
|
+
bundle :install
|
293
|
+
|
294
|
+
sys_exec "gem list"
|
295
|
+
out.should include("rack (1.0.0)")
|
296
|
+
out.should include("thin (1.0)")
|
297
|
+
end
|
298
|
+
|
299
|
+
it "--clean should override the bundle setting on install" do
|
300
|
+
gemfile <<-G
|
301
|
+
source "file://#{gem_repo1}"
|
302
|
+
|
303
|
+
gem "thin"
|
304
|
+
gem "rack"
|
305
|
+
G
|
306
|
+
bundle "install --path vendor/bundle --clean"
|
307
|
+
|
308
|
+
gemfile <<-G
|
309
|
+
source "file://#{gem_repo1}"
|
310
|
+
|
311
|
+
gem "rack"
|
312
|
+
G
|
313
|
+
bundle "install"
|
314
|
+
|
315
|
+
should_have_gems 'rack-1.0.0'
|
316
|
+
should_not_have_gems 'thin-1.0'
|
317
|
+
end
|
318
|
+
|
319
|
+
it "--clean should override the bundle setting on update" do
|
320
|
+
build_repo2
|
321
|
+
|
322
|
+
gemfile <<-G
|
323
|
+
source "file://#{gem_repo2}"
|
324
|
+
|
325
|
+
gem "foo"
|
326
|
+
G
|
327
|
+
bundle "install --path vendor/bundle --clean"
|
328
|
+
|
329
|
+
update_repo2 do
|
330
|
+
build_gem 'foo', '1.0.1'
|
331
|
+
end
|
332
|
+
|
333
|
+
bundle "update"
|
334
|
+
|
335
|
+
should_have_gems 'foo-1.0.1'
|
336
|
+
should_not_have_gems 'foo-1.0'
|
337
|
+
end
|
338
|
+
|
339
|
+
it "does not clean automatically on --path" do
|
340
|
+
gemfile <<-G
|
341
|
+
source "file://#{gem_repo1}"
|
342
|
+
|
343
|
+
gem "thin"
|
344
|
+
gem "rack"
|
345
|
+
G
|
346
|
+
bundle "install --path vendor/bundle"
|
347
|
+
|
348
|
+
gemfile <<-G
|
349
|
+
source "file://#{gem_repo1}"
|
350
|
+
|
351
|
+
gem "rack"
|
352
|
+
G
|
353
|
+
bundle "install"
|
354
|
+
|
355
|
+
should_have_gems 'rack-1.0.0', 'thin-1.0'
|
356
|
+
end
|
357
|
+
|
358
|
+
it "does not clean on bundle update with --path" do
|
359
|
+
build_repo2
|
360
|
+
|
361
|
+
gemfile <<-G
|
362
|
+
source "file://#{gem_repo2}"
|
363
|
+
|
364
|
+
gem "foo"
|
365
|
+
G
|
366
|
+
bundle "install --path vendor/bundle"
|
367
|
+
|
368
|
+
update_repo2 do
|
369
|
+
build_gem 'foo', '1.0.1'
|
370
|
+
end
|
371
|
+
|
372
|
+
bundle :update
|
373
|
+
should_have_gems 'foo-1.0', 'foo-1.0.1'
|
374
|
+
end
|
375
|
+
|
376
|
+
it "does not clean on bundle update when using --system" do
|
377
|
+
build_repo2
|
378
|
+
|
379
|
+
gemfile <<-G
|
380
|
+
source "file://#{gem_repo2}"
|
381
|
+
|
382
|
+
gem "foo"
|
383
|
+
G
|
384
|
+
bundle "install"
|
385
|
+
|
386
|
+
update_repo2 do
|
387
|
+
build_gem 'foo', '1.0.1'
|
388
|
+
end
|
389
|
+
bundle :update
|
390
|
+
|
391
|
+
sys_exec "gem list"
|
392
|
+
out.should include("foo (1.0.1, 1.0)")
|
393
|
+
end
|
394
|
+
|
395
|
+
it "cleans system gems when --force is used" do
|
396
|
+
gemfile <<-G
|
397
|
+
source "file://#{gem_repo1}"
|
398
|
+
|
399
|
+
gem "foo"
|
400
|
+
gem "rack"
|
401
|
+
G
|
402
|
+
bundle :install
|
403
|
+
|
404
|
+
gemfile <<-G
|
405
|
+
source "file://#{gem_repo1}"
|
406
|
+
|
407
|
+
gem "rack"
|
408
|
+
G
|
409
|
+
bundle :install
|
410
|
+
bundle "clean --force"
|
411
|
+
|
412
|
+
out.should eq("Removing foo (1.0)")
|
413
|
+
sys_exec "gem list"
|
414
|
+
out.should_not include("foo (1.0)")
|
415
|
+
out.should include("rack (1.0.0)")
|
416
|
+
end
|
417
|
+
|
418
|
+
it "cleans git gems with a 7 length git revision" do
|
419
|
+
build_git "foo"
|
420
|
+
revision = revision_for(lib_path("foo-1.0"))
|
421
|
+
|
422
|
+
gemfile <<-G
|
423
|
+
source "file://#{gem_repo1}"
|
424
|
+
|
425
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
426
|
+
G
|
427
|
+
|
428
|
+
bundle "install --path vendor/bundle"
|
429
|
+
|
430
|
+
# mimic 7 length git revisions in Gemfile.lock
|
431
|
+
gemfile_lock = File.read(bundled_app('Gemfile.lock')).split("\n")
|
432
|
+
gemfile_lock.each_with_index do |line, index|
|
433
|
+
gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:")
|
434
|
+
end
|
435
|
+
File.open(bundled_app('Gemfile.lock'), 'w') do |file|
|
436
|
+
file.print gemfile_lock.join("\n")
|
437
|
+
end
|
438
|
+
|
439
|
+
bundle "install --path vendor/bundle"
|
440
|
+
|
441
|
+
bundle :clean
|
442
|
+
|
443
|
+
out.should_not include("Removing foo (1.0 #{revision[0..6]})")
|
444
|
+
|
445
|
+
vendored_gems("bundler/gems/foo-1.0-#{revision[0..6]}").should exist
|
446
|
+
end
|
447
|
+
|
448
|
+
it "when using --force on system gems, it doesn't remove binaries" do
|
449
|
+
build_repo2
|
450
|
+
update_repo2 do
|
451
|
+
build_gem 'bindir' do |s|
|
452
|
+
s.bindir = "exe"
|
453
|
+
s.executables = "foo"
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
gemfile <<-G
|
458
|
+
source "file://#{gem_repo2}"
|
459
|
+
|
460
|
+
gem "bindir"
|
461
|
+
G
|
462
|
+
bundle :install
|
463
|
+
|
464
|
+
bundle "clean --force"
|
465
|
+
|
466
|
+
sys_status "foo"
|
467
|
+
|
468
|
+
exitstatus.should eq(0)
|
469
|
+
out.should eq("1.0")
|
470
|
+
end
|
471
|
+
|
472
|
+
it "doesn't blow up on path gems without a .gempsec" do
|
473
|
+
relative_path = "vendor/private_gems/bar-1.0"
|
474
|
+
absolute_path = bundled_app(relative_path)
|
475
|
+
FileUtils.mkdir_p("#{absolute_path}/lib/bar")
|
476
|
+
File.open("#{absolute_path}/lib/bar/bar.rb", 'wb') do |file|
|
477
|
+
file.puts "module Bar; end"
|
478
|
+
end
|
479
|
+
|
480
|
+
gemfile <<-G
|
481
|
+
source "file://#{gem_repo1}"
|
482
|
+
|
483
|
+
gem "foo"
|
484
|
+
gem "bar", "1.0", :path => "#{relative_path}"
|
485
|
+
G
|
486
|
+
|
487
|
+
bundle "install --path vendor/bundle"
|
488
|
+
bundle :clean, :exitstatus => true
|
489
|
+
|
490
|
+
exitstatus.should eq(0)
|
491
|
+
end
|
492
|
+
end
|