Skip to content

Commit

Permalink
Use Pathname to build relative paths for --destdir during setup.
Browse files Browse the repository at this point in the history
git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1841 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
luislavena committed Jul 11, 2008
1 parent 3331df5 commit eb8ef70
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -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
Expand Down
22 changes: 15 additions & 7 deletions setup.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.