aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-04-18 10:38:48 -0700
committerAndre Arko <andre@arko.net>2010-04-23 09:58:16 -0700
commite48d96c9f41cda52375d244c9f6903afd05e3189 (patch)
tree9153666db691e87dff52e9750ab3a0c255f689a2 /lib
parent4673e128c8b1ba68deaec57f956286b420f267ff (diff)
downloadbundler-e48d96c9f41cda52375d244c9f6903afd05e3189.tar.gz
Don't try to remove a built gem unless it exists
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/source.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 960a154d..e08e195a 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -271,11 +271,7 @@ module Bundler
def generate_bin(spec)
gem_dir = spec.full_gem_path
- gem_file = nil # so we have access after it's set in the block
-
- Dir.chdir(gem_dir) do
- gem_file = Gem::Builder.new(spec).build
- end
+ gem_file = Dir.chdir(gem_dir){ Gem::Builder.new(spec).build }
installer = Gem::Installer.new File.join(gem_dir, gem_file),
:bin_dir => "#{Gem.dir}/bin",
@@ -300,7 +296,7 @@ module Bundler
Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}"
ensure
- Dir.chdir(gem_dir){ FileUtils.rm_rf(File.join(gem_dir, gem_file)) }
+ Dir.chdir(gem_dir){ FileUtils.rm_rf(gem_file) if gem_file && File.exist?(gem_file) }
end
end