summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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