bundler-prehistoric 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +100 -0
- data/CHANGELOG.md +1640 -0
- data/CONTRIBUTING.md +32 -0
- data/DEVELOPMENT.md +117 -0
- data/Gemfile +3 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +46 -0
- data/Rakefile +256 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bin/bundle_ruby +56 -0
- data/bin/bundler +21 -0
- data/bundler.gemspec +33 -0
- data/lib/bundler.rb +442 -0
- data/lib/bundler/backports/time.rb +7 -0
- data/lib/bundler/capistrano.rb +16 -0
- data/lib/bundler/cli.rb +395 -0
- data/lib/bundler/cli/binstubs.rb +38 -0
- data/lib/bundler/cli/cache.rb +34 -0
- data/lib/bundler/cli/check.rb +35 -0
- data/lib/bundler/cli/clean.rb +19 -0
- data/lib/bundler/cli/common.rb +54 -0
- data/lib/bundler/cli/config.rb +84 -0
- data/lib/bundler/cli/console.rb +39 -0
- data/lib/bundler/cli/exec.rb +37 -0
- data/lib/bundler/cli/gem.rb +101 -0
- data/lib/bundler/cli/init.rb +33 -0
- data/lib/bundler/cli/inject.rb +33 -0
- data/lib/bundler/cli/install.rb +133 -0
- data/lib/bundler/cli/open.rb +23 -0
- data/lib/bundler/cli/outdated.rb +80 -0
- data/lib/bundler/cli/package.rb +36 -0
- data/lib/bundler/cli/platform.rb +43 -0
- data/lib/bundler/cli/show.rb +48 -0
- data/lib/bundler/cli/update.rb +73 -0
- data/lib/bundler/cli/viz.rb +27 -0
- data/lib/bundler/constants.rb +5 -0
- data/lib/bundler/current_ruby.rb +155 -0
- data/lib/bundler/definition.rb +604 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +106 -0
- data/lib/bundler/deployment.rb +59 -0
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +305 -0
- data/lib/bundler/endpoint_specification.rb +76 -0
- data/lib/bundler/env.rb +56 -0
- data/lib/bundler/environment.rb +42 -0
- data/lib/bundler/fetcher.rb +396 -0
- data/lib/bundler/friendly_errors.rb +42 -0
- data/lib/bundler/gem_helper.rb +169 -0
- data/lib/bundler/gem_helpers.rb +25 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +169 -0
- data/lib/bundler/index.rb +184 -0
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +332 -0
- data/lib/bundler/lazy_specification.rb +83 -0
- data/lib/bundler/lockfile_parser.rb +146 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/parallel_workers.rb +18 -0
- data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
- data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
- data/lib/bundler/parallel_workers/worker.rb +69 -0
- data/lib/bundler/psyched_yaml.rb +26 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +534 -0
- data/lib/bundler/retry.rb +60 -0
- data/lib/bundler/ruby_dsl.rb +11 -0
- data/lib/bundler/ruby_version.rb +117 -0
- data/lib/bundler/rubygems_ext.rb +171 -0
- data/lib/bundler/rubygems_integration.rb +578 -0
- data/lib/bundler/runtime.rb +310 -0
- data/lib/bundler/settings.rb +176 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +110 -0
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +29 -0
- data/lib/bundler/source/git.rb +289 -0
- data/lib/bundler/source/git/git_proxy.rb +158 -0
- data/lib/bundler/source/path.rb +225 -0
- data/lib/bundler/source/path/installer.rb +38 -0
- data/lib/bundler/source/rubygems.rb +334 -0
- data/lib/bundler/source/svn.rb +260 -0
- data/lib/bundler/source/svn/svn_proxy.rb +110 -0
- data/lib/bundler/spec_set.rb +154 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +41 -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/.travis.yml.tt +3 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +31 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/consolerc.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +7 -0
- data/lib/bundler/ui/rg_proxy.rb +21 -0
- data/lib/bundler/ui/shell.rb +98 -0
- data/lib/bundler/ui/silent.rb +44 -0
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/bundler/vendor/thor.rb +480 -0
- data/lib/bundler/vendor/thor/actions.rb +319 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
- data/lib/bundler/vendor/thor/base.rb +656 -0
- data/lib/bundler/vendor/thor/command.rb +133 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/bundler/vendor/thor/error.rb +32 -0
- data/lib/bundler/vendor/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/invocation.rb +173 -0
- data/lib/bundler/vendor/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/parser/option.rb +121 -0
- data/lib/bundler/vendor/thor/parser/options.rb +218 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/runner.rb +322 -0
- data/lib/bundler/vendor/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
- data/lib/bundler/vendor/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/util.rb +267 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_persistent.rb +3 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +155 -0
- data/man/bundle-exec.ronn +136 -0
- data/man/bundle-install.ronn +372 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-update.ronn +179 -0
- data/man/bundle.ronn +92 -0
- data/man/gemfile.5.ronn +369 -0
- data/man/index.txt +7 -0
- data/spec/bundler/bundler_spec.rb +74 -0
- data/spec/bundler/cli_spec.rb +16 -0
- data/spec/bundler/definition_spec.rb +21 -0
- data/spec/bundler/dsl_spec.rb +108 -0
- data/spec/bundler/friendly_errors_spec.rb +13 -0
- data/spec/bundler/gem_helper_spec.rb +225 -0
- data/spec/bundler/psyched_yaml_spec.rb +8 -0
- data/spec/bundler/retry_spec.rb +59 -0
- data/spec/bundler/settings_spec.rb +13 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +316 -0
- data/spec/cache/git_spec.rb +188 -0
- data/spec/cache/path_spec.rb +121 -0
- data/spec/cache/platform_spec.rb +53 -0
- data/spec/cache/svn_spec.rb +82 -0
- data/spec/commands/binstubs_spec.rb +246 -0
- data/spec/commands/check_spec.rb +278 -0
- data/spec/commands/clean_spec.rb +652 -0
- data/spec/commands/config_spec.rb +227 -0
- data/spec/commands/console_spec.rb +102 -0
- data/spec/commands/exec_spec.rb +367 -0
- data/spec/commands/help_spec.rb +39 -0
- data/spec/commands/init_spec.rb +39 -0
- data/spec/commands/inject_spec.rb +78 -0
- data/spec/commands/licenses_spec.rb +31 -0
- data/spec/commands/newgem_spec.rb +451 -0
- data/spec/commands/open_spec.rb +80 -0
- data/spec/commands/outdated_spec.rb +168 -0
- data/spec/commands/package_spec.rb +128 -0
- data/spec/commands/show_spec.rb +152 -0
- data/spec/install/binstubs_spec.rb +24 -0
- data/spec/install/bundler_spec.rb +146 -0
- data/spec/install/deploy_spec.rb +237 -0
- data/spec/install/gemfile/gemspec_spec.rb +170 -0
- data/spec/install/gemfile/git_spec.rb +967 -0
- data/spec/install/gemfile/path_spec.rb +480 -0
- data/spec/install/gemfile/svn_spec.rb +582 -0
- data/spec/install/gemfile_spec.rb +44 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +580 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +314 -0
- data/spec/install/gems/groups_spec.rb +308 -0
- data/spec/install/gems/mirror_spec.rb +39 -0
- data/spec/install/gems/platform_spec.rb +221 -0
- data/spec/install/gems/post_install_spec.rb +121 -0
- data/spec/install/gems/resolving_spec.rb +124 -0
- data/spec/install/gems/simple_case_spec.rb +386 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +136 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspecs_spec.rb +50 -0
- data/spec/install/path_spec.rb +150 -0
- data/spec/install/post_bundle_message_spec.rb +142 -0
- data/spec/install/prereleases_spec.rb +43 -0
- data/spec/install/security_policy_spec.rb +77 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +34 -0
- data/spec/lock/lockfile_spec.rb +912 -0
- data/spec/lock/svn_spec.rb +35 -0
- data/spec/other/bundle_ruby_spec.rb +142 -0
- data/spec/other/cli_dispatch_spec.rb +21 -0
- data/spec/other/ext_spec.rb +60 -0
- data/spec/other/platform_spec.rb +1285 -0
- data/spec/other/ssl_cert_spec.rb +10 -0
- data/spec/quality_spec.rb +88 -0
- data/spec/realworld/dependency_api_spec.rb +60 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/realworld/parallel_spec.rb +69 -0
- data/spec/resolver/basic_spec.rb +66 -0
- data/spec/resolver/platform_spec.rb +88 -0
- data/spec/runtime/executable_spec.rb +149 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +332 -0
- data/spec/runtime/setup_spec.rb +856 -0
- data/spec/runtime/with_clean_env_spec.rb +91 -0
- data/spec/spec_helper.rb +114 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +71 -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_creds_diff_host.rb +38 -0
- data/spec/support/artifice/endpoint_extra.rb +31 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +17 -0
- data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
- data/spec/support/artifice/endpoint_timeout.rb +13 -0
- data/spec/support/builders.rb +748 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/hax.rb +22 -0
- data/spec/support/helpers.rb +348 -0
- data/spec/support/indexes.rb +280 -0
- data/spec/support/less_than_proc.rb +14 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +81 -0
- data/spec/support/permissions.rb +10 -0
- data/spec/support/platforms.rb +94 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +39 -0
- data/spec/support/streams.rb +13 -0
- data/spec/support/sudo.rb +16 -0
- data/spec/update/gems_spec.rb +201 -0
- data/spec/update/git_spec.rb +236 -0
- data/spec/update/source_spec.rb +63 -0
- data/spec/update/svn_spec.rb +100 -0
- metadata +486 -0
@@ -0,0 +1,856 @@
|
|
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
|
+
begin
|
372
|
+
bundle "install --path vendor/bundle"
|
373
|
+
|
374
|
+
Dir["**/*"].each do |f|
|
375
|
+
File.directory?(f) ?
|
376
|
+
File.chmod(0555, f) :
|
377
|
+
File.chmod(0444, f)
|
378
|
+
end
|
379
|
+
should_be_installed "rack 1.0.0"
|
380
|
+
ensure
|
381
|
+
Dir["**/*"].each do |f|
|
382
|
+
File.directory?(f) ?
|
383
|
+
File.chmod(0755, f) :
|
384
|
+
File.chmod(0644, f)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
describe "when specifying local override" do
|
391
|
+
it "explodes if given path does not exist on runtime" do
|
392
|
+
build_git "rack", "0.8"
|
393
|
+
|
394
|
+
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
395
|
+
|
396
|
+
gemfile <<-G
|
397
|
+
source "file://#{gem_repo1}"
|
398
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "master"
|
399
|
+
G
|
400
|
+
|
401
|
+
bundle %|config local.rack #{lib_path('local-rack')}|
|
402
|
+
bundle :install
|
403
|
+
expect(out).to match(/at #{lib_path('local-rack')}/)
|
404
|
+
|
405
|
+
FileUtils.rm_rf(lib_path('local-rack'))
|
406
|
+
run "require 'rack'", :expect_err => true
|
407
|
+
expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
|
408
|
+
end
|
409
|
+
|
410
|
+
it "explodes if branch is not given on runtime" do
|
411
|
+
build_git "rack", "0.8"
|
412
|
+
|
413
|
+
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
414
|
+
|
415
|
+
gemfile <<-G
|
416
|
+
source "file://#{gem_repo1}"
|
417
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "master"
|
418
|
+
G
|
419
|
+
|
420
|
+
bundle %|config local.rack #{lib_path('local-rack')}|
|
421
|
+
bundle :install
|
422
|
+
expect(out).to match(/at #{lib_path('local-rack')}/)
|
423
|
+
|
424
|
+
gemfile <<-G
|
425
|
+
source "file://#{gem_repo1}"
|
426
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}"
|
427
|
+
G
|
428
|
+
|
429
|
+
run "require 'rack'", :expect_err => true
|
430
|
+
expect(err).to match(/because :branch is not specified in Gemfile/)
|
431
|
+
end
|
432
|
+
|
433
|
+
it "explodes on different branches on runtime" do
|
434
|
+
build_git "rack", "0.8"
|
435
|
+
|
436
|
+
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
437
|
+
|
438
|
+
gemfile <<-G
|
439
|
+
source "file://#{gem_repo1}"
|
440
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "master"
|
441
|
+
G
|
442
|
+
|
443
|
+
bundle %|config local.rack #{lib_path('local-rack')}|
|
444
|
+
bundle :install
|
445
|
+
expect(out).to match(/at #{lib_path('local-rack')}/)
|
446
|
+
|
447
|
+
gemfile <<-G
|
448
|
+
source "file://#{gem_repo1}"
|
449
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "changed"
|
450
|
+
G
|
451
|
+
|
452
|
+
run "require 'rack'", :expect_err => true
|
453
|
+
expect(err).to match(/is using branch master but Gemfile specifies changed/)
|
454
|
+
end
|
455
|
+
|
456
|
+
it "explodes on refs with different branches on runtime" do
|
457
|
+
build_git "rack", "0.8"
|
458
|
+
|
459
|
+
FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack'))
|
460
|
+
|
461
|
+
install_gemfile <<-G
|
462
|
+
source "file://#{gem_repo1}"
|
463
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}", :ref => "master", :branch => "master"
|
464
|
+
G
|
465
|
+
|
466
|
+
gemfile <<-G
|
467
|
+
source "file://#{gem_repo1}"
|
468
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}", :ref => "master", :branch => "nonexistant"
|
469
|
+
G
|
470
|
+
|
471
|
+
bundle %|config local.rack #{lib_path('local-rack')}|
|
472
|
+
run "require 'rack'", :expect_err => true
|
473
|
+
expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
describe "when excluding groups" do
|
478
|
+
it "doesn't change the resolve if --without is used" do
|
479
|
+
install_gemfile <<-G, :without => :rails
|
480
|
+
source "file://#{gem_repo1}"
|
481
|
+
gem "activesupport"
|
482
|
+
|
483
|
+
group :rails do
|
484
|
+
gem "rails", "2.3.2"
|
485
|
+
end
|
486
|
+
G
|
487
|
+
|
488
|
+
install_gems "activesupport-2.3.5"
|
489
|
+
|
490
|
+
should_be_installed "activesupport 2.3.2", :groups => :default
|
491
|
+
end
|
492
|
+
|
493
|
+
it "remembers --without and does not bail on bare Bundler.setup" do
|
494
|
+
install_gemfile <<-G, :without => :rails
|
495
|
+
source "file://#{gem_repo1}"
|
496
|
+
gem "activesupport"
|
497
|
+
|
498
|
+
group :rails do
|
499
|
+
gem "rails", "2.3.2"
|
500
|
+
end
|
501
|
+
G
|
502
|
+
|
503
|
+
install_gems "activesupport-2.3.5"
|
504
|
+
|
505
|
+
should_be_installed "activesupport 2.3.2"
|
506
|
+
end
|
507
|
+
|
508
|
+
it "remembers --without and does not include groups passed to Bundler.setup" do
|
509
|
+
install_gemfile <<-G, :without => :rails
|
510
|
+
source "file://#{gem_repo1}"
|
511
|
+
gem "activesupport"
|
512
|
+
|
513
|
+
group :rack do
|
514
|
+
gem "rack"
|
515
|
+
end
|
516
|
+
|
517
|
+
group :rails do
|
518
|
+
gem "rails", "2.3.2"
|
519
|
+
end
|
520
|
+
G
|
521
|
+
|
522
|
+
should_not_be_installed "activesupport 2.3.2", :groups => :rack
|
523
|
+
should_be_installed "rack 1.0.0", :groups => :rack
|
524
|
+
end
|
525
|
+
end
|
526
|
+
|
527
|
+
# Unfortunately, gem_prelude does not record the information about
|
528
|
+
# activated gems, so this test cannot work on 1.9 :(
|
529
|
+
if RUBY_VERSION < "1.9"
|
530
|
+
describe "preactivated gems" do
|
531
|
+
it "raises an exception if a pre activated gem conflicts with the bundle" do
|
532
|
+
system_gems "thin-1.0", "rack-1.0.0"
|
533
|
+
build_gem "thin", "1.1", :to_system => true do |s|
|
534
|
+
s.add_dependency "rack"
|
535
|
+
end
|
536
|
+
|
537
|
+
gemfile <<-G
|
538
|
+
gem "thin", "1.0"
|
539
|
+
G
|
540
|
+
|
541
|
+
ruby <<-R
|
542
|
+
require 'rubygems'
|
543
|
+
gem "thin"
|
544
|
+
require 'bundler'
|
545
|
+
begin
|
546
|
+
Bundler.setup
|
547
|
+
puts "FAIL"
|
548
|
+
rescue Gem::LoadError => e
|
549
|
+
puts e.message
|
550
|
+
end
|
551
|
+
R
|
552
|
+
|
553
|
+
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.")
|
554
|
+
end
|
555
|
+
|
556
|
+
it "version_requirement is now deprecated in rubygems 1.4.0+" do
|
557
|
+
system_gems "thin-1.0", "rack-1.0.0"
|
558
|
+
build_gem "thin", "1.1", :to_system => true do |s|
|
559
|
+
s.add_dependency "rack"
|
560
|
+
end
|
561
|
+
|
562
|
+
gemfile <<-G
|
563
|
+
gem "thin", "1.0"
|
564
|
+
G
|
565
|
+
|
566
|
+
ruby <<-R, :expect_err => true
|
567
|
+
require 'rubygems'
|
568
|
+
gem "thin"
|
569
|
+
require 'bundler'
|
570
|
+
begin
|
571
|
+
Bundler.setup
|
572
|
+
puts "FAIL"
|
573
|
+
rescue Gem::LoadError => e
|
574
|
+
puts e.message
|
575
|
+
end
|
576
|
+
R
|
577
|
+
|
578
|
+
expect(err).to be_empty
|
579
|
+
end
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
# Rubygems returns loaded_from as a string
|
584
|
+
it "has loaded_from as a string on all specs" do
|
585
|
+
build_git "foo"
|
586
|
+
build_git "no-gemspec", :gemspec => false
|
587
|
+
|
588
|
+
install_gemfile <<-G
|
589
|
+
source "file://#{gem_repo1}"
|
590
|
+
gem "rack"
|
591
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
592
|
+
gem "no-gemspec", "1.0", :git => "#{lib_path('no-gemspec-1.0')}"
|
593
|
+
G
|
594
|
+
|
595
|
+
run <<-R
|
596
|
+
Gem.loaded_specs.each do |n, s|
|
597
|
+
puts "FAIL" unless s.loaded_from.is_a?(String)
|
598
|
+
end
|
599
|
+
R
|
600
|
+
|
601
|
+
expect(out).to be_empty
|
602
|
+
end
|
603
|
+
|
604
|
+
it "ignores empty gem paths" do
|
605
|
+
install_gemfile <<-G
|
606
|
+
source "file://#{gem_repo1}"
|
607
|
+
gem "rack"
|
608
|
+
G
|
609
|
+
|
610
|
+
ENV["GEM_HOME"] = ""
|
611
|
+
bundle %{exec ruby -e "require 'set'"}
|
612
|
+
|
613
|
+
expect(err).to be_empty
|
614
|
+
end
|
615
|
+
|
616
|
+
it "should prepend gemspec require paths to $LOAD_PATH in order" do
|
617
|
+
update_repo2 do
|
618
|
+
build_gem("requirepaths") do |s|
|
619
|
+
s.write("lib/rq.rb", "puts 'yay'")
|
620
|
+
s.write("src/rq.rb", "puts 'nooo'")
|
621
|
+
s.require_paths = ["lib", "src"]
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
install_gemfile <<-G
|
626
|
+
source "file://#{gem_repo2}"
|
627
|
+
gem "requirepaths", :require => nil
|
628
|
+
G
|
629
|
+
|
630
|
+
run "require 'rq'"
|
631
|
+
expect(out).to eq("yay")
|
632
|
+
end
|
633
|
+
|
634
|
+
it "stubs out Gem.refresh so it does not reveal system gems" do
|
635
|
+
system_gems "rack-1.0.0"
|
636
|
+
|
637
|
+
install_gemfile <<-G
|
638
|
+
source "file://#{gem_repo1}"
|
639
|
+
gem "activesupport"
|
640
|
+
G
|
641
|
+
|
642
|
+
run <<-R
|
643
|
+
puts Bundler.rubygems.find_name("rack").inspect
|
644
|
+
Gem.refresh
|
645
|
+
puts Bundler.rubygems.find_name("rack").inspect
|
646
|
+
R
|
647
|
+
|
648
|
+
expect(out).to eq("[]\n[]")
|
649
|
+
end
|
650
|
+
|
651
|
+
describe "when a vendored gem specification uses the :path option" do
|
652
|
+
it "should resolve paths relative to the Gemfile" do
|
653
|
+
path = bundled_app(File.join('vendor', 'foo'))
|
654
|
+
build_lib "foo", :path => path
|
655
|
+
|
656
|
+
# If the .gemspec exists, then Bundler handles the path differently.
|
657
|
+
# See Source::Path.load_spec_files for details.
|
658
|
+
FileUtils.rm(File.join(path, 'foo.gemspec'))
|
659
|
+
|
660
|
+
install_gemfile <<-G
|
661
|
+
gem 'foo', '1.2.3', :path => 'vendor/foo'
|
662
|
+
G
|
663
|
+
|
664
|
+
Dir.chdir(bundled_app.parent) do
|
665
|
+
run <<-R, :env => {"BUNDLE_GEMFILE" => bundled_app('Gemfile')}
|
666
|
+
require 'foo'
|
667
|
+
R
|
668
|
+
end
|
669
|
+
expect(err).to eq("")
|
670
|
+
end
|
671
|
+
|
672
|
+
it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
|
673
|
+
relative_path = File.join('vendor', Dir.pwd[1..-1], 'foo')
|
674
|
+
absolute_path = bundled_app(relative_path)
|
675
|
+
FileUtils.mkdir_p(absolute_path)
|
676
|
+
build_lib "foo", :path => absolute_path
|
677
|
+
|
678
|
+
# If the .gemspec exists, then Bundler handles the path differently.
|
679
|
+
# See Source::Path.load_spec_files for details.
|
680
|
+
FileUtils.rm(File.join(absolute_path, 'foo.gemspec'))
|
681
|
+
|
682
|
+
gemfile <<-G
|
683
|
+
gem 'foo', '1.2.3', :path => '#{relative_path}'
|
684
|
+
G
|
685
|
+
|
686
|
+
bundle :install
|
687
|
+
|
688
|
+
Dir.chdir(bundled_app.parent) do
|
689
|
+
run <<-R, :env => {"BUNDLE_GEMFILE" => bundled_app('Gemfile')}
|
690
|
+
require 'foo'
|
691
|
+
R
|
692
|
+
end
|
693
|
+
|
694
|
+
expect(err).to eq("")
|
695
|
+
end
|
696
|
+
end
|
697
|
+
|
698
|
+
describe "with git gems that don't have gemspecs" do
|
699
|
+
before :each do
|
700
|
+
build_git "no-gemspec", :gemspec => false
|
701
|
+
|
702
|
+
install_gemfile <<-G
|
703
|
+
gem "no-gemspec", "1.0", :git => "#{lib_path('no-gemspec-1.0')}"
|
704
|
+
G
|
705
|
+
end
|
706
|
+
|
707
|
+
it "loads the library via a virtual spec" do
|
708
|
+
run <<-R
|
709
|
+
require 'no-gemspec'
|
710
|
+
puts NOGEMSPEC
|
711
|
+
R
|
712
|
+
|
713
|
+
expect(out).to eq("1.0")
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
describe "with bundled and system gems" do
|
718
|
+
before :each do
|
719
|
+
system_gems "rack-1.0.0"
|
720
|
+
|
721
|
+
install_gemfile <<-G
|
722
|
+
source "file://#{gem_repo1}"
|
723
|
+
|
724
|
+
gem "activesupport", "2.3.5"
|
725
|
+
G
|
726
|
+
end
|
727
|
+
|
728
|
+
it "does not pull in system gems" do
|
729
|
+
run <<-R
|
730
|
+
require 'rubygems'
|
731
|
+
|
732
|
+
begin;
|
733
|
+
require 'rack'
|
734
|
+
rescue LoadError
|
735
|
+
puts 'WIN'
|
736
|
+
end
|
737
|
+
R
|
738
|
+
|
739
|
+
expect(out).to eq("WIN")
|
740
|
+
end
|
741
|
+
|
742
|
+
it "provides a gem method" do
|
743
|
+
run <<-R
|
744
|
+
gem 'activesupport'
|
745
|
+
require 'activesupport'
|
746
|
+
puts ACTIVESUPPORT
|
747
|
+
R
|
748
|
+
|
749
|
+
expect(out).to eq("2.3.5")
|
750
|
+
end
|
751
|
+
|
752
|
+
it "raises an exception if gem is used to invoke a system gem not in the bundle" do
|
753
|
+
run <<-R
|
754
|
+
begin
|
755
|
+
gem 'rack'
|
756
|
+
rescue LoadError => e
|
757
|
+
puts e.message
|
758
|
+
end
|
759
|
+
R
|
760
|
+
|
761
|
+
expect(out).to eq("rack is not part of the bundle. Add it to Gemfile.")
|
762
|
+
end
|
763
|
+
|
764
|
+
it "sets GEM_HOME appropriately" do
|
765
|
+
run "puts ENV['GEM_HOME']"
|
766
|
+
expect(out).to eq(default_bundle_path.to_s)
|
767
|
+
end
|
768
|
+
end
|
769
|
+
|
770
|
+
describe "with system gems in the bundle" do
|
771
|
+
before :each do
|
772
|
+
system_gems "rack-1.0.0"
|
773
|
+
|
774
|
+
install_gemfile <<-G
|
775
|
+
source "file://#{gem_repo1}"
|
776
|
+
gem "rack", "1.0.0"
|
777
|
+
gem "activesupport", "2.3.5"
|
778
|
+
G
|
779
|
+
end
|
780
|
+
|
781
|
+
it "sets GEM_PATH appropriately" do
|
782
|
+
run "puts Gem.path"
|
783
|
+
paths = out.split("\n")
|
784
|
+
expect(paths).to include(system_gem_path.to_s)
|
785
|
+
expect(paths).to include(default_bundle_path.to_s)
|
786
|
+
end
|
787
|
+
end
|
788
|
+
|
789
|
+
describe "with a gemspec that requires other files" do
|
790
|
+
before :each do
|
791
|
+
build_git "bar", :gemspec => false do |s|
|
792
|
+
s.write "lib/bar/version.rb", %{BAR_VERSION = '1.0'}
|
793
|
+
s.write "bar.gemspec", <<-G
|
794
|
+
lib = File.expand_path('../lib/', __FILE__)
|
795
|
+
$:.unshift lib unless $:.include?(lib)
|
796
|
+
require 'bar/version'
|
797
|
+
|
798
|
+
Gem::Specification.new do |s|
|
799
|
+
s.name = 'bar'
|
800
|
+
s.version = BAR_VERSION
|
801
|
+
s.summary = 'Bar'
|
802
|
+
s.files = Dir["lib/**/*.rb"]
|
803
|
+
end
|
804
|
+
G
|
805
|
+
end
|
806
|
+
|
807
|
+
gemfile <<-G
|
808
|
+
gem "bar", :git => "#{lib_path('bar-1.0')}"
|
809
|
+
G
|
810
|
+
end
|
811
|
+
|
812
|
+
it "evals each gemspec in the context of its parent directory" do
|
813
|
+
bundle :install
|
814
|
+
run "require 'bar'; puts BAR"
|
815
|
+
expect(out).to eq("1.0")
|
816
|
+
end
|
817
|
+
|
818
|
+
it "error intelligently if the gemspec has a LoadError" do
|
819
|
+
update_git "bar", :gemspec => false do |s|
|
820
|
+
s.write "bar.gemspec", "require 'foobarbaz'"
|
821
|
+
end
|
822
|
+
bundle :install
|
823
|
+
expect(out).to include("was a LoadError while loading bar.gemspec")
|
824
|
+
expect(out).to include("foobarbaz")
|
825
|
+
expect(out).to include("bar.gemspec:1")
|
826
|
+
expect(out).to include("try to require a relative path") if RUBY_VERSION >= "1.9"
|
827
|
+
end
|
828
|
+
|
829
|
+
it "evals each gemspec with a binding from the top level" do
|
830
|
+
bundle "install"
|
831
|
+
|
832
|
+
ruby <<-RUBY
|
833
|
+
require 'bundler'
|
834
|
+
def Bundler.require(path)
|
835
|
+
raise "LOSE"
|
836
|
+
end
|
837
|
+
Bundler.load
|
838
|
+
RUBY
|
839
|
+
|
840
|
+
expect(err).to eq("")
|
841
|
+
expect(out).to eq("")
|
842
|
+
end
|
843
|
+
end
|
844
|
+
|
845
|
+
describe "when Bundler is bundled" do
|
846
|
+
it "doesn't blow up" do
|
847
|
+
install_gemfile <<-G
|
848
|
+
gem "bundler", :path => "#{File.expand_path("..", lib)}"
|
849
|
+
G
|
850
|
+
|
851
|
+
bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
|
852
|
+
expect(err).to be_empty
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
856
|
+
end
|