bundler 1.2.5 → 1.3.0.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- data/.gitignore +10 -7
- data/.travis.yml +12 -3
- data/CHANGELOG.md +26 -19
- data/CONTRIBUTE.md +97 -0
- data/README.md +4 -2
- data/Rakefile +17 -59
- data/bundler.gemspec +2 -1
- data/lib/bundler.rb +23 -20
- data/lib/bundler/cli.rb +68 -22
- data/lib/bundler/definition.rb +3 -2
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +14 -16
- data/lib/bundler/environment.rb +0 -5
- data/lib/bundler/fetcher.rb +23 -78
- data/lib/bundler/friendly_errors.rb +4 -5
- data/lib/bundler/gem_helper.rb +14 -16
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +1 -7
- data/lib/bundler/lazy_specification.rb +6 -3
- data/lib/bundler/lockfile_parser.rb +25 -13
- data/lib/bundler/resolver.rb +0 -1
- data/lib/bundler/rubygems_integration.rb +83 -17
- data/lib/bundler/settings.rb +4 -2
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +3 -886
- data/lib/bundler/source/git.rb +267 -0
- data/lib/bundler/source/git/git_proxy.rb +142 -0
- data/lib/bundler/source/path.rb +209 -0
- data/lib/bundler/source/path/installer.rb +33 -0
- data/lib/bundler/source/rubygems.rb +261 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +9 -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 +20 -5
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/thor.rb +74 -5
- data/lib/bundler/vendor/thor/actions.rb +5 -5
- data/lib/bundler/vendor/thor/actions/directory.rb +1 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +7 -1
- data/lib/bundler/vendor/thor/base.rb +44 -11
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +5 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +14 -7
- data/lib/bundler/vendor/thor/parser/arguments.rb +7 -1
- data/lib/bundler/vendor/thor/parser/option.rb +8 -8
- data/lib/bundler/vendor/thor/parser/options.rb +62 -24
- data/lib/bundler/vendor/thor/runner.rb +1 -1
- data/lib/bundler/vendor/thor/shell/basic.rb +2 -2
- data/lib/bundler/vendor/thor/task.rb +2 -2
- data/lib/bundler/vendor/thor/version.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +3 -15
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-exec.ronn +1 -1
- data/man/bundle-update.ronn +1 -1
- data/man/bundle.ronn +4 -1
- data/spec/bundler/bundler_spec.rb +2 -28
- data/spec/bundler/cli_rspec.rb +9 -0
- data/spec/bundler/definition_spec.rb +1 -1
- data/spec/bundler/dsl_spec.rb +15 -8
- data/spec/bundler/gem_helper_spec.rb +38 -21
- data/spec/bundler/psyched_yaml_spec.rb +1 -0
- data/spec/bundler/source_spec.rb +3 -3
- data/spec/cache/gems_spec.rb +24 -24
- data/spec/cache/git_spec.rb +21 -23
- data/spec/cache/path_spec.rb +11 -11
- data/spec/cache/platform_spec.rb +6 -6
- data/spec/install/deploy_spec.rb +38 -38
- data/spec/install/gems/c_ext_spec.rb +2 -2
- data/spec/install/gems/dependency_api_spec.rb +23 -116
- data/spec/install/gems/env_spec.rb +1 -1
- data/spec/install/gems/flex_spec.rb +7 -8
- data/spec/install/gems/groups_spec.rb +10 -10
- data/spec/install/gems/packed_spec.rb +4 -4
- data/spec/install/gems/platform_spec.rb +3 -3
- data/spec/install/gems/post_install_spec.rb +9 -9
- data/spec/install/gems/resolving_spec.rb +2 -2
- data/spec/install/gems/simple_case_spec.rb +50 -53
- data/spec/install/gems/standalone_spec.rb +19 -19
- data/spec/install/gems/sudo_spec.rb +31 -16
- data/spec/install/gems/win32_spec.rb +1 -1
- data/spec/install/gemspec_spec.rb +6 -6
- data/spec/install/git_spec.rb +34 -34
- data/spec/install/invalid_spec.rb +3 -3
- data/spec/install/path_spec.rb +71 -8
- data/spec/install/upgrade_spec.rb +2 -2
- data/spec/integration/inject.rb +78 -0
- data/spec/lock/git_spec.rb +2 -2
- data/spec/lock/lockfile_spec.rb +14 -14
- data/spec/other/check_spec.rb +29 -29
- data/spec/other/clean_spec.rb +47 -48
- data/spec/other/config_spec.rb +20 -20
- data/spec/other/console_spec.rb +5 -5
- data/spec/other/exec_spec.rb +48 -28
- data/spec/other/ext_spec.rb +3 -3
- data/spec/other/help_spec.rb +6 -6
- data/spec/other/init_spec.rb +8 -8
- data/spec/other/newgem_spec.rb +95 -15
- data/spec/other/open_spec.rb +10 -5
- data/spec/other/outdated_spec.rb +8 -8
- data/spec/other/platform_spec.rb +45 -45
- data/spec/other/show_spec.rb +10 -10
- data/spec/quality_spec.rb +2 -2
- data/spec/realworld/dependency_api_spec.rb +61 -0
- data/spec/realworld/edgecases_spec.rb +8 -8
- data/spec/runtime/executable_spec.rb +13 -13
- data/spec/runtime/load_spec.rb +12 -12
- data/spec/runtime/platform_spec.rb +1 -1
- data/spec/runtime/require_spec.rb +24 -24
- data/spec/runtime/setup_spec.rb +113 -56
- data/spec/runtime/with_clean_env_spec.rb +11 -13
- data/spec/spec_helper.rb +6 -0
- data/spec/support/artifice/endpoint.rb +28 -13
- data/spec/support/artifice/endpoint_extra.rb +4 -0
- data/spec/support/builders.rb +1 -1
- data/spec/support/helpers.rb +2 -7
- data/spec/support/indexes.rb +3 -3
- data/spec/support/matchers.rb +6 -6
- data/spec/update/gems_spec.rb +19 -8
- data/spec/update/git_spec.rb +10 -10
- data/spec/update/source_spec.rb +1 -1
- metadata +86 -55
- data/.rspec +0 -2
data/spec/other/show_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe "bundle show" do
|
|
13
13
|
|
14
14
|
bundle "show"
|
15
15
|
|
16
|
-
bundled_app("Gemfile.lock").
|
16
|
+
expect(bundled_app("Gemfile.lock")).to exist
|
17
17
|
end
|
18
18
|
|
19
19
|
it "creates a Gemfile.lock when invoked with a gem name" do
|
@@ -21,28 +21,28 @@ describe "bundle show" do
|
|
21
21
|
|
22
22
|
bundle "show rails"
|
23
23
|
|
24
|
-
bundled_app("Gemfile.lock").
|
24
|
+
expect(bundled_app("Gemfile.lock")).to exist
|
25
25
|
end
|
26
26
|
|
27
27
|
it "prints path if gem exists in bundle" do
|
28
28
|
bundle "show rails"
|
29
|
-
out.
|
29
|
+
expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "prints the path to the running bundler" do
|
33
33
|
bundle "show bundler"
|
34
|
-
out.
|
34
|
+
expect(out).to eq(File.expand_path('../../../', __FILE__))
|
35
35
|
end
|
36
36
|
|
37
37
|
it "complains if gem not in bundle" do
|
38
38
|
bundle "show missing"
|
39
|
-
out.
|
39
|
+
expect(out).to match(/could not find gem 'missing'/i)
|
40
40
|
end
|
41
41
|
|
42
42
|
it "prints path of all gems in bundle" do
|
43
43
|
bundle "show --paths"
|
44
|
-
out.
|
45
|
-
out.
|
44
|
+
expect(out).to include(default_bundle_path('gems', 'rake-10.0.2').to_s)
|
45
|
+
expect(out).to include(default_bundle_path('gems', 'rails-2.3.2').to_s)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -58,7 +58,7 @@ describe "bundle show with a git repo" do
|
|
58
58
|
should_be_installed "foo 1.0"
|
59
59
|
|
60
60
|
bundle :show
|
61
|
-
out.
|
61
|
+
expect(out).to include("foo (1.0 #{@git.ref_for('master', 6)}")
|
62
62
|
end
|
63
63
|
|
64
64
|
it "prints out branch names other than master" do
|
@@ -73,7 +73,7 @@ describe "bundle show with a git repo" do
|
|
73
73
|
should_be_installed "foo 1.0.omg"
|
74
74
|
|
75
75
|
bundle :show
|
76
|
-
out.
|
76
|
+
expect(out).to include("foo (1.0 #{@git.ref_for('omg', 6)}")
|
77
77
|
end
|
78
78
|
|
79
79
|
it "doesn't print the branch when tied to a ref" do
|
@@ -83,6 +83,6 @@ describe "bundle show with a git repo" do
|
|
83
83
|
G
|
84
84
|
|
85
85
|
bundle :show
|
86
|
-
out.
|
86
|
+
expect(out).to include("foo (1.0 #{sha[0..6]})")
|
87
87
|
end
|
88
88
|
end
|
data/spec/quality_spec.rb
CHANGED
@@ -47,13 +47,13 @@ describe "The library itself" do
|
|
47
47
|
error_messages << check_for_extra_spaces(filename)
|
48
48
|
end
|
49
49
|
end
|
50
|
-
error_messages.compact.
|
50
|
+
expect(error_messages.compact).to be_well_formed
|
51
51
|
end
|
52
52
|
|
53
53
|
it "can still be built" do
|
54
54
|
Dir.chdir(root) do
|
55
55
|
`gem build bundler.gemspec`
|
56
|
-
|
56
|
+
expect($?).to eq(0)
|
57
57
|
|
58
58
|
# clean up the .gem generated
|
59
59
|
system("rm bundler-#{Bundler::VERSION}.gem")
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "gemcutter's dependency API", :realworld => true do
|
4
|
+
def wait_for_server(port, seconds = 15)
|
5
|
+
tries = 0
|
6
|
+
TCPSocket.new("127.0.0.1", port)
|
7
|
+
rescue => e
|
8
|
+
raise(e) if tries > (seconds * 2)
|
9
|
+
tries += 1
|
10
|
+
sleep 0.5
|
11
|
+
retry
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when Gemcutter API takes too long to respond" do
|
15
|
+
before do
|
16
|
+
# need to hack, so we can require rack
|
17
|
+
old_gem_home = ENV['GEM_HOME']
|
18
|
+
ENV['GEM_HOME'] = Spec::Path.base_system_gems.to_s
|
19
|
+
require 'rack'
|
20
|
+
ENV['GEM_HOME'] = old_gem_home
|
21
|
+
|
22
|
+
port = 21453
|
23
|
+
port += 1 while TCPSocket.new("127.0.0.1", port) rescue false
|
24
|
+
@server_uri = "http://127.0.0.1:#{port}"
|
25
|
+
|
26
|
+
require File.expand_path('../../support/artifice/endpoint_timeout', __FILE__)
|
27
|
+
require 'thread'
|
28
|
+
@t = Thread.new {
|
29
|
+
server = Rack::Server.start(:app => EndpointTimeout,
|
30
|
+
:Host => '0.0.0.0',
|
31
|
+
:Port => port,
|
32
|
+
:server => 'webrick',
|
33
|
+
:AccessLog => [])
|
34
|
+
server.start
|
35
|
+
}
|
36
|
+
@t.run
|
37
|
+
|
38
|
+
wait_for_server(port)
|
39
|
+
end
|
40
|
+
|
41
|
+
after do
|
42
|
+
@t.kill
|
43
|
+
end
|
44
|
+
|
45
|
+
it "times out and falls back on the modern index" do
|
46
|
+
gemfile <<-G
|
47
|
+
source "#{@server_uri}"
|
48
|
+
gem "rack"
|
49
|
+
|
50
|
+
old_v, $VERBOSE = $VERBOSE, nil
|
51
|
+
Bundler::Fetcher::API_TIMEOUT = 1
|
52
|
+
$VERBOSE = old_v
|
53
|
+
G
|
54
|
+
|
55
|
+
bundle :install
|
56
|
+
expect(out).to include("\nFetching full source index from #{@server_uri}")
|
57
|
+
should_be_installed "rack 1.0.0"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -7,23 +7,23 @@ describe "real world edgecases", :realworld => true do
|
|
7
7
|
source :rubygems
|
8
8
|
gem "linecache", "0.46"
|
9
9
|
G
|
10
|
-
err.
|
10
|
+
expect(err).to eq("")
|
11
11
|
end
|
12
12
|
|
13
13
|
# https://github.com/carlhuda/bundler/issues/1202
|
14
|
-
it "bundle cache works with rubygems 1.3.7 and pre gems"
|
14
|
+
it "bundle cache works with rubygems 1.3.7 and pre gems" do
|
15
15
|
install_gemfile <<-G
|
16
16
|
source :rubygems
|
17
17
|
gem "rack", "1.3.0.beta2"
|
18
18
|
gem "will_paginate", "3.0.pre2"
|
19
19
|
G
|
20
20
|
bundle :cache
|
21
|
-
out.
|
21
|
+
expect(out).not_to include("Removing outdated .gem files from vendor/cache")
|
22
22
|
end
|
23
23
|
|
24
24
|
# https://github.com/carlhuda/bundler/issues/1486
|
25
25
|
# this is a hash collision that only manifests on 1.8.7
|
26
|
-
it "finds the correct child versions"
|
26
|
+
it "finds the correct child versions" do
|
27
27
|
install_gemfile <<-G
|
28
28
|
source :rubygems
|
29
29
|
|
@@ -32,7 +32,7 @@ describe "real world edgecases", :realworld => true do
|
|
32
32
|
gem 'activerecord', '~> 3.0'
|
33
33
|
gem 'builder', '~> 2.1.2'
|
34
34
|
G
|
35
|
-
out.
|
35
|
+
expect(out).to include("activemodel (3.0.5)")
|
36
36
|
end
|
37
37
|
|
38
38
|
# https://github.com/carlhuda/bundler/issues/1500
|
@@ -45,8 +45,8 @@ describe "real world edgecases", :realworld => true do
|
|
45
45
|
G
|
46
46
|
|
47
47
|
bundle "install --path vendor/bundle", :expect_err => true
|
48
|
-
err.
|
49
|
-
err.
|
48
|
+
expect(err).not_to include("Could not find rake")
|
49
|
+
expect(err).to be_empty
|
50
50
|
end
|
51
51
|
|
52
52
|
it "checks out git repos when the lockfile is corrupted" do
|
@@ -172,6 +172,6 @@ describe "real world edgecases", :realworld => true do
|
|
172
172
|
L
|
173
173
|
|
174
174
|
bundle :install, :exitstatus => true
|
175
|
-
exitstatus.
|
175
|
+
expect(exitstatus).to eq(0)
|
176
176
|
end
|
177
177
|
end
|
@@ -16,34 +16,34 @@ describe "Running bin/* commands" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
gembin "rackup"
|
19
|
-
out.
|
19
|
+
expect(out).to eq("1.0.0")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "allows the location of the gem stubs to be specified" do
|
23
23
|
bundle "install --binstubs gbin"
|
24
24
|
|
25
|
-
bundled_app("bin").
|
26
|
-
bundled_app("gbin/rackup").
|
25
|
+
expect(bundled_app("bin")).not_to exist
|
26
|
+
expect(bundled_app("gbin/rackup")).to exist
|
27
27
|
|
28
28
|
gembin bundled_app("gbin/rackup")
|
29
|
-
out.
|
29
|
+
expect(out).to eq("1.0.0")
|
30
30
|
end
|
31
31
|
|
32
32
|
it "allows absolute paths as a specification of where to install bin stubs" do
|
33
33
|
bundle "install --binstubs #{tmp}/bin"
|
34
34
|
|
35
35
|
gembin tmp("bin/rackup")
|
36
|
-
out.
|
36
|
+
expect(out).to eq("1.0.0")
|
37
37
|
end
|
38
38
|
|
39
39
|
it "uses the default ruby install name when shebang is not specified" do
|
40
40
|
bundle "install --binstubs"
|
41
|
-
File.open("bin/rackup").gets.
|
41
|
+
expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG['ruby_install_name']}\n")
|
42
42
|
end
|
43
43
|
|
44
44
|
it "allows the name of the shebang executable to be specified" do
|
45
45
|
bundle "install --binstubs --shebang ruby-foo"
|
46
|
-
File.open("bin/rackup").gets.
|
46
|
+
expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env ruby-foo\n")
|
47
47
|
end
|
48
48
|
|
49
49
|
it "runs the bundled command when out of the bundle" do
|
@@ -55,7 +55,7 @@ describe "Running bin/* commands" do
|
|
55
55
|
|
56
56
|
Dir.chdir(tmp) do
|
57
57
|
gembin "rackup"
|
58
|
-
out.
|
58
|
+
expect(out).to eq("1.0.0")
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -75,7 +75,7 @@ describe "Running bin/* commands" do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
gembin "rackup"
|
78
|
-
out.
|
78
|
+
expect(out).to eq('1.0')
|
79
79
|
end
|
80
80
|
|
81
81
|
it "don't bundle da bundla" do
|
@@ -90,13 +90,13 @@ describe "Running bin/* commands" do
|
|
90
90
|
|
91
91
|
bundle "install --binstubs"
|
92
92
|
|
93
|
-
bundled_app("bin/bundle").
|
93
|
+
expect(bundled_app("bin/bundle")).not_to exist
|
94
94
|
end
|
95
95
|
|
96
96
|
it "does not generate bin stubs if the option was not specified" do
|
97
97
|
bundle "install"
|
98
98
|
|
99
|
-
bundled_app("bin/rackup").
|
99
|
+
expect(bundled_app("bin/rackup")).not_to exist
|
100
100
|
end
|
101
101
|
|
102
102
|
it "remembers that the option was specified" do
|
@@ -115,6 +115,6 @@ describe "Running bin/* commands" do
|
|
115
115
|
|
116
116
|
bundle "install"
|
117
117
|
|
118
|
-
bundled_app("bin/rackup").
|
118
|
+
expect(bundled_app("bin/rackup")).to exist
|
119
119
|
end
|
120
|
-
end
|
120
|
+
end
|
data/spec/runtime/load_spec.rb
CHANGED
@@ -21,34 +21,34 @@ describe "Bundler.load" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "provides a list of the env dependencies" do
|
24
|
-
Bundler.load.dependencies.
|
24
|
+
expect(Bundler.load.dependencies).to have_dep("rack", ">= 0")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "provides a list of the resolved gems" do
|
28
|
-
Bundler.load.gems.
|
28
|
+
expect(Bundler.load.gems).to have_gem("rack-1.0.0", "bundler-#{Bundler::VERSION}")
|
29
29
|
end
|
30
30
|
|
31
31
|
it "ignores blank BUNDLE_GEMFILEs" do
|
32
|
-
|
32
|
+
expect {
|
33
33
|
ENV['BUNDLE_GEMFILE'] = ""
|
34
34
|
Bundler.load
|
35
|
-
}.
|
35
|
+
}.not_to raise_error(Bundler::GemfileNotFound)
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "without a gemfile" do
|
41
41
|
it "raises an exception if the default gemfile is not found" do
|
42
|
-
|
42
|
+
expect {
|
43
43
|
Bundler.load
|
44
|
-
}.
|
44
|
+
}.to raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i)
|
45
45
|
end
|
46
46
|
|
47
47
|
it "raises an exception if a specified gemfile is not found" do
|
48
|
-
|
48
|
+
expect {
|
49
49
|
ENV['BUNDLE_GEMFILE'] = "omg.rb"
|
50
50
|
Bundler.load
|
51
|
-
}.
|
51
|
+
}.to raise_error(Bundler::GemfileNotFound, /omg\.rb/)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "does not find a Gemfile above the testing directory" do
|
@@ -58,7 +58,7 @@ describe "Bundler.load" do
|
|
58
58
|
@remove_bundler_gemfile = true
|
59
59
|
end
|
60
60
|
begin
|
61
|
-
|
61
|
+
expect { Bundler.load }.to raise_error(Bundler::GemfileNotFound)
|
62
62
|
ensure
|
63
63
|
bundler_gemfile.rmtree if @remove_bundler_gemfile
|
64
64
|
end
|
@@ -86,7 +86,7 @@ describe "Bundler.load" do
|
|
86
86
|
end
|
87
87
|
RUBY
|
88
88
|
|
89
|
-
out.split("\n").
|
89
|
+
expect(out.split("\n")).to eq(["1.0.0", "no activesupport"])
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -98,8 +98,8 @@ describe "Bundler.load" do
|
|
98
98
|
G
|
99
99
|
|
100
100
|
Bundler.load.specs.each do |spec|
|
101
|
-
spec.to_yaml.
|
102
|
-
spec.to_yaml.
|
101
|
+
expect(spec.to_yaml).not_to match(/^\s+source:/)
|
102
|
+
expect(spec.to_yaml).not_to match(/^\s+groups:/)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -48,32 +48,32 @@ describe "Bundler.require" do
|
|
48
48
|
it "requires the gems" do
|
49
49
|
# default group
|
50
50
|
run "Bundler.require"
|
51
|
-
out.
|
51
|
+
expect(out).to eq("two")
|
52
52
|
|
53
53
|
# specific group
|
54
54
|
run "Bundler.require(:bar)"
|
55
|
-
out.
|
55
|
+
expect(out).to eq("baz\nqux")
|
56
56
|
|
57
57
|
# default and specific group
|
58
58
|
run "Bundler.require(:default, :bar)"
|
59
|
-
out.
|
59
|
+
expect(out).to eq("baz\nqux\ntwo")
|
60
60
|
|
61
61
|
# specific group given as a string
|
62
62
|
run "Bundler.require('bar')"
|
63
|
-
out.
|
63
|
+
expect(out).to eq("baz\nqux")
|
64
64
|
|
65
65
|
# specific group declared as a string
|
66
66
|
run "Bundler.require(:string)"
|
67
|
-
out.
|
67
|
+
expect(out).to eq("six")
|
68
68
|
|
69
69
|
# required in resolver order instead of gemfile order
|
70
70
|
run("Bundler.require(:not)")
|
71
|
-
out.split("\n").sort.
|
71
|
+
expect(out.split("\n").sort).to eq(['seven', 'three'])
|
72
72
|
end
|
73
73
|
|
74
74
|
it "allows requiring gems with non standard names explicitly" do
|
75
75
|
run "Bundler.require ; require 'mofive'"
|
76
|
-
out.
|
76
|
+
expect(out).to eq("two\nfive")
|
77
77
|
end
|
78
78
|
|
79
79
|
it "raises an exception if a require is specified but the file does not exist" do
|
@@ -86,7 +86,7 @@ describe "Bundler.require" do
|
|
86
86
|
Bundler.require
|
87
87
|
R
|
88
88
|
|
89
|
-
err.
|
89
|
+
expect(err).to eq("ZOMG LOAD ERROR")
|
90
90
|
end
|
91
91
|
|
92
92
|
describe "with namespaced gems" do
|
@@ -104,7 +104,7 @@ describe "Bundler.require" do
|
|
104
104
|
G
|
105
105
|
|
106
106
|
run "Bundler.require"
|
107
|
-
out.
|
107
|
+
expect(out).to eq("jquery/rails")
|
108
108
|
end
|
109
109
|
|
110
110
|
it "silently passes if the require fails" do
|
@@ -122,7 +122,7 @@ describe "Bundler.require" do
|
|
122
122
|
RUBY
|
123
123
|
ruby(cmd, :expect_err => true)
|
124
124
|
|
125
|
-
err.
|
125
|
+
expect(err).to be_empty
|
126
126
|
end
|
127
127
|
|
128
128
|
it "does not mangle explictly given requires" do
|
@@ -134,7 +134,7 @@ describe "Bundler.require" do
|
|
134
134
|
load_error_run <<-R, 'jquery-rails'
|
135
135
|
Bundler.require
|
136
136
|
R
|
137
|
-
err.
|
137
|
+
expect(err).to eq("ZOMG LOAD ERROR")
|
138
138
|
end
|
139
139
|
|
140
140
|
it "handles the case where regex fails" do
|
@@ -156,20 +156,20 @@ describe "Bundler.require" do
|
|
156
156
|
RUBY
|
157
157
|
run(cmd, :expect_err => true)
|
158
158
|
|
159
|
-
err.
|
159
|
+
expect(err).to eq("ZOMG LOAD ERROR")
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
163
|
describe "using bundle exec" do
|
164
164
|
it "requires the locked gems" do
|
165
165
|
bundle "exec ruby -e 'Bundler.require'"
|
166
|
-
out.
|
166
|
+
expect(out).to eq("two")
|
167
167
|
|
168
168
|
bundle "exec ruby -e 'Bundler.require(:bar)'"
|
169
|
-
out.
|
169
|
+
expect(out).to eq("baz\nqux")
|
170
170
|
|
171
171
|
bundle "exec ruby -e 'Bundler.require(:default, :bar)'"
|
172
|
-
out.
|
172
|
+
expect(out).to eq("baz\nqux\ntwo")
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
@@ -206,7 +206,7 @@ describe "Bundler.require" do
|
|
206
206
|
G
|
207
207
|
|
208
208
|
run "Bundler.require"
|
209
|
-
out.
|
209
|
+
expect(out).to eq("two\nmodule_two\none")
|
210
210
|
end
|
211
211
|
|
212
212
|
describe "a gem with different requires for different envs" do
|
@@ -224,17 +224,17 @@ describe "Bundler.require" do
|
|
224
224
|
|
225
225
|
it "requires both with Bundler.require(both)" do
|
226
226
|
run "Bundler.require(:one, :two)"
|
227
|
-
out.
|
227
|
+
expect(out).to eq("ONE\nTWO")
|
228
228
|
end
|
229
229
|
|
230
230
|
it "requires one with Bundler.require(:one)" do
|
231
231
|
run "Bundler.require(:one)"
|
232
|
-
out.
|
232
|
+
expect(out).to eq("ONE")
|
233
233
|
end
|
234
234
|
|
235
235
|
it "requires :two with Bundler.require(:two)" do
|
236
236
|
run "Bundler.require(:two)"
|
237
|
-
out.
|
237
|
+
expect(out).to eq("TWO")
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
@@ -246,7 +246,7 @@ describe "Bundler.require" do
|
|
246
246
|
G
|
247
247
|
|
248
248
|
run "Bundler.require"
|
249
|
-
out.
|
249
|
+
expect(out).to eq("two_not_loaded\none\ntwo")
|
250
250
|
end
|
251
251
|
|
252
252
|
describe "with busted gems" do
|
@@ -262,7 +262,7 @@ describe "Bundler.require" do
|
|
262
262
|
load_error_run <<-R, 'no_such_file_omg'
|
263
263
|
Bundler.require
|
264
264
|
R
|
265
|
-
err.
|
265
|
+
expect(err).to eq('ZOMG LOAD ERROR')
|
266
266
|
end
|
267
267
|
end
|
268
268
|
end
|
@@ -281,7 +281,7 @@ describe "Bundler.require with platform specific dependencies" do
|
|
281
281
|
G
|
282
282
|
|
283
283
|
run "Bundler.require", :expect_err => true
|
284
|
-
err.
|
284
|
+
expect(err).to be_empty
|
285
285
|
end
|
286
286
|
|
287
287
|
it "requires gems pinned to multiple platforms, including the current one" do
|
@@ -295,7 +295,7 @@ describe "Bundler.require with platform specific dependencies" do
|
|
295
295
|
|
296
296
|
run "Bundler.require; puts RACK", :expect_err => true
|
297
297
|
|
298
|
-
out.
|
299
|
-
err.
|
298
|
+
expect(out).to eq("1.0.0")
|
299
|
+
expect(err).to be_empty
|
300
300
|
end
|
301
301
|
end
|