summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2014-04-01 17:09:39 +0800
committerAndre Arko <andre@arko.net>2014-04-01 17:09:39 +0800
commit9007c941b4cb1fb03cbb188f23105e798d2736cf (patch)
treef85295b78ed038452b8bd4f837aaa52a0444549d
parent94fb577eb5ba7f6508f49526a31f21e2783be3b2 (diff)
downloadbundler-rubygems22_exts.tar.gz
handle extensions from Rubygems 2.2, with testrubygems22_exts
fixes #2847
-rw-r--r--lib/bundler/source/rubygems.rb10
-rw-r--r--spec/install/gems/sudo_spec.rb10
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index ce40cbc6c3..5179680ce0 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -100,9 +100,13 @@ module Bundler
# SUDO HAX
if Bundler.requires_sudo?
Bundler.rubygems.repository_subdirectories.each do |name|
- src = "#{install_path}/#{name}/*"
- dst = "#{Bundler.rubygems.gem_dir}/#{name}/"
- Bundler.mkdir_p dist
+ src = File.join(install_path, name, "*")
+ dst = File.join(Bundler.rubygems.gem_dir, name)
+ if name == "extensions"
+ src = File.join(src, "*/*")
+ dst = File.dirname(File.join(dst, Dir.glob(src).first.gsub(src[0..-6], '')))
+ end
+ Bundler.mkdir_p dst
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
end
diff --git a/spec/install/gems/sudo_spec.rb b/spec/install/gems/sudo_spec.rb
index 4985fafd3c..2fccfc0871 100644
--- a/spec/install/gems/sudo_spec.rb
+++ b/spec/install/gems/sudo_spec.rb
@@ -82,6 +82,16 @@ describe "when using sudo", :sudo => true do
expect(bundle_path.join("gems/rack-1.0.0").stat.uid).to eq(0)
should_be_installed "rack 1.0"
end
+
+ it "installs extensions/ compiled by Rubygems 2.2", :rubygems => "2.2" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "very_simple_binary"
+ G
+
+ binary = Dir.glob(system_gem_path("extensions/*/*/very_simple_binary-1.0/very_simple_binary_c.bundle")).first
+ expect(File.exist?(binary)).to be
+ end
end
describe "and BUNDLE_PATH is not writable" do