diff options
author | Smit Shah <who828@gmail.com> | 2014-11-18 01:42:49 -0800 |
---|---|---|
committer | Smit Shah <who828@gmail.com> | 2014-11-18 15:52:52 -0800 |
commit | 48e90facfc57da4d44d2c90839fb8f8ff83f2355 (patch) | |
tree | 9dcdc5013b362a067d147b34be590a2c5df8b5cf | |
parent | d81391de8a6ede84aa488cd04eeab86c81b20e42 (diff) | |
download | bundler-48e90facfc57da4d44d2c90839fb8f8ff83f2355.tar.gz |
Fixed an issue with building git gems in parallel
We need to ensure that the dir remains the same
through out the installation of these gems,
this includes Path Installer as well as rubygems
build.
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/git.rb | 20 | ||||
-rw-r--r-- | lib/bundler/source/path.rb | 17 |
3 files changed, 20 insertions, 19 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index e73c2020d8..eb354605e7 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -193,7 +193,7 @@ module Bundler end def build_gem(gem_dir, spec) - SharedHelpers.chdir(gem_dir) { build(spec) } + build(spec) end def download_gem(spec, uri, path) diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index de13b8d167..756b96dcc2 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -216,19 +216,17 @@ module Bundler @allow_remote || @allow_cached end - private + private def serialize_gemspecs_in(destination) - SharedHelpers.chdir(destination) do - expanded_path = destination.expand_path(Bundler.root) - Dir["#{expanded_path}/#{@glob}"].each do |spec_path| - # Evaluate gemspecs and cache the result. Gemspecs - # in git might require git or other dependencies. - # The gemspecs we cache should already be evaluated. - spec = Bundler.load_gemspec(spec_path) - next unless spec - File.open(spec_path, 'wb') {|file| file.write(spec.to_ruby) } - end + expanded_path = destination.expand_path(Bundler.root) + Dir["#{expanded_path}/#{@glob}"].each do |spec_path| + # Evaluate gemspecs and cache the result. Gemspecs + # in git might require git or other dependencies. + # The gemspecs we cache should already be evaluated. + spec = Bundler.load_gemspec(spec_path) + next unless spec + File.open(spec_path, 'wb') {|file| file.write(spec.to_ruby) } end end diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 398ed6025a..0d0d3ae683 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -169,6 +169,7 @@ module Bundler def generate_bin(spec, disable_extensions = false) gem_dir = Pathname.new(spec.full_gem_path) + gem_file = nil # Some gem authors put absolute paths in their gemspec # and we have to save them from themselves @@ -181,14 +182,16 @@ module Bundler end end.compact - gem_file = Bundler.rubygems.build_gem gem_dir, spec + SharedHelpers.chdir(gem_dir) do + gem_file = Bundler.rubygems.build_gem gem_dir, spec - installer = Path::Installer.new(spec, :env_shebang => false) - run_hooks(:pre_install, installer) - installer.build_extensions unless disable_extensions - run_hooks(:post_build, installer) - installer.generate_bin - run_hooks(:post_install, installer) + installer = Path::Installer.new(spec, :env_shebang => false) + run_hooks(:pre_install, installer) + installer.build_extensions unless disable_extensions + run_hooks(:post_build, installer) + installer.generate_bin + run_hooks(:post_install, installer) + end rescue Gem::InvalidSpecificationException => e Bundler.ui.warn "\n#{spec.name} at #{spec.full_gem_path} did not have a valid gemspec.\n" \ "This prevents bundler from installing bins or native extensions, but " \ |