Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix a bug with multiruby and bundle_path

  • Loading branch information...
commit 0021df9cb1beae0f61f0f9e9a1a1375a17734d30 1 parent c3c08e3
Carlhuda authored
18 lib/bundler/bundle.rb
@@ -26,10 +26,6 @@ def self.default_gemfile
26 26 raise DefaultManifestNotFound
27 27 end
28 28
29   - def self.default_gem_path(root)
30   - root.join("vendor/gems/#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}")
31   - end
32   -
33 29 # TODO: passing in the filename is not good
34 30 def initialize(gemfile)
35 31 @gemfile = gemfile
@@ -51,12 +47,16 @@ def root
51 47 gemfile.parent
52 48 end
53 49
54   - def gem_path
55   - @gem_path ||= self.class.default_gem_path(root)
  50 + def path
  51 + @path ||= root.join("vendor/gems")
56 52 end
57 53
58   - def gem_path=(path)
59   - @gem_path = (path.relative? ? root.join(path) : path).expand_path
  54 + def path=(path)
  55 + @path = (path.relative? ? root.join(path) : path).expand_path
  56 + end
  57 +
  58 + def gem_path
  59 + path.join("#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}")
60 60 end
61 61
62 62 def bindir
@@ -309,7 +309,7 @@ def configure(specs, options)
309 309 end
310 310
311 311 def generate_environment_picker
312   - FileUtils.cp("#{File.dirname(__FILE__)}/templates/environment_picker.erb", gem_path.join("../../environment.rb"))
  312 + FileUtils.cp("#{File.dirname(__FILE__)}/templates/environment_picker.erb", path.join("environment.rb"))
313 313 end
314 314
315 315 def require_code(file, dep)
2  lib/bundler/dsl.rb
@@ -19,7 +19,7 @@ def initialize(bundle, environment)
19 19 end
20 20
21 21 def bundle_path(path)
22   - @bundle.gem_path = Pathname.new(path)
  22 + @bundle.path = Pathname.new(path)
23 23 end
24 24
25 25 def bin_path(path)
8 spec/bundler/cli_spec.rb
@@ -188,7 +188,7 @@
188 188
189 189 describe "it working while specifying the manifest file name" do
190 190 it "works when the manifest is in the root directory" do
191   - build_manifest_file bundled_app('manifest.rb'), <<-Gemfile
  191 + manifest = build_manifest bundled_app('manifest.rb'), <<-Gemfile
192 192 bundle_path "gems"
193 193 clear_sources
194 194 source "file://#{gem_repo1}"
@@ -198,13 +198,13 @@
198 198 Dir.chdir(bundled_app) do
199 199 out = gem_command :bundle, "-m #{bundled_app('manifest.rb')}"
200 200 out.should include('Done.')
201   - bundled_app("gems").should have_cached_gems("rake-0.8.7")
  201 + manifest.gem_path.should have_cached_gems("rake-0.8.7")
202 202 tmp_bindir('rake').should exist
203 203 end
204 204 end
205 205
206 206 it "works when the manifest is in a different directory" do
207   - build_manifest_file bundled_app('config', 'manifest.rb'), <<-Gemfile
  207 + manifest = build_manifest bundled_app('config', 'manifest.rb'), <<-Gemfile
208 208 bundle_path "../gems"
209 209 clear_sources
210 210 source "file://#{gem_repo1}"
@@ -214,7 +214,7 @@
214 214 Dir.chdir(bundled_app)
215 215 out = gem_command :bundle, "-m #{bundled_app('config', 'manifest.rb')}"
216 216 out.should include('Done.')
217   - bundled_app("gems").should have_cached_gems("rake-0.8.7")
  217 + manifest.gem_path.should have_cached_gems("rake-0.8.7")
218 218 end
219 219
220 220 it "works when using a relative path to the manifest file" do
7 spec/bundler/manifest_file_spec.rb
@@ -54,6 +54,13 @@ def works
54 54 bundled_app('gems').should exist
55 55 end
56 56
  57 + it "sets the ruby-specific path relative to the bundle_path" do
  58 + simple_manifest %[bundle_path File.join('..', 'cheezeburgerz')]
  59 + goto 'w0t'
  60 + bundle
  61 + tmp_path("cheezeburgerz", Gem.ruby_engine, Gem::ConfigMap[:ruby_version], "environment.rb").should exist
  62 + end
  63 +
57 64 it "assumes the bundle_path is relative to the manifest file no matter what the current working dir is" do
58 65 simple_manifest %[bundle_path File.join('..', 'cheezeburgerz')]
59 66 goto 'w0t'
2  spec/support/path_utils.rb
@@ -15,7 +15,7 @@ def bundled_app(*path)
15 15 end
16 16
17 17 def bundled_path
18   - @bundled_path ||= Bundler::Bundle.default_gem_path(tmp_path.join('bundled_app'))
  18 + @bundled_path ||= bundled_app("vendor/gems/#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}")
19 19 end
20 20
21 21 def tmp_gem_path(*path)

0 comments on commit 0021df9

Please sign in to comment.
Something went wrong with that request. Please try again.