honkster-bundler 1.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/CHANGELOG.md +547 -0
- data/ISSUES.md +32 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +150 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bundler.gemspec +30 -0
- data/lib/bundler.rb +268 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +515 -0
- data/lib/bundler/definition.rb +427 -0
- data/lib/bundler/dependency.rb +114 -0
- data/lib/bundler/deployment.rb +37 -0
- data/lib/bundler/dsl.rb +245 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/gem_helper.rb +145 -0
- data/lib/bundler/graph.rb +130 -0
- data/lib/bundler/index.rb +114 -0
- data/lib/bundler/installer.rb +84 -0
- data/lib/bundler/lazy_specification.rb +71 -0
- data/lib/bundler/lockfile_parser.rb +108 -0
- data/lib/bundler/remote_specification.rb +59 -0
- data/lib/bundler/resolver.rb +454 -0
- data/lib/bundler/rubygems_ext.rb +203 -0
- data/lib/bundler/runtime.rb +148 -0
- data/lib/bundler/settings.rb +117 -0
- data/lib/bundler/setup.rb +15 -0
- data/lib/bundler/shared_helpers.rb +151 -0
- data/lib/bundler/source.rb +662 -0
- data/lib/bundler/spec_set.rb +134 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -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 +3 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -0
- data/lib/bundler/ui.rb +60 -0
- data/lib/bundler/vendor/thor.rb +319 -0
- data/lib/bundler/vendor/thor/actions.rb +297 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -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 +229 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +104 -0
- data/lib/bundler/vendor/thor/base.rb +556 -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/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 +174 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +275 -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 +114 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +9 -0
- data/man/bundle-config.ronn +90 -0
- data/man/bundle-exec.ronn +98 -0
- data/man/bundle-install.ronn +310 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +77 -0
- data/man/gemfile.5.ronn +273 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +205 -0
- data/spec/cache/git_spec.rb +9 -0
- data/spec/cache/path_spec.rb +27 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +197 -0
- data/spec/install/deprecated_spec.rb +43 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +272 -0
- data/spec/install/gems/groups_spec.rb +228 -0
- data/spec/install/gems/packed_spec.rb +72 -0
- data/spec/install/gems/platform_spec.rb +195 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +749 -0
- data/spec/install/gems/sudo_spec.rb +77 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +96 -0
- data/spec/install/git_spec.rb +553 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +329 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/flex_spec.rb +650 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/other/check_spec.rb +221 -0
- data/spec/other/config_spec.rb +40 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +241 -0
- data/spec/other/ext_spec.rb +16 -0
- data/spec/other/gem_helper_spec.rb +126 -0
- data/spec/other/help_spec.rb +36 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +24 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/show_spec.rb +82 -0
- data/spec/pack/gems_spec.rb +22 -0
- data/spec/quality_spec.rb +55 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +57 -0
- data/spec/runtime/environment_rb_spec.rb +162 -0
- data/spec/runtime/executable_spec.rb +110 -0
- data/spec/runtime/load_spec.rb +102 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +231 -0
- data/spec/runtime/setup_spec.rb +412 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +82 -0
- data/spec/support/builders.rb +566 -0
- data/spec/support/helpers.rb +243 -0
- data/spec/support/indexes.rb +113 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +71 -0
- data/spec/support/platforms.rb +49 -0
- data/spec/support/ruby_ext.rb +19 -0
- data/spec/support/rubygems_ext.rb +30 -0
- data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +112 -0
- data/spec/update/git_spec.rb +159 -0
- data/spec/update/source_spec.rb +50 -0
- metadata +251 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install with gem sources" do
|
4
|
+
describe "install time dependencies" do
|
5
|
+
it "installs gems with implicit rake dependencies" do
|
6
|
+
install_gemfile <<-G
|
7
|
+
source "file://#{gem_repo1}"
|
8
|
+
gem "with_implicit_rake_dep"
|
9
|
+
gem "another_implicit_rake_dep"
|
10
|
+
gem "rake"
|
11
|
+
G
|
12
|
+
|
13
|
+
run <<-R
|
14
|
+
require 'implicit_rake_dep'
|
15
|
+
require 'another_implicit_rake_dep'
|
16
|
+
puts IMPLICIT_RAKE_DEP
|
17
|
+
puts ANOTHER_IMPLICIT_RAKE_DEP
|
18
|
+
R
|
19
|
+
out.should == "YES\nYES"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "installs gems with a dependency with no type" do
|
23
|
+
build_repo2
|
24
|
+
|
25
|
+
path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz"
|
26
|
+
spec = Marshal.load(Gem.inflate(File.read(path)))
|
27
|
+
spec.dependencies.each do |d|
|
28
|
+
d.instance_variable_set(:@type, :fail)
|
29
|
+
end
|
30
|
+
File.open(path, 'w') do |f|
|
31
|
+
f.write Gem.deflate(Marshal.dump(spec))
|
32
|
+
end
|
33
|
+
|
34
|
+
install_gemfile <<-G
|
35
|
+
source "file://#{gem_repo2}"
|
36
|
+
gem "actionpack", "2.3.2"
|
37
|
+
G
|
38
|
+
|
39
|
+
should_be_installed "actionpack 2.3.2", "activesupport 2.3.2"
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "with crazy rubygem plugin stuff" do
|
43
|
+
it "installs plugins" do
|
44
|
+
install_gemfile <<-G
|
45
|
+
source "file://#{gem_repo1}"
|
46
|
+
gem "net_b"
|
47
|
+
G
|
48
|
+
|
49
|
+
should_be_installed "net_b 1.0"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "installs plugins depended on by other plugins" do
|
53
|
+
install_gemfile <<-G
|
54
|
+
source "file://#{gem_repo1}"
|
55
|
+
gem "net_a"
|
56
|
+
G
|
57
|
+
|
58
|
+
should_be_installed "net_a 1.0", "net_b 1.0"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "installs multiple levels of dependencies" do
|
62
|
+
install_gemfile <<-G
|
63
|
+
source "file://#{gem_repo1}"
|
64
|
+
gem "net_c"
|
65
|
+
gem "net_e"
|
66
|
+
G
|
67
|
+
|
68
|
+
should_be_installed "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,749 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install with gem sources" do
|
4
|
+
describe "the simple case" do
|
5
|
+
it "prints output and returns if no dependencies are specified" do
|
6
|
+
gemfile <<-G
|
7
|
+
source "file://#{gem_repo1}"
|
8
|
+
G
|
9
|
+
|
10
|
+
bundle :install
|
11
|
+
out.should =~ /no dependencies/
|
12
|
+
end
|
13
|
+
|
14
|
+
it "does not make a lockfile if the install fails" do
|
15
|
+
install_gemfile <<-G, :expect_err => true
|
16
|
+
raise StandardError, "FAIL"
|
17
|
+
G
|
18
|
+
|
19
|
+
err.should =~ /FAIL \(StandardError\)/
|
20
|
+
bundled_app("Gemfile.lock").should_not exist
|
21
|
+
end
|
22
|
+
|
23
|
+
it "creates a Gemfile.lock" do
|
24
|
+
install_gemfile <<-G
|
25
|
+
source "file://#{gem_repo1}"
|
26
|
+
gem "rack"
|
27
|
+
G
|
28
|
+
|
29
|
+
bundled_app('Gemfile.lock').should exist
|
30
|
+
end
|
31
|
+
|
32
|
+
it "creates lock files based on the Gemfile name" do
|
33
|
+
gemfile bundled_app('OmgFile'), <<-G
|
34
|
+
source "file://#{gem_repo1}"
|
35
|
+
gem "rack", "1.0"
|
36
|
+
G
|
37
|
+
|
38
|
+
bundle 'install --gemfile OmgFile'
|
39
|
+
|
40
|
+
bundled_app("OmgFile.lock").should exist
|
41
|
+
end
|
42
|
+
|
43
|
+
it "doesn't delete the lockfile if one already exists" do
|
44
|
+
install_gemfile <<-G
|
45
|
+
source "file://#{gem_repo1}"
|
46
|
+
gem 'rack'
|
47
|
+
G
|
48
|
+
|
49
|
+
lockfile = File.read(bundled_app("Gemfile.lock"))
|
50
|
+
|
51
|
+
install_gemfile <<-G, :expect_err => true
|
52
|
+
raise StandardError, "FAIL"
|
53
|
+
G
|
54
|
+
|
55
|
+
File.read(bundled_app("Gemfile.lock")).should == lockfile
|
56
|
+
end
|
57
|
+
|
58
|
+
it "does not touch the lockfile if nothing changed" do
|
59
|
+
install_gemfile <<-G
|
60
|
+
source "file://#{gem_repo1}"
|
61
|
+
gem "rack"
|
62
|
+
G
|
63
|
+
|
64
|
+
lambda { run '1' }.should_not change { File.mtime(bundled_app('Gemfile.lock')) }
|
65
|
+
end
|
66
|
+
|
67
|
+
it "fetches gems" do
|
68
|
+
install_gemfile <<-G
|
69
|
+
source "file://#{gem_repo1}"
|
70
|
+
gem 'rack'
|
71
|
+
G
|
72
|
+
|
73
|
+
default_bundle_path("gems/rack-1.0.0").should exist
|
74
|
+
should_be_installed("rack 1.0.0")
|
75
|
+
end
|
76
|
+
|
77
|
+
it "fetches gems when multiple versions are specified" do
|
78
|
+
install_gemfile <<-G
|
79
|
+
source "file://#{gem_repo1}"
|
80
|
+
gem 'rack', "> 0.9", "< 1.0"
|
81
|
+
G
|
82
|
+
|
83
|
+
default_bundle_path("gems/rack-0.9.1").should exist
|
84
|
+
should_be_installed("rack 0.9.1")
|
85
|
+
end
|
86
|
+
|
87
|
+
it "fetches gems when multiple versions are specified take 2" do
|
88
|
+
install_gemfile <<-G
|
89
|
+
source "file://#{gem_repo1}"
|
90
|
+
gem 'rack', "< 1.0", "> 0.9"
|
91
|
+
G
|
92
|
+
|
93
|
+
default_bundle_path("gems/rack-0.9.1").should exist
|
94
|
+
should_be_installed("rack 0.9.1")
|
95
|
+
end
|
96
|
+
|
97
|
+
it "raises an appropriate error when gems are specified using symbols" do
|
98
|
+
status = install_gemfile(<<-G, :exitstatus => true)
|
99
|
+
source "file://#{gem_repo1}"
|
100
|
+
gem :rack
|
101
|
+
G
|
102
|
+
status.should == 4
|
103
|
+
end
|
104
|
+
|
105
|
+
it "pulls in dependencies" do
|
106
|
+
install_gemfile <<-G
|
107
|
+
source "file://#{gem_repo1}"
|
108
|
+
gem "rails"
|
109
|
+
G
|
110
|
+
|
111
|
+
should_be_installed "actionpack 2.3.2", "rails 2.3.2"
|
112
|
+
end
|
113
|
+
|
114
|
+
it "does the right version" do
|
115
|
+
install_gemfile <<-G
|
116
|
+
source "file://#{gem_repo1}"
|
117
|
+
gem "rack", "0.9.1"
|
118
|
+
G
|
119
|
+
|
120
|
+
should_be_installed "rack 0.9.1"
|
121
|
+
end
|
122
|
+
|
123
|
+
it "does not install the development dependency" do
|
124
|
+
install_gemfile <<-G
|
125
|
+
source "file://#{gem_repo1}"
|
126
|
+
gem "with_development_dependency"
|
127
|
+
G
|
128
|
+
|
129
|
+
should_be_installed "with_development_dependency 1.0.0"
|
130
|
+
should_not_be_installed "activesupport 2.3.5"
|
131
|
+
end
|
132
|
+
|
133
|
+
it "resolves correctly" do
|
134
|
+
install_gemfile <<-G
|
135
|
+
source "file://#{gem_repo1}"
|
136
|
+
gem "activemerchant"
|
137
|
+
gem "rails"
|
138
|
+
G
|
139
|
+
|
140
|
+
should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
|
141
|
+
end
|
142
|
+
|
143
|
+
it "activates gem correctly according to the resolved gems" do
|
144
|
+
install_gemfile <<-G
|
145
|
+
source "file://#{gem_repo1}"
|
146
|
+
gem "activesupport", "2.3.5"
|
147
|
+
G
|
148
|
+
|
149
|
+
install_gemfile <<-G
|
150
|
+
source "file://#{gem_repo1}"
|
151
|
+
gem "activemerchant"
|
152
|
+
gem "rails"
|
153
|
+
G
|
154
|
+
|
155
|
+
should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
|
156
|
+
end
|
157
|
+
|
158
|
+
it "does not reinstall any gem that is already available locally" do
|
159
|
+
system_gems "activesupport-2.3.2"
|
160
|
+
|
161
|
+
build_repo2 do
|
162
|
+
build_gem "activesupport", "2.3.2" do |s|
|
163
|
+
s.write "lib/activesupport.rb", "ACTIVESUPPORT = 'fail'"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
install_gemfile <<-G
|
168
|
+
source "file://#{gem_repo2}"
|
169
|
+
gem "activerecord", "2.3.2"
|
170
|
+
G
|
171
|
+
|
172
|
+
should_be_installed "activesupport 2.3.2"
|
173
|
+
end
|
174
|
+
|
175
|
+
it "works when the gemfile specifies gems that only exist in the system" do
|
176
|
+
build_gem "foo", :to_system => true
|
177
|
+
install_gemfile <<-G
|
178
|
+
source "file://#{gem_repo1}"
|
179
|
+
gem "rack"
|
180
|
+
gem "foo"
|
181
|
+
G
|
182
|
+
|
183
|
+
should_be_installed "rack 1.0.0", "foo 1.0.0"
|
184
|
+
end
|
185
|
+
|
186
|
+
it "prioritizes local gems over remote gems" do
|
187
|
+
build_gem 'rack', '1.0.0', :to_system => true do |s|
|
188
|
+
s.add_dependency "activesupport", "2.3.5"
|
189
|
+
end
|
190
|
+
|
191
|
+
install_gemfile <<-G
|
192
|
+
source "file://#{gem_repo1}"
|
193
|
+
gem "rack"
|
194
|
+
G
|
195
|
+
|
196
|
+
should_be_installed "rack 1.0.0", "activesupport 2.3.5"
|
197
|
+
end
|
198
|
+
|
199
|
+
describe "with a gem that installs multiple platforms" do
|
200
|
+
it "installs gems for the local platform as first choice" do
|
201
|
+
install_gemfile <<-G
|
202
|
+
source "file://#{gem_repo1}"
|
203
|
+
gem "platform_specific"
|
204
|
+
G
|
205
|
+
|
206
|
+
run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
|
207
|
+
out.should == "1.0.0 #{Gem::Platform.local}"
|
208
|
+
end
|
209
|
+
|
210
|
+
it "falls back on plain ruby" do
|
211
|
+
simulate_platform "foo-bar-baz"
|
212
|
+
install_gemfile <<-G
|
213
|
+
source "file://#{gem_repo1}"
|
214
|
+
gem "platform_specific"
|
215
|
+
G
|
216
|
+
|
217
|
+
run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
|
218
|
+
out.should == "1.0.0 RUBY"
|
219
|
+
end
|
220
|
+
|
221
|
+
it "installs gems for java" do
|
222
|
+
simulate_platform "java"
|
223
|
+
install_gemfile <<-G
|
224
|
+
source "file://#{gem_repo1}"
|
225
|
+
gem "platform_specific"
|
226
|
+
G
|
227
|
+
|
228
|
+
run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
|
229
|
+
out.should == "1.0.0 JAVA"
|
230
|
+
end
|
231
|
+
|
232
|
+
it "installs gems for windows" do
|
233
|
+
simulate_platform mswin
|
234
|
+
|
235
|
+
install_gemfile <<-G
|
236
|
+
source "file://#{gem_repo1}"
|
237
|
+
gem "platform_specific"
|
238
|
+
G
|
239
|
+
|
240
|
+
run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
|
241
|
+
out.should == "1.0.0 MSWIN"
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
describe "doing bundle install foo" do
|
246
|
+
before do
|
247
|
+
gemfile <<-G
|
248
|
+
source "file://#{gem_repo1}"
|
249
|
+
gem "rack"
|
250
|
+
G
|
251
|
+
end
|
252
|
+
|
253
|
+
it "works" do
|
254
|
+
bundle "install vendor"
|
255
|
+
should_be_installed "rack 1.0"
|
256
|
+
end
|
257
|
+
|
258
|
+
it "allows running bundle install --system without deleting foo" do
|
259
|
+
bundle "install vendor"
|
260
|
+
bundle "install --system"
|
261
|
+
FileUtils.rm_rf(bundled_app("vendor"))
|
262
|
+
should_be_installed "rack 1.0"
|
263
|
+
end
|
264
|
+
|
265
|
+
it "allows running bundle install --system after deleting foo" do
|
266
|
+
bundle "install vendor"
|
267
|
+
FileUtils.rm_rf(bundled_app("vendor"))
|
268
|
+
bundle "install --system"
|
269
|
+
should_be_installed "rack 1.0"
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
it "finds gems in multiple sources" do
|
274
|
+
build_repo2
|
275
|
+
update_repo2
|
276
|
+
|
277
|
+
install_gemfile <<-G
|
278
|
+
source "file://#{gem_repo1}"
|
279
|
+
source "file://#{gem_repo2}"
|
280
|
+
|
281
|
+
gem "activesupport", "1.2.3"
|
282
|
+
gem "rack", "1.2"
|
283
|
+
G
|
284
|
+
|
285
|
+
should_be_installed "rack 1.2", "activesupport 1.2.3"
|
286
|
+
end
|
287
|
+
|
288
|
+
it "gives a useful error if no sources are set" do
|
289
|
+
install_gemfile <<-G
|
290
|
+
gem "rack"
|
291
|
+
G
|
292
|
+
|
293
|
+
bundle :install, :expect_err => true
|
294
|
+
out.should =~ /Your Gemfile doesn't have any sources/i
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
describe "when prerelease gems are available" do
|
299
|
+
it "finds prereleases" do
|
300
|
+
install_gemfile <<-G
|
301
|
+
source "file://#{gem_repo1}"
|
302
|
+
gem "not_released"
|
303
|
+
G
|
304
|
+
should_be_installed "not_released 1.0.pre"
|
305
|
+
end
|
306
|
+
|
307
|
+
it "uses regular releases if available" do
|
308
|
+
install_gemfile <<-G
|
309
|
+
source "file://#{gem_repo1}"
|
310
|
+
gem "has_prerelease"
|
311
|
+
G
|
312
|
+
should_be_installed "has_prerelease 1.0"
|
313
|
+
end
|
314
|
+
|
315
|
+
it "uses prereleases if requested" do
|
316
|
+
install_gemfile <<-G
|
317
|
+
source "file://#{gem_repo1}"
|
318
|
+
gem "has_prerelease", "1.1.pre"
|
319
|
+
G
|
320
|
+
should_be_installed "has_prerelease 1.1.pre"
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
describe "when prerelease gems are not available" do
|
325
|
+
it "still works" do
|
326
|
+
build_repo3
|
327
|
+
install_gemfile <<-G
|
328
|
+
source "file://#{gem_repo3}"
|
329
|
+
gem "rack"
|
330
|
+
G
|
331
|
+
|
332
|
+
should_be_installed "rack 1.0"
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
describe "when BUNDLE_PATH or the global path config is set" do
|
337
|
+
before :each do
|
338
|
+
build_lib "rack", "1.0.0", :to_system => true do |s|
|
339
|
+
s.write "lib/rack.rb", "raise 'FAIL'"
|
340
|
+
end
|
341
|
+
|
342
|
+
gemfile <<-G
|
343
|
+
source "file://#{gem_repo1}"
|
344
|
+
gem "rack"
|
345
|
+
G
|
346
|
+
end
|
347
|
+
|
348
|
+
def set_bundle_path(type, location)
|
349
|
+
if type == :env
|
350
|
+
ENV["BUNDLE_PATH"] = location
|
351
|
+
elsif type == :global
|
352
|
+
bundle "config path #{location}", "no-color" => nil
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
[:env, :global].each do |type|
|
357
|
+
it "installs gems to a path if one is specified" do
|
358
|
+
set_bundle_path(type, bundled_app("vendor2").to_s)
|
359
|
+
bundle "install vendor"
|
360
|
+
|
361
|
+
vendored_gems("gems/rack-1.0.0").should be_directory
|
362
|
+
bundled_app("vendor2").should_not be_directory
|
363
|
+
should_be_installed "rack 1.0.0"
|
364
|
+
end
|
365
|
+
|
366
|
+
it "installs gems to BUNDLE_PATH with #{type}" do
|
367
|
+
set_bundle_path(type, bundled_app("vendor").to_s)
|
368
|
+
|
369
|
+
bundle :install
|
370
|
+
|
371
|
+
bundled_app('vendor/gems/rack-1.0.0').should be_directory
|
372
|
+
should_be_installed "rack 1.0.0"
|
373
|
+
end
|
374
|
+
|
375
|
+
it "installs gems to BUNDLE_PATH relative to root when relative" do
|
376
|
+
set_bundle_path(type, "vendor")
|
377
|
+
|
378
|
+
FileUtils.mkdir_p bundled_app('lol')
|
379
|
+
Dir.chdir(bundled_app('lol')) do
|
380
|
+
bundle :install
|
381
|
+
end
|
382
|
+
|
383
|
+
bundled_app('vendor/gems/rack-1.0.0').should be_directory
|
384
|
+
should_be_installed "rack 1.0.0"
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
it "installs gems to BUNDLE_PATH from .bundle/config" do
|
389
|
+
config "BUNDLE_PATH" => bundled_app("vendor").to_s
|
390
|
+
|
391
|
+
bundle :install
|
392
|
+
|
393
|
+
vendored_gems('gems/rack-1.0.0').should be_directory
|
394
|
+
should_be_installed "rack 1.0.0"
|
395
|
+
end
|
396
|
+
|
397
|
+
it "sets BUNDLE_PATH as the first argument to bundle install" do
|
398
|
+
bundle "install ./vendor"
|
399
|
+
|
400
|
+
vendored_gems('gems/rack-1.0.0').should be_directory
|
401
|
+
should_be_installed "rack 1.0.0"
|
402
|
+
end
|
403
|
+
|
404
|
+
it "disables system gems when passing a path to install" do
|
405
|
+
# This is so that vendored gems can be distributed to others
|
406
|
+
build_gem "rack", "1.1.0", :to_system => true
|
407
|
+
bundle "install ./vendor"
|
408
|
+
|
409
|
+
vendored_gems('gems/rack-1.0.0').should be_directory
|
410
|
+
should_be_installed "rack 1.0.0"
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
describe "when passing in a Gemfile via --gemfile" do
|
415
|
+
it "finds the gemfile" do
|
416
|
+
gemfile bundled_app("NotGemfile"), <<-G
|
417
|
+
source "file://#{gem_repo1}"
|
418
|
+
gem 'rack'
|
419
|
+
G
|
420
|
+
|
421
|
+
bundle :install, :gemfile => bundled_app("NotGemfile")
|
422
|
+
|
423
|
+
ENV['BUNDLE_GEMFILE'] = "NotGemfile"
|
424
|
+
should_be_installed "rack 1.0.0"
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
describe "when requesting a quiet install via --quiet" do
|
429
|
+
it "should be quiet if there are no warnings" do
|
430
|
+
gemfile <<-G
|
431
|
+
source "file://#{gem_repo1}"
|
432
|
+
gem 'rack'
|
433
|
+
G
|
434
|
+
|
435
|
+
bundle :install, :quiet => true
|
436
|
+
out.should == ""
|
437
|
+
end
|
438
|
+
|
439
|
+
it "should still display warnings" do
|
440
|
+
gemfile <<-G
|
441
|
+
gem 'rack'
|
442
|
+
G
|
443
|
+
|
444
|
+
bundle :install, :quiet => true
|
445
|
+
out.should =~ /doesn't have any sources/
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
describe "when disabling system gems" do
|
450
|
+
before :each do
|
451
|
+
build_gem "rack", "1.0.0", :to_system => true do |s|
|
452
|
+
s.write "lib/rack.rb", "puts 'FAIL'"
|
453
|
+
end
|
454
|
+
|
455
|
+
gemfile <<-G
|
456
|
+
source "file://#{gem_repo1}"
|
457
|
+
gem "rack"
|
458
|
+
G
|
459
|
+
end
|
460
|
+
|
461
|
+
it "behaves like bundle install vendor/bundle with --deployment" do
|
462
|
+
bundle "install"
|
463
|
+
bundle "install --deployment"
|
464
|
+
out.should include("It was installed into ./vendor/bundle")
|
465
|
+
should_be_installed "rack 1.0.0"
|
466
|
+
bundled_app("vendor/bundle").should exist
|
467
|
+
end
|
468
|
+
|
469
|
+
it "prints a warning if you try to use --disable-shared-gems" do
|
470
|
+
bundle "install vendor --disable-shared-gems"
|
471
|
+
out.should include "The disable-shared-gem option is no longer available"
|
472
|
+
end
|
473
|
+
|
474
|
+
["install vendor", "install --path vendor"].each do |install|
|
475
|
+
if install == "install vendor"
|
476
|
+
it "displays the deprecation warning for path as an argument to install" do
|
477
|
+
bundle install
|
478
|
+
out.should include("The path argument to `bundle install` is deprecated.")
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
it "does not use available system gems with bundle #{install}" do
|
483
|
+
bundle install
|
484
|
+
should_be_installed "rack 1.0.0"
|
485
|
+
end
|
486
|
+
|
487
|
+
it "prints a warning to let the user know what has happened with bundle #{install}" do
|
488
|
+
bundle install
|
489
|
+
out.should include("It was installed into ./vendor")
|
490
|
+
end
|
491
|
+
|
492
|
+
it "disallows #{install} --system" do
|
493
|
+
bundle "#{install} --system"
|
494
|
+
out.should include("Please choose.")
|
495
|
+
end
|
496
|
+
|
497
|
+
it "remembers to disable system gems after the first time with bundle #{install}" do
|
498
|
+
bundle install
|
499
|
+
FileUtils.rm_rf bundled_app('vendor')
|
500
|
+
bundle "install"
|
501
|
+
|
502
|
+
vendored_gems('gems/rack-1.0.0').should be_directory
|
503
|
+
should_be_installed "rack 1.0.0"
|
504
|
+
end
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
describe "when loading only the default group" do
|
509
|
+
it "should not load all groups" do
|
510
|
+
install_gemfile <<-G
|
511
|
+
source "file://#{gem_repo1}"
|
512
|
+
gem "rack"
|
513
|
+
gem "activesupport", :groups => :development
|
514
|
+
G
|
515
|
+
|
516
|
+
ruby <<-R
|
517
|
+
require "bundler"
|
518
|
+
Bundler.setup :default
|
519
|
+
Bundler.require :default
|
520
|
+
puts RACK
|
521
|
+
begin
|
522
|
+
require "activesupport"
|
523
|
+
rescue LoadError
|
524
|
+
puts "no activesupport"
|
525
|
+
end
|
526
|
+
R
|
527
|
+
|
528
|
+
out.should include("1.0")
|
529
|
+
out.should include("no activesupport")
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
describe "when a gem has a YAML gemspec" do
|
534
|
+
before :each do
|
535
|
+
build_repo2 do
|
536
|
+
build_gem "yaml_spec", :gemspec => :yaml
|
537
|
+
end
|
538
|
+
end
|
539
|
+
|
540
|
+
it "still installs correctly" do
|
541
|
+
gemfile <<-G
|
542
|
+
source "file://#{gem_repo2}"
|
543
|
+
gem "yaml_spec"
|
544
|
+
G
|
545
|
+
bundle :install
|
546
|
+
err.should be_empty
|
547
|
+
end
|
548
|
+
end
|
549
|
+
|
550
|
+
describe "when the gem has an architecture in its platform" do
|
551
|
+
it "still installs correctly" do
|
552
|
+
simulate_platform mswin
|
553
|
+
|
554
|
+
gemfile <<-G
|
555
|
+
# Set up pretend http gem server with FakeWeb
|
556
|
+
$LOAD_PATH.unshift '#{Dir[base_system_gems.join("gems/fakeweb*/lib")].first}'
|
557
|
+
require 'fakeweb'
|
558
|
+
FakeWeb.allow_net_connect = false
|
559
|
+
files = [ 'specs.4.8.gz',
|
560
|
+
'prerelease_specs.4.8.gz',
|
561
|
+
'quick/Marshal.4.8/rcov-1.0-mswin32.gemspec.rz',
|
562
|
+
'gems/rcov-1.0-mswin32.gem' ]
|
563
|
+
files.each do |file|
|
564
|
+
FakeWeb.register_uri(:get, "http://localgemserver.com/\#{file}",
|
565
|
+
:body => File.read("#{gem_repo1}/\#{file}"))
|
566
|
+
end
|
567
|
+
FakeWeb.register_uri(:get, "http://localgemserver.com/gems/rcov-1.0-x86-mswin32.gem",
|
568
|
+
:status => ["404", "Not Found"])
|
569
|
+
|
570
|
+
# Try to install gem with nil arch
|
571
|
+
source "http://localgemserver.com/"
|
572
|
+
gem "rcov"
|
573
|
+
G
|
574
|
+
bundle :install
|
575
|
+
should_be_installed "rcov 1.0.0"
|
576
|
+
end
|
577
|
+
end
|
578
|
+
|
579
|
+
describe "bundler dependencies" do
|
580
|
+
before(:each) do
|
581
|
+
build_repo2 do
|
582
|
+
build_gem "rails", "3.0" do |s|
|
583
|
+
s.add_dependency "bundler", ">= 0.9.0.pre"
|
584
|
+
end
|
585
|
+
build_gem "bundler", "0.9.1"
|
586
|
+
build_gem "bundler", Bundler::VERSION
|
587
|
+
end
|
588
|
+
end
|
589
|
+
|
590
|
+
it "are forced to the current bundler version" do
|
591
|
+
install_gemfile <<-G
|
592
|
+
source "file://#{gem_repo2}"
|
593
|
+
gem "rails", "3.0"
|
594
|
+
G
|
595
|
+
|
596
|
+
should_be_installed "bundler #{Bundler::VERSION}"
|
597
|
+
end
|
598
|
+
|
599
|
+
it "are not added if not already present" do
|
600
|
+
install_gemfile <<-G
|
601
|
+
source "file://#{gem_repo1}"
|
602
|
+
gem "rack"
|
603
|
+
G
|
604
|
+
should_not_be_installed "bundler #{Bundler::VERSION}"
|
605
|
+
end
|
606
|
+
|
607
|
+
it "causes a conflict if explicitly requesting a different version" do
|
608
|
+
install_gemfile <<-G
|
609
|
+
source "file://#{gem_repo2}"
|
610
|
+
gem "rails", "3.0"
|
611
|
+
gem "bundler", "0.9.2"
|
612
|
+
G
|
613
|
+
|
614
|
+
nice_error = <<-E.strip.gsub(/^ {8}/, '')
|
615
|
+
Fetching source index for file:#{gem_repo2}/
|
616
|
+
Bundler could not find compatible versions for gem "bundler":
|
617
|
+
In Gemfile:
|
618
|
+
bundler (= 0.9.2)
|
619
|
+
|
620
|
+
Current Bundler version:
|
621
|
+
bundler (#{Bundler::VERSION})
|
622
|
+
E
|
623
|
+
out.should == nice_error
|
624
|
+
end
|
625
|
+
|
626
|
+
it "works for gems with multiple versions in its dependencies" do
|
627
|
+
install_gemfile <<-G
|
628
|
+
source "file://#{gem_repo2}"
|
629
|
+
|
630
|
+
gem "multiple_versioned_deps"
|
631
|
+
G
|
632
|
+
|
633
|
+
|
634
|
+
install_gemfile <<-G
|
635
|
+
source "file://#{gem_repo2}"
|
636
|
+
|
637
|
+
gem "multiple_versioned_deps"
|
638
|
+
gem "rack"
|
639
|
+
G
|
640
|
+
|
641
|
+
should_be_installed "multiple_versioned_deps 1.0.0"
|
642
|
+
end
|
643
|
+
|
644
|
+
it "includes bundler in the bundle when it's a child dependency" do
|
645
|
+
install_gemfile <<-G
|
646
|
+
source "file://#{gem_repo2}"
|
647
|
+
gem "rails", "3.0"
|
648
|
+
G
|
649
|
+
|
650
|
+
run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError; puts 'FAIL'; end"
|
651
|
+
out.should == "WIN"
|
652
|
+
end
|
653
|
+
|
654
|
+
it "allows gem 'bundler' when Bundler is not in the Gemfile or its dependencies" do
|
655
|
+
install_gemfile <<-G
|
656
|
+
source "file://#{gem_repo2}"
|
657
|
+
gem "rack"
|
658
|
+
G
|
659
|
+
|
660
|
+
run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError => e; puts e.backtrace; end"
|
661
|
+
out.should == "WIN"
|
662
|
+
end
|
663
|
+
|
664
|
+
it "causes a conflict if child dependencies conflict" do
|
665
|
+
install_gemfile <<-G
|
666
|
+
source "file://#{gem_repo2}"
|
667
|
+
gem "activemerchant"
|
668
|
+
gem "rails_fail"
|
669
|
+
G
|
670
|
+
|
671
|
+
nice_error = <<-E.strip.gsub(/^ {8}/, '')
|
672
|
+
Fetching source index for file:#{gem_repo2}/
|
673
|
+
Bundler could not find compatible versions for gem "activesupport":
|
674
|
+
In Gemfile:
|
675
|
+
activemerchant depends on
|
676
|
+
activesupport (>= 2.0.0)
|
677
|
+
|
678
|
+
rails_fail depends on
|
679
|
+
activesupport (1.2.3)
|
680
|
+
E
|
681
|
+
out.should == nice_error
|
682
|
+
end
|
683
|
+
|
684
|
+
it "causes a conflict if a child dependency conflicts with the Gemfile" do
|
685
|
+
install_gemfile <<-G
|
686
|
+
source "file://#{gem_repo2}"
|
687
|
+
gem "rails_fail"
|
688
|
+
gem "activesupport", "2.3.5"
|
689
|
+
G
|
690
|
+
|
691
|
+
nice_error = <<-E.strip.gsub(/^ {8}/, '')
|
692
|
+
Fetching source index for file:#{gem_repo2}/
|
693
|
+
Bundler could not find compatible versions for gem "activesupport":
|
694
|
+
In Gemfile:
|
695
|
+
rails_fail depends on
|
696
|
+
activesupport (= 1.2.3)
|
697
|
+
|
698
|
+
activesupport (2.3.5)
|
699
|
+
E
|
700
|
+
out.should == nice_error
|
701
|
+
end
|
702
|
+
|
703
|
+
it "can install dependencies even if " do
|
704
|
+
install_gemfile <<-G
|
705
|
+
source "file://#{gem_repo2}"
|
706
|
+
gem "rails", "3.0"
|
707
|
+
G
|
708
|
+
|
709
|
+
simulate_bundler_version "10.0.0"
|
710
|
+
#simulate_new_machine
|
711
|
+
|
712
|
+
bundle "check"
|
713
|
+
out.should == "The Gemfile's dependencies are satisfied"
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
describe "when locked and installed with --without" do
|
718
|
+
before(:each) do
|
719
|
+
build_repo2
|
720
|
+
system_gems "rack-0.9.1" do
|
721
|
+
install_gemfile <<-G, :without => :rack
|
722
|
+
source "file://#{gem_repo2}"
|
723
|
+
gem "rack"
|
724
|
+
|
725
|
+
group :rack do
|
726
|
+
gem "rack_middleware"
|
727
|
+
end
|
728
|
+
G
|
729
|
+
end
|
730
|
+
end
|
731
|
+
|
732
|
+
it "uses the correct versions even if --without was used on the original" do
|
733
|
+
should_be_installed "rack 0.9.1"
|
734
|
+
should_not_be_installed "rack_middleware 1.0"
|
735
|
+
simulate_new_machine
|
736
|
+
|
737
|
+
bundle :install
|
738
|
+
|
739
|
+
should_be_installed "rack 0.9.1"
|
740
|
+
should_be_installed "rack_middleware 1.0"
|
741
|
+
end
|
742
|
+
|
743
|
+
it "does not hit the remote a second time" do
|
744
|
+
FileUtils.rm_rf gem_repo2
|
745
|
+
bundle "install --without rack"
|
746
|
+
err.should be_empty
|
747
|
+
end
|
748
|
+
end
|
749
|
+
end
|