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,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "installing a gem with C extensions" do
|
4
|
+
it "installs" do
|
5
|
+
build_repo2 do
|
6
|
+
build_gem "c_extension" do |s|
|
7
|
+
s.extensions = ["ext/extconf.rb"]
|
8
|
+
s.write "ext/extconf.rb", <<-E
|
9
|
+
require "mkmf"
|
10
|
+
name = "c_extension_bundle"
|
11
|
+
dir_config(name)
|
12
|
+
raise "OMG" unless with_config("c_extension") == "hello"
|
13
|
+
create_makefile(name)
|
14
|
+
E
|
15
|
+
|
16
|
+
s.write "ext/c_extension.c", <<-C
|
17
|
+
#include "ruby.h"
|
18
|
+
|
19
|
+
VALUE c_extension_true(VALUE self) {
|
20
|
+
return Qtrue;
|
21
|
+
}
|
22
|
+
|
23
|
+
void Init_c_extension_bundle() {
|
24
|
+
VALUE c_Extension = rb_define_class("CExtension", rb_cObject);
|
25
|
+
rb_define_method(c_Extension, "its_true", c_extension_true, 0);
|
26
|
+
}
|
27
|
+
C
|
28
|
+
|
29
|
+
s.write "lib/c_extension.rb", <<-C
|
30
|
+
require "c_extension_bundle"
|
31
|
+
C
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
gemfile <<-G
|
36
|
+
source "file://#{gem_repo2}"
|
37
|
+
gem "c_extension"
|
38
|
+
G
|
39
|
+
|
40
|
+
bundle "config build.c_extension --with-c_extension=hello"
|
41
|
+
bundle "install"
|
42
|
+
|
43
|
+
out.should_not include("extconf.rb failed")
|
44
|
+
|
45
|
+
run "Bundler.require; puts CExtension.new.its_true"
|
46
|
+
out.should == "true"
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,402 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "gemcutter's dependency API" do
|
4
|
+
let(:source_uri) { "http://localgemserver.test" }
|
5
|
+
|
6
|
+
it "should use the API" do
|
7
|
+
gemfile <<-G
|
8
|
+
source "#{source_uri}"
|
9
|
+
gem "rack"
|
10
|
+
G
|
11
|
+
|
12
|
+
bundle :install, :artifice => "endpoint"
|
13
|
+
out.should include("Fetching gem metadata from #{source_uri}")
|
14
|
+
should_be_installed "rack 1.0.0"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should URI encode gem names" do
|
18
|
+
gemfile <<-G
|
19
|
+
source "#{source_uri}"
|
20
|
+
gem " sinatra"
|
21
|
+
G
|
22
|
+
|
23
|
+
bundle :install, :artifice => "endpoint"
|
24
|
+
out.should include("Could not find gem ' sinatra")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should handle nested dependencies" do
|
28
|
+
gemfile <<-G
|
29
|
+
source "#{source_uri}"
|
30
|
+
gem "rails"
|
31
|
+
G
|
32
|
+
|
33
|
+
bundle :install, :artifice => "endpoint"
|
34
|
+
out.should include("Fetching gem metadata from #{source_uri}/...")
|
35
|
+
should_be_installed(
|
36
|
+
"rails 2.3.2",
|
37
|
+
"actionpack 2.3.2",
|
38
|
+
"activerecord 2.3.2",
|
39
|
+
"actionmailer 2.3.2",
|
40
|
+
"activeresource 2.3.2",
|
41
|
+
"activesupport 2.3.2")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should handle multiple gem dependencies on the same gem" do
|
45
|
+
gemfile <<-G
|
46
|
+
source "#{source_uri}"
|
47
|
+
gem "net-sftp"
|
48
|
+
G
|
49
|
+
|
50
|
+
bundle :install, :artifice => "endpoint"
|
51
|
+
should_be_installed "net-sftp 1.1.1"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should use the endpoint when using --deployment" do
|
55
|
+
gemfile <<-G
|
56
|
+
source "#{source_uri}"
|
57
|
+
gem "rack"
|
58
|
+
G
|
59
|
+
bundle :install, :artifice => "endpoint"
|
60
|
+
|
61
|
+
bundle "install --deployment", :artifice => "endpoint"
|
62
|
+
out.should include("Fetching gem metadata from #{source_uri}")
|
63
|
+
should_be_installed "rack 1.0.0"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "handles git dependencies that are in rubygems" do
|
67
|
+
build_git "foo" do |s|
|
68
|
+
s.executables = "foobar"
|
69
|
+
s.add_dependency "rails", "2.3.2"
|
70
|
+
end
|
71
|
+
|
72
|
+
gemfile <<-G
|
73
|
+
source "#{source_uri}"
|
74
|
+
git "file:///#{lib_path('foo-1.0')}" do
|
75
|
+
gem 'foo'
|
76
|
+
end
|
77
|
+
G
|
78
|
+
|
79
|
+
bundle :install, :artifice => "endpoint"
|
80
|
+
|
81
|
+
should_be_installed("rails 2.3.2")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "handles git dependencies that are in rubygems using --deployment" do
|
85
|
+
build_git "foo" do |s|
|
86
|
+
s.executables = "foobar"
|
87
|
+
s.add_dependency "rails", "2.3.2"
|
88
|
+
end
|
89
|
+
|
90
|
+
gemfile <<-G
|
91
|
+
source "#{source_uri}"
|
92
|
+
gem 'foo', :git => "file:///#{lib_path('foo-1.0')}"
|
93
|
+
G
|
94
|
+
|
95
|
+
bundle :install, :artifice => "endpoint"
|
96
|
+
|
97
|
+
bundle "install --deployment", :artifice => "endpoint"
|
98
|
+
|
99
|
+
should_be_installed("rails 2.3.2")
|
100
|
+
end
|
101
|
+
|
102
|
+
it "falls back when the API errors out" do
|
103
|
+
simulate_platform mswin
|
104
|
+
|
105
|
+
gemfile <<-G
|
106
|
+
source "#{source_uri}"
|
107
|
+
gem "rcov"
|
108
|
+
G
|
109
|
+
|
110
|
+
bundle :install, :fakeweb => "windows"
|
111
|
+
out.should include("\nFetching full source index from #{source_uri}")
|
112
|
+
should_be_installed "rcov 1.0.0"
|
113
|
+
end
|
114
|
+
|
115
|
+
it "falls back when hitting the Gemcutter Dependency Limit" do
|
116
|
+
gemfile <<-G
|
117
|
+
source "#{source_uri}"
|
118
|
+
gem "activesupport"
|
119
|
+
gem "actionpack"
|
120
|
+
gem "actionmailer"
|
121
|
+
gem "activeresource"
|
122
|
+
gem "thin"
|
123
|
+
gem "rack"
|
124
|
+
gem "rails"
|
125
|
+
G
|
126
|
+
bundle :install, :artifice => "endpoint_fallback"
|
127
|
+
out.should include("\nFetching full source index from #{source_uri}")
|
128
|
+
|
129
|
+
should_be_installed(
|
130
|
+
"activesupport 2.3.2",
|
131
|
+
"actionpack 2.3.2",
|
132
|
+
"actionmailer 2.3.2",
|
133
|
+
"activeresource 2.3.2",
|
134
|
+
"activesupport 2.3.2",
|
135
|
+
"thin 1.0.0",
|
136
|
+
"rack 1.0.0",
|
137
|
+
"rails 2.3.2")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "falls back when Gemcutter API doesn't return proper Marshal format" do
|
141
|
+
gemfile <<-G
|
142
|
+
source "#{source_uri}"
|
143
|
+
gem "rack"
|
144
|
+
G
|
145
|
+
|
146
|
+
bundle :install, :artifice => "endpoint_marshal_fail"
|
147
|
+
out.should include("\nFetching full source index from #{source_uri}")
|
148
|
+
should_be_installed "rack 1.0.0"
|
149
|
+
end
|
150
|
+
|
151
|
+
it "timeouts when Bundler::Fetcher redirects too much" do
|
152
|
+
gemfile <<-G
|
153
|
+
source "#{source_uri}"
|
154
|
+
gem "rack"
|
155
|
+
G
|
156
|
+
|
157
|
+
bundle :install, :artifice => "endpoint_redirect"
|
158
|
+
out.should match(/Too many redirects/)
|
159
|
+
end
|
160
|
+
|
161
|
+
context "when --full-index is specified" do
|
162
|
+
it "should use the modern index for install" do
|
163
|
+
gemfile <<-G
|
164
|
+
source "#{source_uri}"
|
165
|
+
gem "rack"
|
166
|
+
G
|
167
|
+
|
168
|
+
bundle "install --full-index", :artifice => "endpoint"
|
169
|
+
out.should include("Fetching source index from #{source_uri}")
|
170
|
+
should_be_installed "rack 1.0.0"
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should use the modern index for update" do
|
174
|
+
gemfile <<-G
|
175
|
+
source "#{source_uri}"
|
176
|
+
gem "rack"
|
177
|
+
G
|
178
|
+
|
179
|
+
bundle "update --full-index", :artifice => "endpoint"
|
180
|
+
out.should include("Fetching source index from #{source_uri}")
|
181
|
+
should_be_installed "rack 1.0.0"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
it "fetches again when more dependencies are found in subsequent sources" do
|
186
|
+
build_repo2 do
|
187
|
+
build_gem "back_deps" do |s|
|
188
|
+
s.add_dependency "foo"
|
189
|
+
end
|
190
|
+
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
|
191
|
+
end
|
192
|
+
|
193
|
+
gemfile <<-G
|
194
|
+
source "#{source_uri}"
|
195
|
+
source "#{source_uri}/extra"
|
196
|
+
gem "back_deps"
|
197
|
+
G
|
198
|
+
|
199
|
+
bundle :install, :artifice => "endpoint_extra"
|
200
|
+
should_be_installed "back_deps 1.0"
|
201
|
+
end
|
202
|
+
|
203
|
+
it "prints API output properly with back deps" do
|
204
|
+
build_repo2 do
|
205
|
+
build_gem "back_deps" do |s|
|
206
|
+
s.add_dependency "foo"
|
207
|
+
end
|
208
|
+
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
|
209
|
+
end
|
210
|
+
|
211
|
+
gemfile <<-G
|
212
|
+
source "#{source_uri}"
|
213
|
+
source "#{source_uri}/extra"
|
214
|
+
gem "back_deps"
|
215
|
+
G
|
216
|
+
|
217
|
+
bundle :install, :artifice => "endpoint_extra"
|
218
|
+
|
219
|
+
output = <<OUTPUT
|
220
|
+
Fetching gem metadata from http://localgemserver.test/..
|
221
|
+
Fetching gem metadata from http://localgemserver.test/extra/.
|
222
|
+
OUTPUT
|
223
|
+
out.should include(output)
|
224
|
+
end
|
225
|
+
|
226
|
+
it "does not fetch every specs if the index of gems is large when doing back deps" do
|
227
|
+
build_repo2 do
|
228
|
+
build_gem "back_deps" do |s|
|
229
|
+
s.add_dependency "foo"
|
230
|
+
end
|
231
|
+
build_gem "missing"
|
232
|
+
# need to hit the limit
|
233
|
+
1.upto(Bundler::Source::Rubygems::FORCE_MODERN_INDEX_LIMIT) do |i|
|
234
|
+
build_gem "gem#{i}"
|
235
|
+
end
|
236
|
+
|
237
|
+
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
|
238
|
+
end
|
239
|
+
|
240
|
+
gemfile <<-G
|
241
|
+
source "#{source_uri}"
|
242
|
+
source "#{source_uri}/extra"
|
243
|
+
gem "back_deps"
|
244
|
+
G
|
245
|
+
|
246
|
+
bundle :install, :artifice => "endpoint_extra_missing"
|
247
|
+
should_be_installed "back_deps 1.0"
|
248
|
+
end
|
249
|
+
|
250
|
+
it "uses the endpoint if all sources support it" do
|
251
|
+
gemfile <<-G
|
252
|
+
source "#{source_uri}"
|
253
|
+
|
254
|
+
gem 'foo'
|
255
|
+
G
|
256
|
+
|
257
|
+
bundle :install, :artifice => "endpoint_api_missing"
|
258
|
+
should_be_installed "foo 1.0"
|
259
|
+
end
|
260
|
+
|
261
|
+
it "fetches again when more dependencies are found in subsequent sources using --deployment" do
|
262
|
+
build_repo2 do
|
263
|
+
build_gem "back_deps" do |s|
|
264
|
+
s.add_dependency "foo"
|
265
|
+
end
|
266
|
+
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
|
267
|
+
end
|
268
|
+
|
269
|
+
gemfile <<-G
|
270
|
+
source "#{source_uri}"
|
271
|
+
source "#{source_uri}/extra"
|
272
|
+
gem "back_deps"
|
273
|
+
G
|
274
|
+
|
275
|
+
bundle :install, :artifice => "endpoint_extra"
|
276
|
+
|
277
|
+
bundle "install --deployment", :artifice => "endpoint_extra"
|
278
|
+
should_be_installed "back_deps 1.0"
|
279
|
+
end
|
280
|
+
|
281
|
+
it "does not refetch if the only unmet dependency is bundler" do
|
282
|
+
gemfile <<-G
|
283
|
+
source "#{source_uri}"
|
284
|
+
|
285
|
+
gem "bundler_dep"
|
286
|
+
G
|
287
|
+
|
288
|
+
bundle :install, :artifice => "endpoint"
|
289
|
+
out.should include("Fetching gem metadata from #{source_uri}")
|
290
|
+
end
|
291
|
+
|
292
|
+
it "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do
|
293
|
+
sudo "mkdir -p #{system_gem_path("bin")}"
|
294
|
+
sudo "chown -R root #{system_gem_path("bin")}"
|
295
|
+
|
296
|
+
gemfile <<-G
|
297
|
+
source "#{source_uri}"
|
298
|
+
gem "rails"
|
299
|
+
G
|
300
|
+
bundle :install, :artifice => "endpoint"
|
301
|
+
should_be_installed "rails 2.3.2"
|
302
|
+
end
|
303
|
+
|
304
|
+
it "installs the binstubs" do
|
305
|
+
gemfile <<-G
|
306
|
+
source "#{source_uri}"
|
307
|
+
gem "rack"
|
308
|
+
G
|
309
|
+
|
310
|
+
bundle "install --binstubs", :artifice => "endpoint"
|
311
|
+
|
312
|
+
gembin "rackup"
|
313
|
+
out.should == "1.0.0"
|
314
|
+
end
|
315
|
+
|
316
|
+
it "installs the bins when using --path and uses autoclean" do
|
317
|
+
gemfile <<-G
|
318
|
+
source "#{source_uri}"
|
319
|
+
gem "rack"
|
320
|
+
G
|
321
|
+
|
322
|
+
bundle "install --path vendor/bundle", :artifice => "endpoint"
|
323
|
+
|
324
|
+
vendored_gems("bin/rackup").should exist
|
325
|
+
end
|
326
|
+
|
327
|
+
it "installs the bins when using --path and uses bundle clean" do
|
328
|
+
gemfile <<-G
|
329
|
+
source "#{source_uri}"
|
330
|
+
gem "rack"
|
331
|
+
G
|
332
|
+
|
333
|
+
bundle "install --path vendor/bundle --no-clean", :artifice => "endpoint"
|
334
|
+
|
335
|
+
vendored_gems("bin/rackup").should exist
|
336
|
+
end
|
337
|
+
|
338
|
+
it "prints post_install_messages" do
|
339
|
+
gemfile <<-G
|
340
|
+
source "#{source_uri}"
|
341
|
+
gem 'rack-obama'
|
342
|
+
G
|
343
|
+
|
344
|
+
bundle :install, :artifice => "endpoint"
|
345
|
+
out.should include("Post-install message from rack:")
|
346
|
+
end
|
347
|
+
|
348
|
+
it "should display the post install message for a dependency" do
|
349
|
+
gemfile <<-G
|
350
|
+
source "#{source_uri}"
|
351
|
+
gem 'rack_middleware'
|
352
|
+
G
|
353
|
+
|
354
|
+
bundle :install, :artifice => "endpoint"
|
355
|
+
out.should include("Post-install message from rack:")
|
356
|
+
out.should include("Rack's post install message")
|
357
|
+
end
|
358
|
+
|
359
|
+
context "when using basic authentication" do
|
360
|
+
let(:user) { "user" }
|
361
|
+
let(:password) { "pass" }
|
362
|
+
let(:basic_auth_source_uri) do
|
363
|
+
uri = URI.parse(source_uri)
|
364
|
+
uri.user = user
|
365
|
+
uri.password = password
|
366
|
+
|
367
|
+
uri
|
368
|
+
end
|
369
|
+
|
370
|
+
it "passes basic authentication details and strips out creds" do
|
371
|
+
gemfile <<-G
|
372
|
+
source "#{basic_auth_source_uri}"
|
373
|
+
gem "rack"
|
374
|
+
G
|
375
|
+
|
376
|
+
bundle :install, :artifice => "endpoint_basic_authentication"
|
377
|
+
out.should_not include("#{user}:#{password}")
|
378
|
+
should_be_installed "rack 1.0.0"
|
379
|
+
end
|
380
|
+
|
381
|
+
it "strips http basic authentication creds for modern index" do
|
382
|
+
gemfile <<-G
|
383
|
+
source "#{basic_auth_source_uri}"
|
384
|
+
gem "rack"
|
385
|
+
G
|
386
|
+
|
387
|
+
bundle :install, :artifice => "endopint_marshal_fail_basic_authentication"
|
388
|
+
out.should_not include("#{user}:#{password}")
|
389
|
+
should_be_installed "rack 1.0.0"
|
390
|
+
end
|
391
|
+
|
392
|
+
it "strips http basic auth creds when it can't reach the server" do
|
393
|
+
gemfile <<-G
|
394
|
+
source "#{basic_auth_source_uri}"
|
395
|
+
gem "rack"
|
396
|
+
G
|
397
|
+
|
398
|
+
bundle :install, :artifice => "endpoint_500"
|
399
|
+
out.should_not include("#{user}:#{password}")
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install with ENV conditionals" do
|
4
|
+
describe "when just setting an ENV key as a string" do
|
5
|
+
before :each do
|
6
|
+
gemfile <<-G
|
7
|
+
source "file://#{gem_repo1}"
|
8
|
+
|
9
|
+
env "BUNDLER_TEST" do
|
10
|
+
gem "rack"
|
11
|
+
end
|
12
|
+
G
|
13
|
+
end
|
14
|
+
|
15
|
+
it "excludes the gems when the ENV variable is not set" do
|
16
|
+
bundle :install
|
17
|
+
should_not_be_installed "rack"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "includes the gems when the ENV variable is set" do
|
21
|
+
ENV['BUNDLER_TEST'] = '1'
|
22
|
+
bundle :install
|
23
|
+
should_be_installed "rack 1.0"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "when just setting an ENV key as a symbol" do
|
28
|
+
before :each do
|
29
|
+
gemfile <<-G
|
30
|
+
source "file://#{gem_repo1}"
|
31
|
+
|
32
|
+
env :BUNDLER_TEST do
|
33
|
+
gem "rack"
|
34
|
+
end
|
35
|
+
G
|
36
|
+
end
|
37
|
+
|
38
|
+
it "excludes the gems when the ENV variable is not set" do
|
39
|
+
bundle :install
|
40
|
+
should_not_be_installed "rack"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "includes the gems when the ENV variable is set" do
|
44
|
+
ENV['BUNDLER_TEST'] = '1'
|
45
|
+
bundle :install
|
46
|
+
should_be_installed "rack 1.0"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "when setting a string to match the env" do
|
51
|
+
before :each do
|
52
|
+
gemfile <<-G
|
53
|
+
source "file://#{gem_repo1}"
|
54
|
+
|
55
|
+
env "BUNDLER_TEST" => "foo" do
|
56
|
+
gem "rack"
|
57
|
+
end
|
58
|
+
G
|
59
|
+
end
|
60
|
+
|
61
|
+
it "excludes the gems when the ENV variable is not set" do
|
62
|
+
bundle :install
|
63
|
+
should_not_be_installed "rack"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "excludes the gems when the ENV variable is set but does not match the condition" do
|
67
|
+
ENV['BUNDLER_TEST'] = '1'
|
68
|
+
bundle :install
|
69
|
+
should_not_be_installed "rack"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "includes the gems when the ENV variable is set and matches the condition" do
|
73
|
+
ENV['BUNDLER_TEST'] = 'foo'
|
74
|
+
bundle :install
|
75
|
+
should_be_installed "rack 1.0"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "when setting a regex to match the env" do
|
80
|
+
before :each do
|
81
|
+
gemfile <<-G
|
82
|
+
source "file://#{gem_repo1}"
|
83
|
+
|
84
|
+
env "BUNDLER_TEST" => /foo/ do
|
85
|
+
gem "rack"
|
86
|
+
end
|
87
|
+
G
|
88
|
+
end
|
89
|
+
|
90
|
+
it "excludes the gems when the ENV variable is not set" do
|
91
|
+
bundle :install
|
92
|
+
should_not_be_installed "rack"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "excludes the gems when the ENV variable is set but does not match the condition" do
|
96
|
+
ENV['BUNDLER_TEST'] = 'fo'
|
97
|
+
bundle :install
|
98
|
+
should_not_be_installed "rack"
|
99
|
+
end
|
100
|
+
|
101
|
+
it "includes the gems when the ENV variable is set and matches the condition" do
|
102
|
+
ENV['BUNDLER_TEST'] = 'foobar'
|
103
|
+
bundle :install
|
104
|
+
should_be_installed "rack 1.0"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|