diff --git a/bundler/lib/bundler/stub_specification.rb b/bundler/lib/bundler/stub_specification.rb index 54a40c1c78da..c87b66ee19b0 100644 --- a/bundler/lib/bundler/stub_specification.rb +++ b/bundler/lib/bundler/stub_specification.rb @@ -30,7 +30,11 @@ def to_yaml # This is defined directly to avoid having to loading the full spec def missing_extensions? - stub.missing_extensions? + return false if default_gem? + return false if extensions.empty? + return false if File.exist? gem_build_complete_path + + true end def activated @@ -41,6 +45,14 @@ def activated=(activated) stub.instance_variable_set(:@activated, activated) end + def extensions + stub.extensions + end + + def gem_build_complete_path + File.join(extension_dir, "gem.build_complete") + end + def default_gem? stub.default_gem? end diff --git a/bundler/spec/commands/exec_spec.rb b/bundler/spec/commands/exec_spec.rb index bee832e4029c..f22963ed8e13 100644 --- a/bundler/spec/commands/exec_spec.rb +++ b/bundler/spec/commands/exec_spec.rb @@ -928,5 +928,24 @@ def bin_path(a,b,c) expect(err).to include("custom openssl should not be loaded") end end + + context "with a git gem that includes extensions" do + before do + build_git "simple_git_binary", &:add_c_extension + bundle! "config set --local path .bundle" + install_gemfile! <<-G + gem "simple_git_binary", :git => '#{lib_path("simple_git_binary-1.0")}' + G + end + + it "allows calling bundle install" do + bundle! "exec bundle install" + end + + it "allows calling bundle install after removing gem.build_complete" do + FileUtils.rm_rf Dir[bundled_app(".bundle/**/gem.build_complete")] + bundle! "exec #{Gem.ruby} -S bundle install" + end + end end end