From cb39a1770b0a59d47e8b2ba2980045df337a598a Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Wed, 3 Feb 2016 21:57:49 -0800 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20rebuild=20already-built=20git?= =?UTF-8?q?=20gem=20extensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #4082 --- lib/bundler/source/git.rb | 4 ++++ lib/bundler/source/path.rb | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 90bbd13d34e..51fcd44dfdb 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -222,6 +222,10 @@ def allow_git_ops? private + def build_extensions(installer) + super if installer.spec.missing_extensions? + end + def serialize_gemspecs_in(destination) expanded_path = destination.expand_path(Bundler.root) Dir["#{expanded_path}/#{@glob}"].each do |spec_path| diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 10f19f48890..c5cf005cdbc 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -197,8 +197,7 @@ def generate_bin(spec, disable_extensions = false) SharedHelpers.chdir(gem_dir) do installer = Path::Installer.new(spec, :env_shebang => false) run_hooks(:pre_install, installer) - installer.build_extensions unless disable_extensions - run_hooks(:post_build, installer) + build_extensions(installer) unless disable_extensions installer.generate_bin run_hooks(:post_install, installer) end @@ -216,6 +215,11 @@ def generate_bin(spec, disable_extensions = false) Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}" end + def build_extensions(installer) + installer.build_extensions + run_hooks(:post_build, installer) + end + def run_hooks(type, installer) hooks_meth = "#{type}_hooks" return unless Gem.respond_to?(hooks_meth)