bundler 1.3.6 → 1.4.0.pre.1

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.

Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -3
  3. data/CHANGELOG.md +27 -14
  4. data/CONTRIBUTING.md +2 -2
  5. data/{CONTRIBUTE.md → DEVELOPMENT.md} +31 -12
  6. data/ISSUES.md +1 -1
  7. data/README.md +6 -4
  8. data/Rakefile +1 -15
  9. data/bin/bundle +5 -8
  10. data/bundler.gemspec +1 -1
  11. data/lib/bundler.rb +37 -21
  12. data/lib/bundler/cli.rb +33 -21
  13. data/lib/bundler/constants.rb +5 -0
  14. data/lib/bundler/current_ruby.rb +88 -0
  15. data/lib/bundler/definition.rb +35 -11
  16. data/lib/bundler/dependency.rb +7 -78
  17. data/lib/bundler/dsl.rb +1 -1
  18. data/lib/bundler/fetcher.rb +37 -24
  19. data/lib/bundler/gem_helper.rb +2 -2
  20. data/lib/bundler/gem_installer.rb +9 -0
  21. data/lib/bundler/installer.rb +76 -7
  22. data/lib/bundler/parallel_workers.rb +18 -0
  23. data/lib/bundler/parallel_workers/thread_worker.rb +27 -0
  24. data/lib/bundler/parallel_workers/unix_worker.rb +88 -0
  25. data/lib/bundler/parallel_workers/worker.rb +68 -0
  26. data/lib/bundler/resolver.rb +17 -11
  27. data/lib/bundler/rubygems_ext.rb +2 -2
  28. data/lib/bundler/rubygems_integration.rb +37 -25
  29. data/lib/bundler/runtime.rb +8 -1
  30. data/lib/bundler/safe_catch.rb +101 -0
  31. data/lib/bundler/shared_helpers.rb +27 -1
  32. data/lib/bundler/source/git.rb +2 -1
  33. data/lib/bundler/source/git/git_proxy.rb +3 -3
  34. data/lib/bundler/source/path.rb +3 -2
  35. data/lib/bundler/source/rubygems.rb +5 -17
  36. data/lib/bundler/spec_set.rb +16 -1
  37. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  38. data/lib/bundler/vendor/net/http/persistent.rb +136 -38
  39. data/lib/bundler/vendor/thor.rb +211 -188
  40. data/lib/bundler/vendor/thor/actions.rb +19 -19
  41. data/lib/bundler/vendor/thor/actions/create_link.rb +3 -0
  42. data/lib/bundler/vendor/thor/actions/directory.rb +30 -10
  43. data/lib/bundler/vendor/thor/actions/empty_directory.rb +3 -19
  44. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +6 -3
  45. data/lib/bundler/vendor/thor/base.rb +101 -97
  46. data/lib/bundler/vendor/thor/{task.rb → command.rb} +17 -13
  47. data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +12 -0
  48. data/lib/bundler/vendor/thor/error.rb +8 -11
  49. data/lib/bundler/vendor/thor/group.rb +35 -38
  50. data/lib/bundler/vendor/thor/invocation.rb +28 -26
  51. data/lib/bundler/vendor/thor/parser/options.rb +21 -19
  52. data/lib/bundler/vendor/thor/rake_compat.rb +3 -2
  53. data/lib/bundler/vendor/thor/runner.rb +22 -21
  54. data/lib/bundler/vendor/thor/shell/basic.rb +44 -22
  55. data/lib/bundler/vendor/thor/shell/color.rb +13 -9
  56. data/lib/bundler/vendor/thor/shell/html.rb +13 -9
  57. data/lib/bundler/vendor/thor/util.rb +214 -210
  58. data/lib/bundler/vendor/thor/version.rb +1 -1
  59. data/lib/bundler/version.rb +1 -1
  60. data/man/bundle-install.ronn +5 -1
  61. data/man/gemfile.5.ronn +10 -2
  62. data/spec/bundler/dsl_spec.rb +3 -3
  63. data/spec/bundler/gem_helper_spec.rb +14 -17
  64. data/spec/bundler/safe_catch_spec.rb +37 -0
  65. data/spec/install/gems/dependency_api_spec.rb +1 -36
  66. data/spec/install/gems/packed_spec.rb +4 -2
  67. data/spec/install/gems/resolving_spec.rb +37 -0
  68. data/spec/install/gems/simple_case_spec.rb +18 -16
  69. data/spec/install/git_spec.rb +1 -1
  70. data/spec/other/binstubs_spec.rb +24 -13
  71. data/spec/other/exec_spec.rb +24 -2
  72. data/spec/other/help_spec.rb +6 -6
  73. data/spec/other/outdated_spec.rb +3 -3
  74. data/spec/quality_spec.rb +3 -2
  75. data/spec/realworld/dependency_api_spec.rb +1 -1
  76. data/spec/realworld/edgecases_spec.rb +3 -3
  77. data/spec/realworld/parallel_install_spec.rb +19 -0
  78. data/spec/resolver/basic_spec.rb +11 -0
  79. data/spec/runtime/require_spec.rb +9 -0
  80. data/spec/runtime/setup_spec.rb +2 -3
  81. data/spec/spec_helper.rb +0 -1
  82. data/spec/support/builders.rb +2 -4
  83. data/spec/support/helpers.rb +4 -8
  84. data/spec/support/indexes.rb +18 -0
  85. data/spec/support/streams.rb +13 -0
  86. metadata +19 -11
  87. data/lib/bundler/vendor/thor/core_ext/dir_escape.rb +0 -0
  88. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +0 -9
  89. data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
  90. data/spec/support/permissions.rb +0 -11
@@ -1,3 +1,3 @@
1
1
  class Thor
2
- VERSION = "0.16.0"
2
+ VERSION = "0.18.1"
3
3
  end
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.3.6" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.4.0.pre.1" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -10,6 +10,7 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
10
10
  [--binstubs[=DIRECTORY]]
11
11
  [--standalone[=GROUP1[ GROUP2...]]]
12
12
  [--trust-policy=POLICY]
13
+ [--jobs=SIZE]
13
14
  [--no-cache]
14
15
  [--quiet]
15
16
 
@@ -59,7 +60,7 @@ update process below under [CONSERVATIVE UPDATING][].
59
60
  Do not attempt to connect to `rubygems.org`, instead using just
60
61
  the gems already present in Rubygems' cache or in `vendor/cache`.
61
62
  Note that if a more appropriate platform-specific gem exists on
62
- `rubygems.org`, it will not be found.
63
+ `rubygems.org`, it will not be found. This option implies `--no-cache`.
63
64
 
64
65
  * `--deployment`:
65
66
  Switches bundler's defaults into [deployment mode][DEPLOYMENT MODE].
@@ -88,6 +89,9 @@ update process below under [CONSERVATIVE UPDATING][].
88
89
  HighSecurity, MediumSecurity, LowSecurity, or NoSecurity. For more detail,
89
90
  see the Rubygems signing documentation, linked below in [SEE ALSO][].
90
91
 
92
+ * `--jobs=[<size>]`:
93
+ Install gems parallely by starting <size> number of parallel workers.
94
+
91
95
  * `--no-cache`:
92
96
  Do not update the cache in `vendor/cache` with the newly bundled gems. This
93
97
  does not remove any existing cached gems, only stops the newly bundled gems
@@ -74,16 +74,19 @@ Each _gem_ `MAY` have one or more version specifiers.
74
74
  ### REQUIRE AS (:require)
75
75
 
76
76
  Each _gem_ `MAY` specify files that should be used when autorequiring via
77
- `Bundler.require`. You may pass an array with multiple files, or `false` to
77
+ `Bundler.require`. You may pass an array with multiple files or `true` if file
78
+ you want `required` has same name as _gem_ or `false` to
78
79
  prevent any file from being autorequired.
79
80
 
80
81
  gem "redis", :require => ["redis/connection/hiredis", "redis"]
81
82
  gem "webmock", :require => false
83
+ gem "debugger", :require => true
82
84
 
83
85
  The argument defaults to the name of the gem. For example, these are identical:
84
86
 
85
87
  gem "nokogiri"
86
88
  gem "nokogiri", :require => "nokogiri"
89
+ gem "nokogiri", :require => true
87
90
 
88
91
  ### GROUPS (:group or :groups)
89
92
 
@@ -196,7 +199,8 @@ as they would for a normal gem.
196
199
  A git repository `SHOULD` have at least one file, at the root of the
197
200
  directory containing the gem, with the extension `.gemspec`. This file
198
201
  `MUST` contain a valid gem specification, as expected by the `gem build`
199
- command.
202
+ command. It `MUST NOT` have any dependencies, other than on the files in
203
+ the git repository itself and any built-in functionality of Ruby or Rubygems.
200
204
 
201
205
  If a git repository does not have a `.gemspec`, bundler will attempt to
202
206
  create one, but it will not contain any dependencies, executables, or
@@ -257,6 +261,10 @@ Are both equivalent to
257
261
 
258
262
  gem "rails", :git => "git://github.com/rails/rails.git"
259
263
 
264
+ In addition, if you wish to choose a specific branch:
265
+
266
+ gem "rails", :github => "rails/rails", :branch => "branch_name"
267
+
260
268
  ### PATH (:path)
261
269
 
262
270
  You can specify that a gem is located in a particular location
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe Bundler::Dsl do
4
4
  before do
5
- @rubygems = mock("rubygems")
5
+ @rubygems = double("rubygems")
6
6
  Bundler::Source::Rubygems.stub(:new){ @rubygems }
7
7
  end
8
8
 
9
9
  describe "#_normalize_options" do
10
10
  it "converts :github to :git" do
11
11
  subject.gem("sparks", :github => "indirect/sparks")
12
- github_uri = "git://github.com/indirect/sparks.git"
12
+ github_uri = "https://github.com/indirect/sparks.git"
13
13
  expect(subject.dependencies.first.source.uri).to eq(github_uri)
14
14
  end
15
15
 
@@ -27,7 +27,7 @@ describe Bundler::Dsl do
27
27
 
28
28
  it "converts 'rails' to 'rails/rails'" do
29
29
  subject.gem("rails", :github => "rails")
30
- github_uri = "git://github.com/rails/rails.git"
30
+ github_uri = "https://github.com/rails/rails.git"
31
31
  expect(subject.dependencies.first.source.uri).to eq(github_uri)
32
32
  end
33
33
  end
@@ -128,6 +128,14 @@ describe "Bundler::GemHelper tasks" do
128
128
  end
129
129
 
130
130
  describe "release" do
131
+ before do
132
+ Dir.chdir(@app) do
133
+ `git init`
134
+ `git config user.email "you@example.com"`
135
+ `git config user.name "name"`
136
+ end
137
+ end
138
+
131
139
  it "shouldn't push if there are unstaged files" do
132
140
  expect { @helper.release_gem }.to raise_error(/files that need to be committed/)
133
141
  end
@@ -140,15 +148,8 @@ describe "Bundler::GemHelper tasks" do
140
148
  it "raises an appropriate error if there is no git remote" do
141
149
  Bundler.ui.stub(:confirm => nil, :error => nil) # silence messages
142
150
 
143
- Dir.chdir(gem_repo1) {
144
- `git init --bare`
145
- }
146
- Dir.chdir(@app) {
147
- `git init`
148
- `git config user.email "you@example.com"`
149
- `git config user.name "name"`
150
- `git commit -a -m "initial commit"`
151
- }
151
+ Dir.chdir(gem_repo1) { `git init --bare` }
152
+ Dir.chdir(@app) { `git commit -a -m "initial commit"` }
152
153
 
153
154
  expect { @helper.release_gem }.to raise_error
154
155
  end
@@ -160,18 +161,13 @@ describe "Bundler::GemHelper tasks" do
160
161
 
161
162
  @helper.should_receive(:rubygem_push).with(bundled_app('test/pkg/test-0.0.1.gem').to_s)
162
163
 
163
- Dir.chdir(gem_repo1) {
164
- `git init --bare`
165
- }
166
- Dir.chdir(@app) {
167
- `git init`
168
- `git config user.email "you@example.com"`
169
- `git config user.name "name"`
164
+ Dir.chdir(gem_repo1) { `git init --bare` }
165
+ Dir.chdir(@app) do
170
166
  `git remote add origin file://#{gem_repo1}`
171
167
  `git commit -a -m "initial commit"`
172
168
  sys_exec("git push origin master", true)
173
169
  `git commit -a -m "another commit"`
174
- }
170
+ end
175
171
  @helper.release_gem
176
172
  end
177
173
 
@@ -193,6 +189,7 @@ describe "Bundler::GemHelper tasks" do
193
189
  }
194
190
  @helper.release_gem
195
191
  end
192
+
196
193
  end
197
194
  end
198
195
  end
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'bundler'
4
+ require "bundler/safe_catch"
5
+ require "bundler/current_ruby"
6
+
7
+ class RecursiveTmpResolver
8
+ include Bundler::SafeCatch
9
+ end
10
+
11
+ describe Bundler::SafeCatch do
12
+ let(:resolver) { RecursiveTmpResolver.new() }
13
+
14
+ it "should use safe_catch on jruby" do
15
+ if Bundler.current_ruby.jruby?
16
+ Bundler::SafeCatch::Internal.should_receive(:catch).and_call_original
17
+ Bundler::SafeCatch::Internal.should_receive(:throw).and_call_original
18
+
19
+ retval = resolver.safe_catch(:resolve) do
20
+ resolver.safe_throw(:resolve, "good bye world")
21
+ end
22
+ expect(retval).to eq("good bye world")
23
+ end
24
+ end
25
+
26
+ it "should use regular catch/throw on MRI" do
27
+ if Bundler.current_ruby.mri?
28
+ Bundler::SafeCatch::Internal.should_not_receive(:catch)
29
+ Bundler::SafeCatch::Internal.should_not_receive(:throw)
30
+
31
+ retval = resolver.safe_catch(:resolve) do
32
+ resolver.safe_throw(:resolve, "good bye world")
33
+ end
34
+ expect(retval).to eq("good bye world")
35
+ end
36
+ end
37
+ end
@@ -162,40 +162,6 @@ describe "gemcutter's dependency API" do
162
162
  should_be_installed "rack 1.0.0"
163
163
  end
164
164
 
165
- it "handles host redirects" do
166
- gemfile <<-G
167
- source "#{source_uri}"
168
- gem "rack"
169
- G
170
-
171
- bundle :install, :artifice => "endpoint_host_redirect"
172
- should_be_installed "rack 1.0.0"
173
- end
174
-
175
- it "handles host redirects without Net::HTTP::Persistent" do
176
- gemfile <<-G
177
- source "#{source_uri}"
178
- gem "rack"
179
- G
180
-
181
- FileUtils.mkdir_p lib_path
182
- File.open(lib_path("disable_net_http_persistent.rb"), "w") do |h|
183
- h.write <<-H
184
- module Kernel
185
- alias require_without_disabled_net_http require
186
- def require(*args)
187
- raise LoadError, 'simulated' if args.first == 'openssl' && !caller.grep(/vendored_persistent/).empty?
188
- require_without_disabled_net_http(*args)
189
- end
190
- end
191
- H
192
- end
193
-
194
- bundle :install, :artifice => "endpoint_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")]
195
- expect(out).to_not match(/Too many redirects/)
196
- should_be_installed "rack 1.0.0"
197
- end
198
-
199
165
  it "timeouts when Bundler::Fetcher redirects too much" do
200
166
  gemfile <<-G
201
167
  source "#{source_uri}"
@@ -334,7 +300,7 @@ describe "gemcutter's dependency API" do
334
300
  expect(out).to include("Fetching gem metadata from #{source_uri}")
335
301
  end
336
302
 
337
- fit "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do
303
+ it "should install when EndpointSpecification has a bin dir owned by root", :sudo => true do
338
304
  sudo "mkdir -p #{system_gem_path("bin")}"
339
305
  sudo "chown -R root #{system_gem_path("bin")}"
340
306
 
@@ -343,7 +309,6 @@ describe "gemcutter's dependency API" do
343
309
  gem "rails"
344
310
  G
345
311
  bundle :install, :artifice => "endpoint"
346
- puts out, err
347
312
  should_be_installed "rails 2.3.2"
348
313
  end
349
314
 
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe "bundle install with gem sources" do
4
4
  describe "when cached and locked" do
5
- it "does not hit the remote at all" do
5
+ it "does not hit the remote at all if --local is passed" do
6
6
  build_repo2
7
7
  install_gemfile <<-G
8
8
  source "file://#{gem_repo2}"
@@ -14,10 +14,11 @@ describe "bundle install with gem sources" do
14
14
  FileUtils.rm_rf gem_repo2
15
15
 
16
16
  bundle "install --local"
17
+ expect(out).not_to include("Updating files in vendor/cache")
17
18
  should_be_installed "rack 1.0.0"
18
19
  end
19
20
 
20
- it "does not hit the remote at all" do
21
+ it "does not hit the remote at all if --deployment is passed" do
21
22
  build_repo2
22
23
  install_gemfile <<-G
23
24
  source "file://#{gem_repo2}"
@@ -29,6 +30,7 @@ describe "bundle install with gem sources" do
29
30
  FileUtils.rm_rf gem_repo2
30
31
 
31
32
  bundle "install --deployment"
33
+ expect(out).not_to include("Updating files in vendor/cache")
32
34
  should_be_installed "rack 1.0.0"
33
35
  end
34
36
 
@@ -67,6 +67,43 @@ describe "bundle install with gem sources" do
67
67
 
68
68
  should_be_installed "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0"
69
69
  end
70
+
71
+ context "with ENV['DEBUG_RESOLVER'] set" do
72
+ before do
73
+ ENV['DEBUG_RESOLVER'] = '1'
74
+ end
75
+ it "produces debug output" do
76
+ expect(capture(:stdout) do
77
+ install_gemfile <<-G
78
+ source "file://#{gem_repo1}"
79
+ gem "net_c"
80
+ gem "net_e"
81
+ G
82
+ end).to include "==== Iterating ===="
83
+ end
84
+ after do
85
+ ENV['DEBUG_RESOLVER'] = nil
86
+ end
87
+ end
88
+
89
+ context "with ENV['DEBUG_RESOLVER_TREE'] set" do
90
+ before do
91
+ ENV['DEBUG_RESOLVER_TREE'] = '1'
92
+ end
93
+ it "produces debug output" do
94
+ expect(capture(:stdout) do
95
+ install_gemfile <<-G
96
+ source "file://#{gem_repo1}"
97
+ gem "net_c"
98
+ gem "net_e"
99
+ G
100
+ end).to include " net_b (>= 0) ruby"
101
+ end
102
+ after do
103
+ ENV['DEBUG_RESOLVER_TREE'] = nil
104
+ end
105
+ end
106
+
70
107
  end
71
108
 
72
109
  describe "when some gems require a different version of ruby" do
@@ -337,22 +337,6 @@ describe "bundle install with gem sources" do
337
337
  G
338
338
  expect(exitstatus).to eq(0)
339
339
  end
340
-
341
- it "reinstalls the gem if the gem dir is missing but the specification file exists" do
342
- gemfile(<<-G)
343
- source "file://#{gem_repo1}"
344
-
345
- gem 'foo'
346
- G
347
-
348
- bundle "install --path vendor/bundle"
349
-
350
- FileUtils.rm_rf(vendored_gems('gems/foo-1.0'))
351
-
352
- bundle "install"
353
-
354
- expect(vendored_gems('gems/foo-1.0')).to exist
355
- end
356
340
  end
357
341
 
358
342
  describe "when Bundler root contains regex chars" do
@@ -830,4 +814,22 @@ describe "bundle install with gem sources" do
830
814
  end
831
815
  end
832
816
 
817
+ it "should use gemspecs in the system cache when available" do
818
+ gemfile <<-G
819
+ source "http://localtestserver.gem"
820
+ gem 'rack'
821
+ G
822
+
823
+ FileUtils.mkdir_p "#{tmp}/gems/system/specifications"
824
+ File.open("#{tmp}/gems/system/specifications/rack-1.0.0.gemspec", 'w+') do |f|
825
+ spec = Gem::Specification.new do |s|
826
+ s.name = 'rack'
827
+ s.version = '1.0.0'
828
+ s.add_runtime_dependency 'activesupport', '2.3.2'
829
+ end
830
+ f.write spec.to_ruby
831
+ end
832
+ bundle :install, :artifice => 'endpoint_marshal_fail' # force gemspec load
833
+ should_be_installed "activesupport 2.3.2"
834
+ end
833
835
  end
@@ -34,7 +34,7 @@ describe "bundle install with git sources" do
34
34
  git = update_git "foo" do |s|
35
35
  s.executables = ["foobar"] # we added this the first time, so keep it now
36
36
  s.files = ["bin/foobar"] # updating git nukes the files list
37
- foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files -z`.split("\x0")')
37
+ foospec = s.to_ruby.gsub(/s\.files.*/, 's.files = `git ls-files`.split("\n")')
38
38
  s.write "foo.gemspec", foospec
39
39
  end
40
40
 
@@ -26,6 +26,30 @@ describe "bundle binstubs <gem>" do
26
26
  expect(bundled_app("bin/rails")).to exist
27
27
  end
28
28
 
29
+ it "does install multiple binstubs" do
30
+ install_gemfile <<-G
31
+ source "file://#{gem_repo1}"
32
+ gem "rack"
33
+ gem "rails"
34
+ G
35
+
36
+ bundle "binstubs rails rack"
37
+
38
+ expect(bundled_app("bin/rackup")).to exist
39
+ expect(bundled_app("bin/rails")).to exist
40
+ end
41
+
42
+ it "displays an error when used without any gem" do
43
+ install_gemfile <<-G
44
+ source "file://#{gem_repo1}"
45
+ gem "rack"
46
+ G
47
+
48
+ bundle "binstubs", :exitstatus => true
49
+ expect(exitstatus).to eq(1)
50
+ expect(out).to eq("`bundle binstubs` needs at least one gem to run.")
51
+ end
52
+
29
53
  it "does not bundle the bundler binary" do
30
54
  install_gemfile <<-G
31
55
  source "file://#{gem_repo1}"
@@ -66,19 +90,6 @@ describe "bundle binstubs <gem>" do
66
90
 
67
91
  expect(bundled_app("bin/foo")).to exist
68
92
  end
69
-
70
- it "sets correct permissions for binstubs" do
71
- with_umask(0002) do
72
- install_gemfile <<-G
73
- source "file://#{gem_repo1}"
74
- gem "rack"
75
- G
76
-
77
- bundle "binstubs rack"
78
- binary = bundled_app("bin/rackup")
79
- expect(File.stat(binary).mode.to_s(8)).to eq("100775")
80
- end
81
- end
82
93
  end
83
94
 
84
95
  context "--path" do
@@ -39,6 +39,12 @@ describe "bundle exec" do
39
39
  expect(out).to eq("exec")
40
40
  end
41
41
 
42
+ it "works when exec'ing to ruby" do
43
+ install_gemfile 'gem "rack"'
44
+ bundle "exec ruby -e 'puts %{hi}'"
45
+ expect(out).to eq("hi")
46
+ end
47
+
42
48
  it "accepts --verbose" do
43
49
  install_gemfile 'gem "rack"'
44
50
  bundle "exec --verbose echo foobar"
@@ -108,13 +114,13 @@ describe "bundle exec" do
108
114
  should_not_be_installed "rack_middleware 1.0"
109
115
  end
110
116
 
111
- it "should not duplicate already exec'ed RUBYOPT or PATH" do
117
+ it "does not duplicate already exec'ed RUBYOPT" do
112
118
  install_gemfile <<-G
113
119
  gem "rack"
114
120
  G
115
121
 
116
122
  rubyopt = ENV['RUBYOPT']
117
- rubyopt = "-I#{bundler_path} -rbundler/setup #{rubyopt}"
123
+ rubyopt = "-rbundler/setup #{rubyopt}"
118
124
 
119
125
  bundle "exec 'echo $RUBYOPT'"
120
126
  expect(out).to have_rubyopts(rubyopt)
@@ -123,6 +129,22 @@ describe "bundle exec" do
123
129
  expect(out).to have_rubyopts(rubyopt)
124
130
  end
125
131
 
132
+ it "does not duplicate already exec'ed RUBYLIB" do
133
+ install_gemfile <<-G
134
+ gem "rack"
135
+ G
136
+
137
+ rubylib = ENV['RUBYLIB']
138
+ rubylib = "#{rubylib}".split(File::PATH_SEPARATOR).unshift "#{bundler_path}"
139
+ rubylib = rubylib.uniq.join(File::PATH_SEPARATOR)
140
+
141
+ bundle "exec 'echo $RUBYLIB'"
142
+ expect(out).to eq(rubylib)
143
+
144
+ bundle "exec 'echo $RUBYLIB'", :env => {"RUBYLIB" => rubylib}
145
+ expect(out).to eq(rubylib)
146
+ end
147
+
126
148
  it "errors nicely when the argument doesn't exist" do
127
149
  install_gemfile <<-G
128
150
  gem "rack"