summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-08-01 15:59:36 -0700
committerAndre Arko <andre@arko.net>2015-08-01 16:03:19 -0700
commit8afd3906c1ea82fb570d087def8f4c562c9c5d01 (patch)
tree51215aa2b858f2e077a8a50dba1616ff25af6ee4
parent6a3096ba13e5760e2962f152a39830087f464a87 (diff)
parent6dc479afe4ff12cc6d641b82e697d03ecbbc7fa5 (diff)
downloadbundler-8afd3906c1ea82fb570d087def8f4c562c9c5d01.tar.gz
Merge pull request #3828 from AlexanderPavlenko/master
Fixes #3813 : --standalone generates incorrect paths for native extensions
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--spec/install/gems/standalone_spec.rb15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 9169148f74..2240c17f1a 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -230,7 +230,7 @@ module Bundler
next if spec.require_paths.nil? # builtin gems
spec.require_paths.each do |path|
- full_path = File.join(spec.full_gem_path, path)
+ full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
gem_path = Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path))
paths << gem_path.to_s.sub("#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG["ruby_version"]}", '#{ruby_engine}/#{ruby_version}') # rubocop:disable Style/StringLiterals
end
diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb
index 452b4663ae..f9e066fcfb 100644
--- a/spec/install/gems/standalone_spec.rb
+++ b/spec/install/gems/standalone_spec.rb
@@ -45,6 +45,21 @@ describe "bundle install --standalone" do
end
end
+ describe "with gems with native extension" do
+ before do
+ install_gemfile <<-G, :standalone => true
+ source "file://#{gem_repo1}"
+ gem "very_simple_binary"
+ G
+ end
+
+ it "generates a bundle/bundler/setup.rb with the proper paths" do
+ extension_line = File.read(bundled_app("bundle/bundler/setup.rb")).each_line.find {|line| line.include? "/extensions/" }.strip
+ expect(extension_line).to start_with '$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/'
+ expect(extension_line).to end_with '/very_simple_binary-1.0"'
+ end
+ end
+
describe "with a combination of gems and git repos" do
before do
build_git "devise", "1.0"