bundler 1.7.15 → 1.8.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +5 -14
- data/.rspec +1 -0
- data/.travis.yml +22 -15
- data/CHANGELOG.md +43 -13
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +14 -12
- data/DEVELOPMENT.md +4 -2
- data/ISSUES.md +1 -1
- data/README.md +10 -14
- data/Rakefile +10 -10
- data/bin/bundle +1 -1
- data/bundler.gemspec +5 -4
- data/lib/bundler.rb +22 -3
- data/lib/bundler/anonymizable_uri.rb +24 -8
- data/lib/bundler/cli.rb +103 -66
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/clean.rb +11 -4
- data/lib/bundler/cli/common.rb +2 -0
- data/lib/bundler/cli/console.rb +22 -26
- data/lib/bundler/cli/exec.rb +29 -22
- data/lib/bundler/cli/gem.rb +125 -37
- data/lib/bundler/cli/install.rb +22 -9
- data/lib/bundler/cli/outdated.rb +1 -1
- data/lib/bundler/cli/package.rb +8 -1
- data/lib/bundler/cli/show.rb +29 -3
- data/lib/bundler/cli/update.rb +2 -2
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/definition.rb +14 -22
- data/lib/bundler/dependency.rb +8 -1
- data/lib/bundler/dsl.rb +17 -4
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +44 -25
- data/lib/bundler/fetcher.rb +33 -25
- data/lib/bundler/friendly_errors.rb +38 -5
- data/lib/bundler/gem_helper.rb +16 -10
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/graph.rb +4 -1
- data/lib/bundler/index.rb +15 -25
- data/lib/bundler/installer.rb +6 -6
- data/lib/bundler/lockfile_parser.rb +7 -7
- data/lib/bundler/resolver.rb +2 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +1 -0
- data/lib/bundler/rubygems_integration.rb +1 -1
- data/lib/bundler/runtime.rb +22 -40
- data/lib/bundler/settings.rb +14 -5
- data/lib/bundler/setup.rb +2 -1
- data/lib/bundler/shared_helpers.rb +56 -4
- data/lib/bundler/source.rb +8 -9
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/git/git_proxy.rb +4 -0
- data/lib/bundler/source/path.rb +8 -11
- data/lib/bundler/source/path/installer.rb +0 -2
- data/lib/bundler/source/rubygems.rb +58 -72
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
- data/lib/bundler/templates/newgem/README.md.tt +9 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +73 -0
- data/man/bundle-config.ronn +17 -15
- data/man/bundle-install.ronn +102 -93
- data/man/bundle-update.ronn +39 -30
- data/man/bundle.ronn +6 -0
- data/man/gemfile.5.ronn +74 -13
- metadata +10 -231
- data/lib/bundler/parallel_workers.rb +0 -18
- data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
- data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
- data/lib/bundler/parallel_workers/worker.rb +0 -69
- data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
- data/spec/bundler/anonymizable_uri_spec.rb +0 -32
- data/spec/bundler/bundler_spec.rb +0 -72
- data/spec/bundler/cli_spec.rb +0 -16
- data/spec/bundler/definition_spec.rb +0 -22
- data/spec/bundler/dsl_spec.rb +0 -82
- data/spec/bundler/friendly_errors_spec.rb +0 -13
- data/spec/bundler/gem_helper_spec.rb +0 -226
- data/spec/bundler/psyched_yaml_spec.rb +0 -8
- data/spec/bundler/retry_spec.rb +0 -59
- data/spec/bundler/settings_spec.rb +0 -13
- data/spec/bundler/source/rubygems_spec.rb +0 -25
- data/spec/bundler/source_list_spec.rb +0 -361
- data/spec/cache/gems_spec.rb +0 -284
- data/spec/cache/git_spec.rb +0 -188
- data/spec/cache/path_spec.rb +0 -121
- data/spec/cache/platform_spec.rb +0 -57
- data/spec/commands/binstubs_spec.rb +0 -219
- data/spec/commands/check_spec.rb +0 -278
- data/spec/commands/clean_spec.rb +0 -592
- data/spec/commands/config_spec.rb +0 -263
- data/spec/commands/console_spec.rb +0 -76
- data/spec/commands/exec_spec.rb +0 -309
- data/spec/commands/help_spec.rb +0 -39
- data/spec/commands/init_spec.rb +0 -39
- data/spec/commands/inject_spec.rb +0 -78
- data/spec/commands/licenses_spec.rb +0 -18
- data/spec/commands/newgem_spec.rb +0 -428
- data/spec/commands/open_spec.rb +0 -68
- data/spec/commands/outdated_spec.rb +0 -156
- data/spec/commands/package_spec.rb +0 -114
- data/spec/commands/show_spec.rb +0 -125
- data/spec/install/binstubs_spec.rb +0 -24
- data/spec/install/bundler_spec.rb +0 -146
- data/spec/install/deploy_spec.rb +0 -250
- data/spec/install/gemfile/gemspec_spec.rb +0 -170
- data/spec/install/gemfile/git_spec.rb +0 -967
- data/spec/install/gemfile/path_spec.rb +0 -500
- data/spec/install/gemfile_spec.rb +0 -44
- data/spec/install/gems/c_ext_spec.rb +0 -48
- data/spec/install/gems/dependency_api_spec.rb +0 -652
- data/spec/install/gems/env_spec.rb +0 -107
- data/spec/install/gems/flex_spec.rb +0 -314
- data/spec/install/gems/groups_spec.rb +0 -308
- data/spec/install/gems/mirror_spec.rb +0 -39
- data/spec/install/gems/platform_spec.rb +0 -195
- data/spec/install/gems/post_install_spec.rb +0 -121
- data/spec/install/gems/resolving_spec.rb +0 -124
- data/spec/install/gems/simple_case_spec.rb +0 -377
- data/spec/install/gems/sources_spec.rb +0 -386
- data/spec/install/gems/standalone_spec.rb +0 -260
- data/spec/install/gems/sudo_spec.rb +0 -136
- data/spec/install/gems/win32_spec.rb +0 -26
- data/spec/install/gemspecs_spec.rb +0 -50
- data/spec/install/path_spec.rb +0 -150
- data/spec/install/post_bundle_message_spec.rb +0 -142
- data/spec/install/prereleases_spec.rb +0 -43
- data/spec/install/security_policy_spec.rb +0 -77
- data/spec/install/upgrade_spec.rb +0 -26
- data/spec/lock/git_spec.rb +0 -34
- data/spec/lock/lockfile_spec.rb +0 -924
- data/spec/other/bundle_ruby_spec.rb +0 -142
- data/spec/other/cli_dispatch_spec.rb +0 -21
- data/spec/other/ext_spec.rb +0 -60
- data/spec/other/platform_spec.rb +0 -1285
- data/spec/other/ssl_cert_spec.rb +0 -23
- data/spec/quality_spec.rb +0 -88
- data/spec/realworld/dependency_api_spec.rb +0 -60
- data/spec/realworld/edgecases_spec.rb +0 -212
- data/spec/realworld/parallel_spec.rb +0 -71
- data/spec/resolver/basic_spec.rb +0 -66
- data/spec/resolver/platform_spec.rb +0 -88
- data/spec/runtime/executable_spec.rb +0 -149
- data/spec/runtime/load_spec.rb +0 -107
- data/spec/runtime/platform_spec.rb +0 -90
- data/spec/runtime/require_spec.rb +0 -332
- data/spec/runtime/setup_spec.rb +0 -853
- data/spec/runtime/with_clean_env_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -123
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint.rb +0 -71
- data/spec/support/artifice/endpoint_500.rb +0 -37
- data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
- data/spec/support/artifice/endpoint_api_missing.rb +0 -16
- data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
- data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
- data/spec/support/artifice/endpoint_extra.rb +0 -31
- data/spec/support/artifice/endpoint_extra_api.rb +0 -32
- data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
- data/spec/support/artifice/endpoint_fallback.rb +0 -17
- data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
- data/spec/support/artifice/endpoint_redirect.rb +0 -15
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
- data/spec/support/artifice/endpoint_timeout.rb +0 -13
- data/spec/support/builders.rb +0 -693
- data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
- data/spec/support/fakeweb/windows.rb +0 -23
- data/spec/support/hax.rb +0 -22
- data/spec/support/helpers.rb +0 -361
- data/spec/support/indexes.rb +0 -280
- data/spec/support/matchers.rb +0 -77
- data/spec/support/path.rb +0 -85
- data/spec/support/permissions.rb +0 -10
- data/spec/support/platforms.rb +0 -94
- data/spec/support/ruby_ext.rb +0 -20
- data/spec/support/rubygems_ext.rb +0 -39
- data/spec/support/streams.rb +0 -13
- data/spec/support/sudo.rb +0 -16
- data/spec/update/gems_spec.rb +0 -201
- data/spec/update/git_spec.rb +0 -283
- data/spec/update/path_spec.rb +0 -18
@@ -1,332 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Bundler.require" do
|
4
|
-
before :each do
|
5
|
-
build_lib "one", "1.0.0" do |s|
|
6
|
-
s.write "lib/baz.rb", "puts 'baz'"
|
7
|
-
s.write "lib/qux.rb", "puts 'qux'"
|
8
|
-
end
|
9
|
-
|
10
|
-
build_lib "two", "1.0.0" do |s|
|
11
|
-
s.write "lib/two.rb", "puts 'two'"
|
12
|
-
s.add_dependency "three", "= 1.0.0"
|
13
|
-
end
|
14
|
-
|
15
|
-
build_lib "three", "1.0.0" do |s|
|
16
|
-
s.write "lib/three.rb", "puts 'three'"
|
17
|
-
s.add_dependency "seven", "= 1.0.0"
|
18
|
-
end
|
19
|
-
|
20
|
-
build_lib "four", "1.0.0" do |s|
|
21
|
-
s.write "lib/four.rb", "puts 'four'"
|
22
|
-
end
|
23
|
-
|
24
|
-
build_lib "five", "1.0.0", :no_default => true do |s|
|
25
|
-
s.write "lib/mofive.rb", "puts 'five'"
|
26
|
-
end
|
27
|
-
|
28
|
-
build_lib "six", "1.0.0" do |s|
|
29
|
-
s.write "lib/six.rb", "puts 'six'"
|
30
|
-
end
|
31
|
-
|
32
|
-
build_lib "seven", "1.0.0" do |s|
|
33
|
-
s.write "lib/seven.rb", "puts 'seven'"
|
34
|
-
end
|
35
|
-
|
36
|
-
build_lib "eight", "1.0.0" do |s|
|
37
|
-
s.write "lib/eight.rb", "puts 'eight'"
|
38
|
-
end
|
39
|
-
|
40
|
-
gemfile <<-G
|
41
|
-
path "#{lib_path}"
|
42
|
-
gem "one", :group => :bar, :require => %w(baz qux)
|
43
|
-
gem "two"
|
44
|
-
gem "three", :group => :not
|
45
|
-
gem "four", :require => false
|
46
|
-
gem "five"
|
47
|
-
gem "six", :group => "string"
|
48
|
-
gem "seven", :group => :not
|
49
|
-
gem "eight", :require => true, :group => :require_true
|
50
|
-
G
|
51
|
-
end
|
52
|
-
|
53
|
-
it "requires the gems" do
|
54
|
-
# default group
|
55
|
-
run "Bundler.require"
|
56
|
-
expect(out).to eq("two")
|
57
|
-
|
58
|
-
# specific group
|
59
|
-
run "Bundler.require(:bar)"
|
60
|
-
expect(out).to eq("baz\nqux")
|
61
|
-
|
62
|
-
# default and specific group
|
63
|
-
run "Bundler.require(:default, :bar)"
|
64
|
-
expect(out).to eq("baz\nqux\ntwo")
|
65
|
-
|
66
|
-
# specific group given as a string
|
67
|
-
run "Bundler.require('bar')"
|
68
|
-
expect(out).to eq("baz\nqux")
|
69
|
-
|
70
|
-
# specific group declared as a string
|
71
|
-
run "Bundler.require(:string)"
|
72
|
-
expect(out).to eq("six")
|
73
|
-
|
74
|
-
# required in resolver order instead of gemfile order
|
75
|
-
run("Bundler.require(:not)")
|
76
|
-
expect(out.split("\n").sort).to eq(['seven', 'three'])
|
77
|
-
|
78
|
-
# test require: true
|
79
|
-
run "Bundler.require(:require_true)"
|
80
|
-
expect(out).to eq("eight")
|
81
|
-
end
|
82
|
-
|
83
|
-
it "allows requiring gems with non standard names explicitly" do
|
84
|
-
run "Bundler.require ; require 'mofive'"
|
85
|
-
expect(out).to eq("two\nfive")
|
86
|
-
end
|
87
|
-
|
88
|
-
it "raises an exception if a require is specified but the file does not exist" do
|
89
|
-
gemfile <<-G
|
90
|
-
path "#{lib_path}"
|
91
|
-
gem "two", :require => 'fail'
|
92
|
-
G
|
93
|
-
|
94
|
-
load_error_run <<-R, 'fail'
|
95
|
-
Bundler.require
|
96
|
-
R
|
97
|
-
|
98
|
-
expect(err).to eq("ZOMG LOAD ERROR")
|
99
|
-
end
|
100
|
-
|
101
|
-
describe "with namespaced gems" do
|
102
|
-
before :each do
|
103
|
-
build_lib "jquery-rails", "1.0.0" do |s|
|
104
|
-
s.write "lib/jquery/rails.rb", "puts 'jquery/rails'"
|
105
|
-
end
|
106
|
-
lib_path('jquery-rails-1.0.0/lib/jquery-rails.rb').rmtree
|
107
|
-
end
|
108
|
-
|
109
|
-
it "requires gem names that are namespaced" do
|
110
|
-
gemfile <<-G
|
111
|
-
path '#{lib_path}'
|
112
|
-
gem 'jquery-rails'
|
113
|
-
G
|
114
|
-
|
115
|
-
run "Bundler.require"
|
116
|
-
expect(out).to eq("jquery/rails")
|
117
|
-
end
|
118
|
-
|
119
|
-
it "silently passes if the require fails" do
|
120
|
-
build_lib "bcrypt-ruby", "1.0.0", :no_default => true do |s|
|
121
|
-
s.write "lib/brcrypt.rb", "BCrypt = '1.0.0'"
|
122
|
-
end
|
123
|
-
gemfile <<-G
|
124
|
-
path "#{lib_path}"
|
125
|
-
gem "bcrypt-ruby"
|
126
|
-
G
|
127
|
-
|
128
|
-
cmd = <<-RUBY
|
129
|
-
require 'bundler'
|
130
|
-
Bundler.require
|
131
|
-
RUBY
|
132
|
-
ruby(cmd, :expect_err => true)
|
133
|
-
|
134
|
-
expect(err).to be_empty
|
135
|
-
end
|
136
|
-
|
137
|
-
it "does not mangle explictly given requires" do
|
138
|
-
gemfile <<-G
|
139
|
-
path "#{lib_path}"
|
140
|
-
gem 'jquery-rails', :require => 'jquery-rails'
|
141
|
-
G
|
142
|
-
|
143
|
-
load_error_run <<-R, 'jquery-rails'
|
144
|
-
Bundler.require
|
145
|
-
R
|
146
|
-
expect(err).to eq("ZOMG LOAD ERROR")
|
147
|
-
end
|
148
|
-
|
149
|
-
it "handles the case where regex fails" do
|
150
|
-
build_lib "load-fuuu", "1.0.0" do |s|
|
151
|
-
s.write "lib/load-fuuu.rb", "raise LoadError.new(\"Could not open library 'libfuuu-1.0': libfuuu-1.0: cannot open shared object file: No such file or directory.\")"
|
152
|
-
end
|
153
|
-
|
154
|
-
gemfile <<-G
|
155
|
-
path "#{lib_path}"
|
156
|
-
gem "load-fuuu"
|
157
|
-
G
|
158
|
-
|
159
|
-
cmd = <<-RUBY
|
160
|
-
begin
|
161
|
-
Bundler.require
|
162
|
-
rescue LoadError => e
|
163
|
-
$stderr.puts "ZOMG LOAD ERROR" if e.message.include?("Could not open library 'libfuuu-1.0'")
|
164
|
-
end
|
165
|
-
RUBY
|
166
|
-
run(cmd, :expect_err => true)
|
167
|
-
|
168
|
-
expect(err).to eq("ZOMG LOAD ERROR")
|
169
|
-
end
|
170
|
-
|
171
|
-
it "doesn't swallow the error when the library has an unrelated error" do
|
172
|
-
build_lib "load-fuuu", "1.0.0" do |s|
|
173
|
-
s.write "lib/load-fuuu.rb", "raise LoadError.new(\"cannot load such file -- load-bar\")"
|
174
|
-
end
|
175
|
-
|
176
|
-
gemfile <<-G
|
177
|
-
path "#{lib_path}"
|
178
|
-
gem "load-fuuu"
|
179
|
-
G
|
180
|
-
|
181
|
-
cmd = <<-RUBY
|
182
|
-
begin
|
183
|
-
Bundler.require
|
184
|
-
rescue LoadError => e
|
185
|
-
$stderr.puts "ZOMG LOAD ERROR: \#{e.message}"
|
186
|
-
end
|
187
|
-
RUBY
|
188
|
-
run(cmd, :expect_err => true)
|
189
|
-
|
190
|
-
expect(err).to eq("ZOMG LOAD ERROR: cannot load such file -- load-bar")
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe "using bundle exec" do
|
195
|
-
it "requires the locked gems" do
|
196
|
-
bundle "exec ruby -e 'Bundler.require'"
|
197
|
-
expect(out).to eq("two")
|
198
|
-
|
199
|
-
bundle "exec ruby -e 'Bundler.require(:bar)'"
|
200
|
-
expect(out).to eq("baz\nqux")
|
201
|
-
|
202
|
-
bundle "exec ruby -e 'Bundler.require(:default, :bar)'"
|
203
|
-
expect(out).to eq("baz\nqux\ntwo")
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe "order" do
|
208
|
-
before(:each) do
|
209
|
-
build_lib "one", "1.0.0" do |s|
|
210
|
-
s.write "lib/one.rb", <<-ONE
|
211
|
-
if defined?(Two)
|
212
|
-
Two.two
|
213
|
-
else
|
214
|
-
puts "two_not_loaded"
|
215
|
-
end
|
216
|
-
puts 'one'
|
217
|
-
ONE
|
218
|
-
end
|
219
|
-
|
220
|
-
build_lib "two", "1.0.0" do |s|
|
221
|
-
s.write "lib/two.rb", <<-TWO
|
222
|
-
module Two
|
223
|
-
def self.two
|
224
|
-
puts 'module_two'
|
225
|
-
end
|
226
|
-
end
|
227
|
-
puts 'two'
|
228
|
-
TWO
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
it "works when the gems are in the Gemfile in the correct order" do
|
233
|
-
gemfile <<-G
|
234
|
-
path "#{lib_path}"
|
235
|
-
gem "two"
|
236
|
-
gem "one"
|
237
|
-
G
|
238
|
-
|
239
|
-
run "Bundler.require"
|
240
|
-
expect(out).to eq("two\nmodule_two\none")
|
241
|
-
end
|
242
|
-
|
243
|
-
describe "a gem with different requires for different envs" do
|
244
|
-
before(:each) do
|
245
|
-
build_gem "multi_gem", :to_system => true do |s|
|
246
|
-
s.write "lib/one.rb", "puts 'ONE'"
|
247
|
-
s.write "lib/two.rb", "puts 'TWO'"
|
248
|
-
end
|
249
|
-
|
250
|
-
install_gemfile <<-G
|
251
|
-
gem "multi_gem", :require => "one", :group => :one
|
252
|
-
gem "multi_gem", :require => "two", :group => :two
|
253
|
-
G
|
254
|
-
end
|
255
|
-
|
256
|
-
it "requires both with Bundler.require(both)" do
|
257
|
-
run "Bundler.require(:one, :two)"
|
258
|
-
expect(out).to eq("ONE\nTWO")
|
259
|
-
end
|
260
|
-
|
261
|
-
it "requires one with Bundler.require(:one)" do
|
262
|
-
run "Bundler.require(:one)"
|
263
|
-
expect(out).to eq("ONE")
|
264
|
-
end
|
265
|
-
|
266
|
-
it "requires :two with Bundler.require(:two)" do
|
267
|
-
run "Bundler.require(:two)"
|
268
|
-
expect(out).to eq("TWO")
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
it "fails when the gems are in the Gemfile in the wrong order" do
|
273
|
-
gemfile <<-G
|
274
|
-
path "#{lib_path}"
|
275
|
-
gem "one"
|
276
|
-
gem "two"
|
277
|
-
G
|
278
|
-
|
279
|
-
run "Bundler.require"
|
280
|
-
expect(out).to eq("two_not_loaded\none\ntwo")
|
281
|
-
end
|
282
|
-
|
283
|
-
describe "with busted gems" do
|
284
|
-
it "should be busted" do
|
285
|
-
build_gem "busted_require", :to_system => true do |s|
|
286
|
-
s.write "lib/busted_require.rb", "require 'no_such_file_omg'"
|
287
|
-
end
|
288
|
-
|
289
|
-
install_gemfile <<-G
|
290
|
-
gem "busted_require"
|
291
|
-
G
|
292
|
-
|
293
|
-
load_error_run <<-R, 'no_such_file_omg'
|
294
|
-
Bundler.require
|
295
|
-
R
|
296
|
-
expect(err).to eq('ZOMG LOAD ERROR')
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
describe "Bundler.require with platform specific dependencies" do
|
303
|
-
it "does not require the gems that are pinned to other platforms" do
|
304
|
-
install_gemfile <<-G
|
305
|
-
source "file://#{gem_repo1}"
|
306
|
-
|
307
|
-
platforms :#{not_local_tag} do
|
308
|
-
gem "fail", :require => "omgomg"
|
309
|
-
end
|
310
|
-
|
311
|
-
gem "rack", "1.0.0"
|
312
|
-
G
|
313
|
-
|
314
|
-
run "Bundler.require", :expect_err => true
|
315
|
-
expect(err).to be_empty
|
316
|
-
end
|
317
|
-
|
318
|
-
it "requires gems pinned to multiple platforms, including the current one" do
|
319
|
-
install_gemfile <<-G
|
320
|
-
source "file://#{gem_repo1}"
|
321
|
-
|
322
|
-
platforms :#{not_local_tag}, :#{local_tag} do
|
323
|
-
gem "rack", :require => "rack"
|
324
|
-
end
|
325
|
-
G
|
326
|
-
|
327
|
-
run "Bundler.require; puts RACK", :expect_err => true
|
328
|
-
|
329
|
-
expect(out).to eq("1.0.0")
|
330
|
-
expect(err).to be_empty
|
331
|
-
end
|
332
|
-
end
|
data/spec/runtime/setup_spec.rb
DELETED
@@ -1,853 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "Bundler.setup" do
|
4
|
-
describe "with no arguments" do
|
5
|
-
it "makes all groups available" do
|
6
|
-
install_gemfile <<-G
|
7
|
-
source "file://#{gem_repo1}"
|
8
|
-
gem "rack", :group => :test
|
9
|
-
G
|
10
|
-
|
11
|
-
ruby <<-RUBY
|
12
|
-
require 'rubygems'
|
13
|
-
require 'bundler'
|
14
|
-
Bundler.setup
|
15
|
-
|
16
|
-
require 'rack'
|
17
|
-
puts RACK
|
18
|
-
RUBY
|
19
|
-
expect(err).to eq("")
|
20
|
-
expect(out).to eq("1.0.0")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "when called with groups" do
|
25
|
-
before(:each) do
|
26
|
-
install_gemfile <<-G
|
27
|
-
source "file://#{gem_repo1}"
|
28
|
-
gem "yard"
|
29
|
-
gem "rack", :group => :test
|
30
|
-
G
|
31
|
-
end
|
32
|
-
|
33
|
-
it "doesn't make all groups available" do
|
34
|
-
ruby <<-RUBY
|
35
|
-
require 'rubygems'
|
36
|
-
require 'bundler'
|
37
|
-
Bundler.setup(:default)
|
38
|
-
|
39
|
-
begin
|
40
|
-
require 'rack'
|
41
|
-
rescue LoadError
|
42
|
-
puts "WIN"
|
43
|
-
end
|
44
|
-
RUBY
|
45
|
-
expect(err).to eq("")
|
46
|
-
expect(out).to eq("WIN")
|
47
|
-
end
|
48
|
-
|
49
|
-
it "accepts string for group name" do
|
50
|
-
ruby <<-RUBY
|
51
|
-
require 'rubygems'
|
52
|
-
require 'bundler'
|
53
|
-
Bundler.setup(:default, 'test')
|
54
|
-
|
55
|
-
require 'rack'
|
56
|
-
puts RACK
|
57
|
-
RUBY
|
58
|
-
expect(err).to eq("")
|
59
|
-
expect(out).to eq("1.0.0")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "leaves all groups available if they were already" do
|
63
|
-
ruby <<-RUBY
|
64
|
-
require 'rubygems'
|
65
|
-
require 'bundler'
|
66
|
-
Bundler.setup
|
67
|
-
Bundler.setup(:default)
|
68
|
-
|
69
|
-
require 'rack'
|
70
|
-
puts RACK
|
71
|
-
RUBY
|
72
|
-
expect(err).to eq("")
|
73
|
-
expect(out).to eq("1.0.0")
|
74
|
-
end
|
75
|
-
|
76
|
-
it "leaves :default available if setup is called twice" do
|
77
|
-
ruby <<-RUBY
|
78
|
-
require 'rubygems'
|
79
|
-
require 'bundler'
|
80
|
-
Bundler.setup(:default)
|
81
|
-
Bundler.setup(:default, :test)
|
82
|
-
|
83
|
-
begin
|
84
|
-
require 'yard'
|
85
|
-
puts "WIN"
|
86
|
-
rescue LoadError
|
87
|
-
puts "FAIL"
|
88
|
-
end
|
89
|
-
RUBY
|
90
|
-
expect(err).to eq("")
|
91
|
-
expect(out).to match("WIN")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it "raises if the Gemfile was not yet installed" do
|
96
|
-
gemfile <<-G
|
97
|
-
source "file://#{gem_repo1}"
|
98
|
-
gem "rack"
|
99
|
-
G
|
100
|
-
|
101
|
-
ruby <<-R
|
102
|
-
require 'rubygems'
|
103
|
-
require 'bundler'
|
104
|
-
|
105
|
-
begin
|
106
|
-
Bundler.setup
|
107
|
-
puts "FAIL"
|
108
|
-
rescue Bundler::GemNotFound
|
109
|
-
puts "WIN"
|
110
|
-
end
|
111
|
-
R
|
112
|
-
|
113
|
-
expect(out).to eq("WIN")
|
114
|
-
end
|
115
|
-
|
116
|
-
it "doesn't create a Gemfile.lock if the setup fails" do
|
117
|
-
gemfile <<-G
|
118
|
-
source "file://#{gem_repo1}"
|
119
|
-
gem "rack"
|
120
|
-
G
|
121
|
-
|
122
|
-
ruby <<-R, :expect_err => true
|
123
|
-
require 'rubygems'
|
124
|
-
require 'bundler'
|
125
|
-
|
126
|
-
Bundler.setup
|
127
|
-
R
|
128
|
-
|
129
|
-
expect(bundled_app("Gemfile.lock")).not_to exist
|
130
|
-
end
|
131
|
-
|
132
|
-
it "doesn't change the Gemfile.lock if the setup fails" do
|
133
|
-
install_gemfile <<-G
|
134
|
-
source "file://#{gem_repo1}"
|
135
|
-
gem "rack"
|
136
|
-
G
|
137
|
-
|
138
|
-
lockfile = File.read(bundled_app("Gemfile.lock"))
|
139
|
-
|
140
|
-
gemfile <<-G
|
141
|
-
source "file://#{gem_repo1}"
|
142
|
-
gem "rack"
|
143
|
-
gem "nosuchgem", "10.0"
|
144
|
-
G
|
145
|
-
|
146
|
-
ruby <<-R, :expect_err => true
|
147
|
-
require 'rubygems'
|
148
|
-
require 'bundler'
|
149
|
-
|
150
|
-
Bundler.setup
|
151
|
-
R
|
152
|
-
|
153
|
-
expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile)
|
154
|
-
end
|
155
|
-
|
156
|
-
it "makes a Gemfile.lock if setup succeeds" do
|
157
|
-
install_gemfile <<-G
|
158
|
-
source "file://#{gem_repo1}"
|
159
|
-
gem "rack"
|
160
|
-
G
|
161
|
-
|
162
|
-
File.read(bundled_app("Gemfile.lock"))
|
163
|
-
|
164
|
-
FileUtils.rm(bundled_app("Gemfile.lock"))
|
165
|
-
|
166
|
-
run "1"
|
167
|
-
expect(bundled_app("Gemfile.lock")).to exist
|
168
|
-
end
|
169
|
-
|
170
|
-
it "uses BUNDLE_GEMFILE to locate the gemfile if present" do
|
171
|
-
gemfile <<-G
|
172
|
-
source "file://#{gem_repo1}"
|
173
|
-
gem "rack"
|
174
|
-
G
|
175
|
-
|
176
|
-
gemfile bundled_app('4realz'), <<-G
|
177
|
-
source "file://#{gem_repo1}"
|
178
|
-
gem "activesupport", "2.3.5"
|
179
|
-
G
|
180
|
-
|
181
|
-
ENV['BUNDLE_GEMFILE'] = bundled_app('4realz').to_s
|
182
|
-
bundle :install
|
183
|
-
|
184
|
-
should_be_installed "activesupport 2.3.5"
|
185
|
-
end
|
186
|
-
|
187
|
-
it "prioritizes gems in BUNDLE_PATH over gems in GEM_HOME" do
|
188
|
-
ENV['BUNDLE_PATH'] = bundled_app('.bundle').to_s
|
189
|
-
install_gemfile <<-G
|
190
|
-
source "file://#{gem_repo1}"
|
191
|
-
gem "rack", "1.0.0"
|
192
|
-
G
|
193
|
-
|
194
|
-
build_gem "rack", "1.0", :to_system => true do |s|
|
195
|
-
s.write "lib/rack.rb", "RACK = 'FAIL'"
|
196
|
-
end
|
197
|
-
|
198
|
-
should_be_installed "rack 1.0.0"
|
199
|
-
end
|
200
|
-
|
201
|
-
describe "integrate with rubygems" do
|
202
|
-
describe "by replacing #gem" do
|
203
|
-
before :each do
|
204
|
-
install_gemfile <<-G
|
205
|
-
source "file://#{gem_repo1}"
|
206
|
-
gem "rack", "0.9.1"
|
207
|
-
G
|
208
|
-
end
|
209
|
-
|
210
|
-
it "replaces #gem but raises when the gem is missing" do
|
211
|
-
run <<-R
|
212
|
-
begin
|
213
|
-
gem "activesupport"
|
214
|
-
puts "FAIL"
|
215
|
-
rescue LoadError
|
216
|
-
puts "WIN"
|
217
|
-
end
|
218
|
-
R
|
219
|
-
|
220
|
-
expect(out).to eq("WIN")
|
221
|
-
end
|
222
|
-
|
223
|
-
it "version_requirement is now deprecated in rubygems 1.4.0+ when gem is missing" do
|
224
|
-
run <<-R, :expect_err => true
|
225
|
-
begin
|
226
|
-
gem "activesupport"
|
227
|
-
puts "FAIL"
|
228
|
-
rescue LoadError
|
229
|
-
puts "WIN"
|
230
|
-
end
|
231
|
-
R
|
232
|
-
|
233
|
-
expect(err).to be_empty
|
234
|
-
end
|
235
|
-
|
236
|
-
it "replaces #gem but raises when the version is wrong" do
|
237
|
-
run <<-R
|
238
|
-
begin
|
239
|
-
gem "rack", "1.0.0"
|
240
|
-
puts "FAIL"
|
241
|
-
rescue LoadError
|
242
|
-
puts "WIN"
|
243
|
-
end
|
244
|
-
R
|
245
|
-
|
246
|
-
expect(out).to eq("WIN")
|
247
|
-
end
|
248
|
-
|
249
|
-
it "version_requirement is now deprecated in rubygems 1.4.0+ when the version is wrong" do
|
250
|
-
run <<-R, :expect_err => true
|
251
|
-
begin
|
252
|
-
gem "rack", "1.0.0"
|
253
|
-
puts "FAIL"
|
254
|
-
rescue LoadError
|
255
|
-
puts "WIN"
|
256
|
-
end
|
257
|
-
R
|
258
|
-
|
259
|
-
expect(err).to be_empty
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
describe "by hiding system gems" do
|
264
|
-
before :each do
|
265
|
-
system_gems "activesupport-2.3.5"
|
266
|
-
install_gemfile <<-G
|
267
|
-
source "file://#{gem_repo1}"
|
268
|
-
gem "yard"
|
269
|
-
G
|
270
|
-
end
|
271
|
-
|
272
|
-
it "removes system gems from Gem.source_index" do
|
273
|
-
run "require 'yard'"
|
274
|
-
expect(out).to eq("bundler-#{Bundler::VERSION}\nyard-1.0")
|
275
|
-
end
|
276
|
-
|
277
|
-
context "when the ruby stdlib is a substring of Gem.path" do
|
278
|
-
it "does not reject the stdlib from $LOAD_PATH" do
|
279
|
-
substring = "/" + $LOAD_PATH.find{|p| p =~ /vendor_ruby/ }.split("/")[2]
|
280
|
-
run "puts 'worked!'", :env => {"GEM_PATH" => substring}
|
281
|
-
expect(out).to eq("worked!")
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
describe "with paths" do
|
288
|
-
it "activates the gems in the path source" do
|
289
|
-
system_gems "rack-1.0.0"
|
290
|
-
|
291
|
-
build_lib "rack", "1.0.0" do |s|
|
292
|
-
s.write "lib/rack.rb", "puts 'WIN'"
|
293
|
-
end
|
294
|
-
|
295
|
-
gemfile <<-G
|
296
|
-
path "#{lib_path('rack-1.0.0')}"
|
297
|
-
source "file://#{gem_repo1}"
|
298
|
-
gem "rack"
|
299
|
-
G
|
300
|
-
|
301
|
-
run "require 'rack'"
|
302
|
-
expect(out).to eq("WIN")
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
describe "with git" do
|
307
|
-
before do
|
308
|
-
build_git "rack", "1.0.0"
|
309
|
-
|
310
|
-
gemfile <<-G
|
311
|
-
gem "rack", :git => "#{lib_path('rack-1.0.0')}"
|
312
|
-
G
|
313
|
-
end
|
314
|
-
|
315
|
-
it "provides a useful exception when the git repo is not checked out yet" do
|
316
|
-
run "1", :expect_err => true
|
317
|
-
expect(err).to match(/the git source #{lib_path('rack-1.0.0')} is not yet checked out. Please run `bundle install`/i)
|
318
|
-
end
|
319
|
-
|
320
|
-
it "does not hit the git binary if the lockfile is available and up to date" do
|
321
|
-
bundle "install"
|
322
|
-
|
323
|
-
break_git!
|
324
|
-
|
325
|
-
ruby <<-R
|
326
|
-
require 'rubygems'
|
327
|
-
require 'bundler'
|
328
|
-
|
329
|
-
begin
|
330
|
-
Bundler.setup
|
331
|
-
puts "WIN"
|
332
|
-
rescue Exception => e
|
333
|
-
puts "FAIL"
|
334
|
-
end
|
335
|
-
R
|
336
|
-
|
337
|
-
expect(out).to eq("WIN")
|
338
|
-
end
|
339
|
-
|
340
|
-
it "provides a good exception if the lockfile is unavailable" do
|
341
|
-
bundle "install"
|
342
|
-
|
343
|
-
FileUtils.rm(bundled_app("Gemfile.lock"))
|
344
|
-
|
345
|
-
break_git!
|
346
|
-
|
347
|
-
ruby <<-R
|
348
|
-
require "rubygems"
|
349
|
-
require "bundler"
|
350
|
-
|
351
|
-
begin
|
352
|
-
Bundler.setup
|
353
|
-
puts "FAIL"
|
354
|
-
rescue Bundler::GitError => e
|
355
|
-
puts e.message
|
356
|
-
end
|
357
|
-
R
|
358
|
-
|
359
|
-
run "puts 'FAIL'", :expect_err => true
|
360
|
-
|
361
|
-
expect(err).not_to include "This is not the git you are looking for"
|
362
|
-
end
|
363
|
-
|
364
|
-
it "works even when the cache directory has been deleted" do
|
365
|
-
bundle "install --path vendor/bundle"
|
366
|
-
FileUtils.rm_rf vendored_gems('cache')
|
367
|
-
should_be_installed "rack 1.0.0"
|
368
|
-
end
|
369
|
-
|
370
|
-
it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do
|
371
|
-
bundle "install --path vendor/bundle"
|
372
|
-
|
373
|
-
with_read_only("**/*") do
|
374
|
-
should_be_installed "rack 1.0.0"
|
375
|
-
end
|
376
|
-
end
|
377
|
-
|
378
|
-
it "finds git gem when default bundle path becomes read only" do
|
379
|
-
bundle "install"
|
380
|
-
|
381
|
-
with_read_only("#{Bundler.bundle_path}/**/*") do
|
382
|
-
should_be_installed "rack 1.0.0"
|
383
|
-
end
|
384
|
-
end
|
385
|
-
end
|
386
|
-
|
387
|
-
describe "when specifying local override" do
|
388
|
-
it "explodes if given path does not exist on runtime" do
|
389
|
-
build_git "rack", "0.8"
|
390
|
-
|
391
|
-
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
392
|
-
|
393
|
-
gemfile <<-G
|
394
|
-
source "file://#{gem_repo1}"
|
395
|
-
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "master"
|
396
|
-
G
|
397
|
-
|
398
|
-
bundle %|config local.rack #{lib_path('local-rack')}|
|
399
|
-
bundle :install
|
400
|
-
expect(out).to match(/at #{lib_path('local-rack')}/)
|
401
|
-
|
402
|
-
FileUtils.rm_rf(lib_path('local-rack'))
|
403
|
-
run "require 'rack'", :expect_err => true
|
404
|
-
expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
|
405
|
-
end
|
406
|
-
|
407
|
-
it "explodes if branch is not given on runtime" do
|
408
|
-
build_git "rack", "0.8"
|
409
|
-
|
410
|
-
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
411
|
-
|
412
|
-
gemfile <<-G
|
413
|
-
source "file://#{gem_repo1}"
|
414
|
-
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "master"
|
415
|
-
G
|
416
|
-
|
417
|
-
bundle %|config local.rack #{lib_path('local-rack')}|
|
418
|
-
bundle :install
|
419
|
-
expect(out).to match(/at #{lib_path('local-rack')}/)
|
420
|
-
|
421
|
-
gemfile <<-G
|
422
|
-
source "file://#{gem_repo1}"
|
423
|
-
gem "rack", :git => "#{lib_path('rack-0.8')}"
|
424
|
-
G
|
425
|
-
|
426
|
-
run "require 'rack'", :expect_err => true
|
427
|
-
expect(err).to match(/because :branch is not specified in Gemfile/)
|
428
|
-
end
|
429
|
-
|
430
|
-
it "explodes on different branches on runtime" do
|
431
|
-
build_git "rack", "0.8"
|
432
|
-
|
433
|
-
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
434
|
-
|
435
|
-
gemfile <<-G
|
436
|
-
source "file://#{gem_repo1}"
|
437
|
-
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "master"
|
438
|
-
G
|
439
|
-
|
440
|
-
bundle %|config local.rack #{lib_path('local-rack')}|
|
441
|
-
bundle :install
|
442
|
-
expect(out).to match(/at #{lib_path('local-rack')}/)
|
443
|
-
|
444
|
-
gemfile <<-G
|
445
|
-
source "file://#{gem_repo1}"
|
446
|
-
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "changed"
|
447
|
-
G
|
448
|
-
|
449
|
-
run "require 'rack'", :expect_err => true
|
450
|
-
expect(err).to match(/is using branch master but Gemfile specifies changed/)
|
451
|
-
end
|
452
|
-
|
453
|
-
it "explodes on refs with different branches on runtime" do
|
454
|
-
build_git "rack", "0.8"
|
455
|
-
|
456
|
-
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
457
|
-
|
458
|
-
install_gemfile <<-G
|
459
|
-
source "file://#{gem_repo1}"
|
460
|
-
gem "rack", :git => "#{lib_path('rack-0.8')}", :ref => "master", :branch => "master"
|
461
|
-
G
|
462
|
-
|
463
|
-
gemfile <<-G
|
464
|
-
source "file://#{gem_repo1}"
|
465
|
-
gem "rack", :git => "#{lib_path('rack-0.8')}", :ref => "master", :branch => "nonexistant"
|
466
|
-
G
|
467
|
-
|
468
|
-
bundle %|config local.rack #{lib_path('local-rack')}|
|
469
|
-
run "require 'rack'", :expect_err => true
|
470
|
-
expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
|
471
|
-
end
|
472
|
-
end
|
473
|
-
|
474
|
-
describe "when excluding groups" do
|
475
|
-
it "doesn't change the resolve if --without is used" do
|
476
|
-
install_gemfile <<-G, :without => :rails
|
477
|
-
source "file://#{gem_repo1}"
|
478
|
-
gem "activesupport"
|
479
|
-
|
480
|
-
group :rails do
|
481
|
-
gem "rails", "2.3.2"
|
482
|
-
end
|
483
|
-
G
|
484
|
-
|
485
|
-
install_gems "activesupport-2.3.5"
|
486
|
-
|
487
|
-
should_be_installed "activesupport 2.3.2", :groups => :default
|
488
|
-
end
|
489
|
-
|
490
|
-
it "remembers --without and does not bail on bare Bundler.setup" do
|
491
|
-
install_gemfile <<-G, :without => :rails
|
492
|
-
source "file://#{gem_repo1}"
|
493
|
-
gem "activesupport"
|
494
|
-
|
495
|
-
group :rails do
|
496
|
-
gem "rails", "2.3.2"
|
497
|
-
end
|
498
|
-
G
|
499
|
-
|
500
|
-
install_gems "activesupport-2.3.5"
|
501
|
-
|
502
|
-
should_be_installed "activesupport 2.3.2"
|
503
|
-
end
|
504
|
-
|
505
|
-
it "remembers --without and does not include groups passed to Bundler.setup" do
|
506
|
-
install_gemfile <<-G, :without => :rails
|
507
|
-
source "file://#{gem_repo1}"
|
508
|
-
gem "activesupport"
|
509
|
-
|
510
|
-
group :rack do
|
511
|
-
gem "rack"
|
512
|
-
end
|
513
|
-
|
514
|
-
group :rails do
|
515
|
-
gem "rails", "2.3.2"
|
516
|
-
end
|
517
|
-
G
|
518
|
-
|
519
|
-
should_not_be_installed "activesupport 2.3.2", :groups => :rack
|
520
|
-
should_be_installed "rack 1.0.0", :groups => :rack
|
521
|
-
end
|
522
|
-
end
|
523
|
-
|
524
|
-
# Unfortunately, gem_prelude does not record the information about
|
525
|
-
# activated gems, so this test cannot work on 1.9 :(
|
526
|
-
if RUBY_VERSION < "1.9"
|
527
|
-
describe "preactivated gems" do
|
528
|
-
it "raises an exception if a pre activated gem conflicts with the bundle" do
|
529
|
-
system_gems "thin-1.0", "rack-1.0.0"
|
530
|
-
build_gem "thin", "1.1", :to_system => true do |s|
|
531
|
-
s.add_dependency "rack"
|
532
|
-
end
|
533
|
-
|
534
|
-
gemfile <<-G
|
535
|
-
gem "thin", "1.0"
|
536
|
-
G
|
537
|
-
|
538
|
-
ruby <<-R
|
539
|
-
require 'rubygems'
|
540
|
-
gem "thin"
|
541
|
-
require 'bundler'
|
542
|
-
begin
|
543
|
-
Bundler.setup
|
544
|
-
puts "FAIL"
|
545
|
-
rescue Gem::LoadError => e
|
546
|
-
puts e.message
|
547
|
-
end
|
548
|
-
R
|
549
|
-
|
550
|
-
expect(out).to eq("You have already activated thin 1.1, but your Gemfile requires thin 1.0. Prepending `bundle exec` to your command may solve this.")
|
551
|
-
end
|
552
|
-
|
553
|
-
it "version_requirement is now deprecated in rubygems 1.4.0+" do
|
554
|
-
system_gems "thin-1.0", "rack-1.0.0"
|
555
|
-
build_gem "thin", "1.1", :to_system => true do |s|
|
556
|
-
s.add_dependency "rack"
|
557
|
-
end
|
558
|
-
|
559
|
-
gemfile <<-G
|
560
|
-
gem "thin", "1.0"
|
561
|
-
G
|
562
|
-
|
563
|
-
ruby <<-R, :expect_err => true
|
564
|
-
require 'rubygems'
|
565
|
-
gem "thin"
|
566
|
-
require 'bundler'
|
567
|
-
begin
|
568
|
-
Bundler.setup
|
569
|
-
puts "FAIL"
|
570
|
-
rescue Gem::LoadError => e
|
571
|
-
puts e.message
|
572
|
-
end
|
573
|
-
R
|
574
|
-
|
575
|
-
expect(err).to be_empty
|
576
|
-
end
|
577
|
-
end
|
578
|
-
end
|
579
|
-
|
580
|
-
# Rubygems returns loaded_from as a string
|
581
|
-
it "has loaded_from as a string on all specs" do
|
582
|
-
build_git "foo"
|
583
|
-
build_git "no-gemspec", :gemspec => false
|
584
|
-
|
585
|
-
install_gemfile <<-G
|
586
|
-
source "file://#{gem_repo1}"
|
587
|
-
gem "rack"
|
588
|
-
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
589
|
-
gem "no-gemspec", "1.0", :git => "#{lib_path('no-gemspec-1.0')}"
|
590
|
-
G
|
591
|
-
|
592
|
-
run <<-R
|
593
|
-
Gem.loaded_specs.each do |n, s|
|
594
|
-
puts "FAIL" unless s.loaded_from.is_a?(String)
|
595
|
-
end
|
596
|
-
R
|
597
|
-
|
598
|
-
expect(out).to be_empty
|
599
|
-
end
|
600
|
-
|
601
|
-
it "ignores empty gem paths" do
|
602
|
-
install_gemfile <<-G
|
603
|
-
source "file://#{gem_repo1}"
|
604
|
-
gem "rack"
|
605
|
-
G
|
606
|
-
|
607
|
-
ENV["GEM_HOME"] = ""
|
608
|
-
bundle %{exec ruby -e "require 'set'"}
|
609
|
-
|
610
|
-
expect(err).to be_empty
|
611
|
-
end
|
612
|
-
|
613
|
-
it "should prepend gemspec require paths to $LOAD_PATH in order" do
|
614
|
-
update_repo2 do
|
615
|
-
build_gem("requirepaths") do |s|
|
616
|
-
s.write("lib/rq.rb", "puts 'yay'")
|
617
|
-
s.write("src/rq.rb", "puts 'nooo'")
|
618
|
-
s.require_paths = ["lib", "src"]
|
619
|
-
end
|
620
|
-
end
|
621
|
-
|
622
|
-
install_gemfile <<-G
|
623
|
-
source "file://#{gem_repo2}"
|
624
|
-
gem "requirepaths", :require => nil
|
625
|
-
G
|
626
|
-
|
627
|
-
run "require 'rq'"
|
628
|
-
expect(out).to eq("yay")
|
629
|
-
end
|
630
|
-
|
631
|
-
it "stubs out Gem.refresh so it does not reveal system gems" do
|
632
|
-
system_gems "rack-1.0.0"
|
633
|
-
|
634
|
-
install_gemfile <<-G
|
635
|
-
source "file://#{gem_repo1}"
|
636
|
-
gem "activesupport"
|
637
|
-
G
|
638
|
-
|
639
|
-
run <<-R
|
640
|
-
puts Bundler.rubygems.find_name("rack").inspect
|
641
|
-
Gem.refresh
|
642
|
-
puts Bundler.rubygems.find_name("rack").inspect
|
643
|
-
R
|
644
|
-
|
645
|
-
expect(out).to eq("[]\n[]")
|
646
|
-
end
|
647
|
-
|
648
|
-
describe "when a vendored gem specification uses the :path option" do
|
649
|
-
it "should resolve paths relative to the Gemfile" do
|
650
|
-
path = bundled_app(File.join('vendor', 'foo'))
|
651
|
-
build_lib "foo", :path => path
|
652
|
-
|
653
|
-
# If the .gemspec exists, then Bundler handles the path differently.
|
654
|
-
# See Source::Path.load_spec_files for details.
|
655
|
-
FileUtils.rm(File.join(path, 'foo.gemspec'))
|
656
|
-
|
657
|
-
install_gemfile <<-G
|
658
|
-
gem 'foo', '1.2.3', :path => 'vendor/foo'
|
659
|
-
G
|
660
|
-
|
661
|
-
Dir.chdir(bundled_app.parent) do
|
662
|
-
run <<-R, :env => {"BUNDLE_GEMFILE" => bundled_app('Gemfile')}
|
663
|
-
require 'foo'
|
664
|
-
R
|
665
|
-
end
|
666
|
-
expect(err).to eq("")
|
667
|
-
end
|
668
|
-
|
669
|
-
it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
|
670
|
-
relative_path = File.join('vendor', Dir.pwd[1..-1], 'foo')
|
671
|
-
absolute_path = bundled_app(relative_path)
|
672
|
-
FileUtils.mkdir_p(absolute_path)
|
673
|
-
build_lib "foo", :path => absolute_path
|
674
|
-
|
675
|
-
# If the .gemspec exists, then Bundler handles the path differently.
|
676
|
-
# See Source::Path.load_spec_files for details.
|
677
|
-
FileUtils.rm(File.join(absolute_path, 'foo.gemspec'))
|
678
|
-
|
679
|
-
gemfile <<-G
|
680
|
-
gem 'foo', '1.2.3', :path => '#{relative_path}'
|
681
|
-
G
|
682
|
-
|
683
|
-
bundle :install
|
684
|
-
|
685
|
-
Dir.chdir(bundled_app.parent) do
|
686
|
-
run <<-R, :env => {"BUNDLE_GEMFILE" => bundled_app('Gemfile')}
|
687
|
-
require 'foo'
|
688
|
-
R
|
689
|
-
end
|
690
|
-
|
691
|
-
expect(err).to eq("")
|
692
|
-
end
|
693
|
-
end
|
694
|
-
|
695
|
-
describe "with git gems that don't have gemspecs" do
|
696
|
-
before :each do
|
697
|
-
build_git "no-gemspec", :gemspec => false
|
698
|
-
|
699
|
-
install_gemfile <<-G
|
700
|
-
gem "no-gemspec", "1.0", :git => "#{lib_path('no-gemspec-1.0')}"
|
701
|
-
G
|
702
|
-
end
|
703
|
-
|
704
|
-
it "loads the library via a virtual spec" do
|
705
|
-
run <<-R
|
706
|
-
require 'no-gemspec'
|
707
|
-
puts NOGEMSPEC
|
708
|
-
R
|
709
|
-
|
710
|
-
expect(out).to eq("1.0")
|
711
|
-
end
|
712
|
-
end
|
713
|
-
|
714
|
-
describe "with bundled and system gems" do
|
715
|
-
before :each do
|
716
|
-
system_gems "rack-1.0.0"
|
717
|
-
|
718
|
-
install_gemfile <<-G
|
719
|
-
source "file://#{gem_repo1}"
|
720
|
-
|
721
|
-
gem "activesupport", "2.3.5"
|
722
|
-
G
|
723
|
-
end
|
724
|
-
|
725
|
-
it "does not pull in system gems" do
|
726
|
-
run <<-R
|
727
|
-
require 'rubygems'
|
728
|
-
|
729
|
-
begin;
|
730
|
-
require 'rack'
|
731
|
-
rescue LoadError
|
732
|
-
puts 'WIN'
|
733
|
-
end
|
734
|
-
R
|
735
|
-
|
736
|
-
expect(out).to eq("WIN")
|
737
|
-
end
|
738
|
-
|
739
|
-
it "provides a gem method" do
|
740
|
-
run <<-R
|
741
|
-
gem 'activesupport'
|
742
|
-
require 'activesupport'
|
743
|
-
puts ACTIVESUPPORT
|
744
|
-
R
|
745
|
-
|
746
|
-
expect(out).to eq("2.3.5")
|
747
|
-
end
|
748
|
-
|
749
|
-
it "raises an exception if gem is used to invoke a system gem not in the bundle" do
|
750
|
-
run <<-R
|
751
|
-
begin
|
752
|
-
gem 'rack'
|
753
|
-
rescue LoadError => e
|
754
|
-
puts e.message
|
755
|
-
end
|
756
|
-
R
|
757
|
-
|
758
|
-
expect(out).to eq("rack is not part of the bundle. Add it to Gemfile.")
|
759
|
-
end
|
760
|
-
|
761
|
-
it "sets GEM_HOME appropriately" do
|
762
|
-
run "puts ENV['GEM_HOME']"
|
763
|
-
expect(out).to eq(default_bundle_path.to_s)
|
764
|
-
end
|
765
|
-
end
|
766
|
-
|
767
|
-
describe "with system gems in the bundle" do
|
768
|
-
before :each do
|
769
|
-
system_gems "rack-1.0.0"
|
770
|
-
|
771
|
-
install_gemfile <<-G
|
772
|
-
source "file://#{gem_repo1}"
|
773
|
-
gem "rack", "1.0.0"
|
774
|
-
gem "activesupport", "2.3.5"
|
775
|
-
G
|
776
|
-
end
|
777
|
-
|
778
|
-
it "sets GEM_PATH appropriately" do
|
779
|
-
run "puts Gem.path"
|
780
|
-
paths = out.split("\n")
|
781
|
-
expect(paths).to include(system_gem_path.to_s)
|
782
|
-
expect(paths).to include(default_bundle_path.to_s)
|
783
|
-
end
|
784
|
-
end
|
785
|
-
|
786
|
-
describe "with a gemspec that requires other files" do
|
787
|
-
before :each do
|
788
|
-
build_git "bar", :gemspec => false do |s|
|
789
|
-
s.write "lib/bar/version.rb", %{BAR_VERSION = '1.0'}
|
790
|
-
s.write "bar.gemspec", <<-G
|
791
|
-
lib = File.expand_path('../lib/', __FILE__)
|
792
|
-
$:.unshift lib unless $:.include?(lib)
|
793
|
-
require 'bar/version'
|
794
|
-
|
795
|
-
Gem::Specification.new do |s|
|
796
|
-
s.name = 'bar'
|
797
|
-
s.version = BAR_VERSION
|
798
|
-
s.summary = 'Bar'
|
799
|
-
s.files = Dir["lib/**/*.rb"]
|
800
|
-
end
|
801
|
-
G
|
802
|
-
end
|
803
|
-
|
804
|
-
gemfile <<-G
|
805
|
-
gem "bar", :git => "#{lib_path('bar-1.0')}"
|
806
|
-
G
|
807
|
-
end
|
808
|
-
|
809
|
-
it "evals each gemspec in the context of its parent directory" do
|
810
|
-
bundle :install
|
811
|
-
run "require 'bar'; puts BAR"
|
812
|
-
expect(out).to eq("1.0")
|
813
|
-
end
|
814
|
-
|
815
|
-
it "error intelligently if the gemspec has a LoadError" do
|
816
|
-
update_git "bar", :gemspec => false do |s|
|
817
|
-
s.write "bar.gemspec", "require 'foobarbaz'"
|
818
|
-
end
|
819
|
-
bundle :install
|
820
|
-
expect(out).to include("was a LoadError while loading bar.gemspec")
|
821
|
-
expect(out).to include("foobarbaz")
|
822
|
-
expect(out).to include("bar.gemspec:1")
|
823
|
-
expect(out).to include("try to require a relative path") if RUBY_VERSION >= "1.9"
|
824
|
-
end
|
825
|
-
|
826
|
-
it "evals each gemspec with a binding from the top level" do
|
827
|
-
bundle "install"
|
828
|
-
|
829
|
-
ruby <<-RUBY
|
830
|
-
require 'bundler'
|
831
|
-
def Bundler.require(path)
|
832
|
-
raise "LOSE"
|
833
|
-
end
|
834
|
-
Bundler.load
|
835
|
-
RUBY
|
836
|
-
|
837
|
-
expect(err).to eq("")
|
838
|
-
expect(out).to eq("")
|
839
|
-
end
|
840
|
-
end
|
841
|
-
|
842
|
-
describe "when Bundler is bundled" do
|
843
|
-
it "doesn't blow up" do
|
844
|
-
install_gemfile <<-G
|
845
|
-
gem "bundler", :path => "#{File.expand_path("..", lib)}"
|
846
|
-
G
|
847
|
-
|
848
|
-
bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
|
849
|
-
expect(err).to be_empty
|
850
|
-
end
|
851
|
-
end
|
852
|
-
|
853
|
-
end
|