summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/rubygems_integration.rb2
-rw-r--r--lib/bundler/source/git.rb20
-rw-r--r--lib/bundler/source/path.rb17
3 files changed, 20 insertions, 19 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 3872997904..f139e9d337 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 4f8397bd4b..d5b10f37bb 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -220,19 +220,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 e4124a4653..88ca54bacc 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -173,6 +173,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
@@ -185,14 +186,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 " \