Permalink
Browse files

Use Pathname to build relative paths for --destdir during setup.

git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1841 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information...
1 parent 3331df5 commit eb8ef704c7341709e076f831b379e424c20f0cc5 luislavena committed Jul 11, 2008
Showing with 19 additions and 7 deletions.
  1. +4 −0 ChangeLog
  2. +15 −7 setup.rb
View
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
+2008-07-11 Luis Lavena <luislavena@gmail.com>
+
+ * setup.rb: Properly build --destdir folder structure using Pathname.
+
2008-07-02 Phil Hagelberg <technomancy@gmail.com>
* lib/rubygems/defaults.rb: Add Gem.user_dir to use paths like
View
@@ -90,14 +90,17 @@
end
end
-unless install_destdir.empty? then
- ENV['GEM_HOME'] ||= File.join(install_destdir,
- Gem.default_dir.sub(/\A[a-z]:/i, ''))
-end
-
require 'fileutils'
require 'rbconfig'
require 'tmpdir'
+require 'pathname'
+
+unless install_destdir.empty? then
+ default_dir = Pathname.new(Gem.default_dir)
+ top_dir = Pathname.new(RbConfig::TOPDIR)
+ ENV['GEM_HOME'] ||= File.join(install_destdir,
+ default_dir.relative_path_from(top_dir))
+end
include FileUtils::Verbose
@@ -134,8 +137,12 @@
end
unless install_destdir.empty?
- lib_dir = File.join install_destdir, lib_dir
- bin_dir = File.join install_destdir, bin_dir
+ top_dir = Pathname.new(RbConfig::TOPDIR)
+ lib_dir_p = Pathname.new(lib_dir)
+ bin_dir_p = Pathname.new(bin_dir)
+
+ lib_dir = File.join install_destdir, lib_dir_p.relative_path_from(top_dir)
+ bin_dir = File.join install_destdir, bin_dir_p.relative_path_from(top_dir)
end
mkdir_p lib_dir
@@ -324,3 +331,4 @@ def run_rdoc(*args)
puts "to remove it by hand."
puts
+

0 comments on commit eb8ef70

Please sign in to comment.