diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-01 03:45:05 +0000 |
commit | d22130922e7842226d38d59680e4bbb48a28a5f0 (patch) | |
tree | 39594d3a14641dd5488a99a5e633239296fa5742 /lib/rubygems/installer_test_case.rb | |
parent | 4752539e3f3e563d559732c52424206bd6f12dbd (diff) | |
download | ruby-d22130922e7842226d38d59680e4bbb48a28a5f0.tar.gz |
Import rubygems 1.8.5 (released @ 137c80f)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/installer_test_case.rb')
-rw-r--r-- | lib/rubygems/installer_test_case.rb | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/lib/rubygems/installer_test_case.rb b/lib/rubygems/installer_test_case.rb index 26b590786b..a548bd55f8 100644 --- a/lib/rubygems/installer_test_case.rb +++ b/lib/rubygems/installer_test_case.rb @@ -12,7 +12,7 @@ class Gem::Installer ## # Available through requiring rubygems/installer_test_case - attr_accessor :gem_dir + attr_writer :gem_dir ## # Available through requiring rubygems/installer_test_case @@ -63,29 +63,38 @@ class Gem::InstallerTestCase < Gem::TestCase def setup super - @spec = quick_gem 'a' - util_make_exec @spec + @installer_tmp = File.join @tempdir, 'installer' + FileUtils.mkdir_p @installer_tmp - @gem = File.join @tempdir, @spec.file_name + Gem.use_paths @installer_tmp + Gem.ensure_gem_subdirectories @installer_tmp - @installer = util_installer @spec, @gem, @gemhome + @spec = quick_gem 'a' + util_make_exec @spec + util_build_gem @spec + @gem = @spec.cache_file @user_spec = quick_gem 'b' util_make_exec @user_spec + util_build_gem @user_spec + @user_gem = @user_spec.cache_file + + Gem.use_paths @gemhome - @user_gem = File.join @tempdir, @user_spec.file_name + @installer = util_installer @spec, @gemhome + @user_installer = util_installer @user_spec, Gem.user_dir, :user - @user_installer = util_installer @user_spec, @user_gem, Gem.user_dir - @user_installer.gem_dir = File.join(Gem.user_dir, 'gems', - @user_spec.full_name) + Gem.use_paths @gemhome end def util_gem_bindir spec = @spec - File.join util_gem_dir(spec), "bin" + # TODO: deprecate + spec.bin_dir end def util_gem_dir spec = @spec - File.join @gemhome, "gems", spec.full_name + # TODO: deprecate + spec.gem_dir end def util_inst_bindir @@ -96,16 +105,13 @@ class Gem::InstallerTestCase < Gem::TestCase spec.executables = %w[executable] spec.files << 'bin/executable' - bindir = util_gem_bindir spec - FileUtils.mkdir_p bindir - exec_path = File.join bindir, 'executable' - open exec_path, 'w' do |io| + exec_path = spec.bin_file "executable" + write_file exec_path do |io| io.puts shebang end - temp_bin = File.join(@tempdir, 'bin') - FileUtils.mkdir_p temp_bin - open File.join(temp_bin, 'executable'), 'w' do |io| + bin_path = File.join @tempdir, "bin", "executable" + write_file bin_path do |io| io.puts shebang end end @@ -128,23 +134,15 @@ class Gem::InstallerTestCase < Gem::TestCase use_ui ui do FileUtils.rm @gem - Gem::Builder.new(@spec).build + + @gem = Gem::Builder.new(@spec).build end end @installer = Gem::Installer.new @gem end - def util_installer(spec, gem_path, gem_home) - util_build_gem spec - FileUtils.mv Gem.cache_gem(spec.file_name), @tempdir - installer = Gem::Installer.new gem_path - installer.gem_dir = util_gem_dir - installer.gem_home = gem_home - installer.spec = spec - - installer + def util_installer(spec, gem_home, user=false) + Gem::Installer.new spec.cache_file, :user_install => user end - end - |