aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/installer.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-01 09:41:32 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-01 09:41:32 +0000
commit25a9b62d45ddd60a231272567c7dda9337da9b62 (patch)
treee72ba4c9c01cba5fb510eb1eafaba76d998baf4c /lib/rubygems/installer.rb
parent86bb0af7ea3b50f72e6845a6f5f64cb1b23fd279 (diff)
downloadruby-25a9b62d45ddd60a231272567c7dda9337da9b62.tar.gz
Import rubygems 1.6.0 (released version @ 58d8a0b9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/installer.rb')
-rw-r--r--lib/rubygems/installer.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 5c7c57685b..8c6aeb44c7 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -156,6 +156,9 @@ class Gem::Installer
Gem.ensure_gem_subdirectories @gem_home
+ # Completely remove any previous gem files
+ FileUtils.rm_rf(@gem_dir) if File.exist?(@gem_dir)
+
FileUtils.mkdir_p @gem_dir
extract_files
@@ -179,10 +182,9 @@ class Gem::Installer
write_require_paths_file_if_needed if Gem::QUICKLOADER_SUCKAGE
- # HACK remove? Isn't this done in multiple places?
- cached_gem = File.join @gem_home, "cache", @gem.split(/\//).pop
+ cached_gem = Gem.cache_gem(File.basename(@gem), @gem_home)
unless File.exist? cached_gem then
- FileUtils.cp @gem, File.join(@gem_home, "cache")
+ FileUtils.cp @gem, Gem.cache_dir(@gem_home)
end
say @spec.post_install_message unless @spec.post_install_message.nil?
@@ -235,7 +237,7 @@ class Gem::Installer
# specifications directory.
def write_spec
- rubycode = @spec.to_ruby
+ rubycode = @spec.to_ruby_for_cache
file_name = File.join @gem_home, 'specifications', @spec.spec_name
@@ -275,8 +277,10 @@ class Gem::Installer
@spec.executables.each do |filename|
filename.untaint
bin_path = File.expand_path "#{@spec.bindir}/#{filename}", @gem_dir
- mode = File.stat(bin_path).mode | 0111
- File.chmod mode, bin_path
+ if File.exist?(bin_path)
+ mode = File.stat(bin_path).mode | 0111
+ File.chmod mode, bin_path
+ end
if @wrappers then
generate_bin_script filename, bindir
@@ -298,7 +302,7 @@ class Gem::Installer
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
- File.open bin_script_path, 'w', 0755 do |file|
+ File.open bin_script_path, 'wb', 0755 do |file|
file.print app_script_text(filename)
end