2007-11-10 02:48:56 -05:00
|
|
|
#--
|
|
|
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
|
|
|
# All rights reserved.
|
|
|
|
# See LICENSE.txt for permissions.
|
|
|
|
#++
|
|
|
|
|
2008-03-31 18:40:06 -04:00
|
|
|
require File.join(File.expand_path(File.dirname(__FILE__)),
|
|
|
|
'gem_installer_test_case')
|
2007-11-10 02:48:56 -05:00
|
|
|
|
2008-03-31 18:40:06 -04:00
|
|
|
class TestGemInstaller < GemInstallerTestCase
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
def test_app_script_text
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', ''
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
expected = <<-EOF
|
|
|
|
#!#{Gem.ruby}
|
|
|
|
#
|
|
|
|
# This file was generated by RubyGems.
|
|
|
|
#
|
|
|
|
# The application 'a' is installed as part of a gem, and
|
|
|
|
# this file is here to facilitate running it.
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'rubygems'
|
|
|
|
|
|
|
|
version = \">= 0\"
|
|
|
|
|
|
|
|
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
|
|
|
|
version = $1
|
|
|
|
ARGV.shift
|
|
|
|
end
|
|
|
|
|
|
|
|
gem 'a', version
|
2009-06-09 17:38:59 -04:00
|
|
|
load Gem.bin_path('a', 'my_exec', version)
|
2007-11-10 02:48:56 -05:00
|
|
|
EOF
|
|
|
|
|
|
|
|
wrapper = @installer.app_script_text 'my_exec'
|
|
|
|
assert_equal expected, wrapper
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_build_extensions_none
|
|
|
|
use_ui @ui do
|
|
|
|
@installer.build_extensions
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal '', @ui.output
|
|
|
|
assert_equal '', @ui.error
|
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
refute File.exist?('gem_make.out')
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_build_extensions_extconf_bad
|
|
|
|
@spec.extensions << 'extconf.rb'
|
|
|
|
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::Installer::ExtensionBuildError do
|
2007-11-10 02:48:56 -05:00
|
|
|
use_ui @ui do
|
|
|
|
@installer.build_extensions
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_match(/\AERROR: Failed to build gem native extension.$/, e.message)
|
|
|
|
|
|
|
|
assert_equal "Building native extensions. This could take a while...\n",
|
|
|
|
@ui.output
|
|
|
|
assert_equal '', @ui.error
|
|
|
|
|
|
|
|
gem_make_out = File.join @gemhome, 'gems', @spec.full_name, 'gem_make.out'
|
|
|
|
expected = <<-EOF
|
|
|
|
#{Gem.ruby} extconf.rb
|
|
|
|
#{Gem.ruby}: No such file or directory -- extconf.rb (LoadError)
|
|
|
|
EOF
|
|
|
|
|
2008-09-25 06:13:50 -04:00
|
|
|
assert_match %r%#{Regexp.escape Gem.ruby} extconf.rb%,
|
|
|
|
File.read(gem_make_out)
|
|
|
|
assert_match %r%#{Regexp.escape Gem.ruby}: No such file%,
|
|
|
|
File.read(gem_make_out)
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_build_extensions_unsupported
|
|
|
|
@spec.extensions << nil
|
|
|
|
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::Installer::ExtensionBuildError do
|
2007-11-10 02:48:56 -05:00
|
|
|
use_ui @ui do
|
|
|
|
@installer.build_extensions
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_match(/^No builder for extension ''$/, e.message)
|
|
|
|
|
|
|
|
assert_equal "Building native extensions. This could take a while...\n",
|
|
|
|
@ui.output
|
|
|
|
assert_equal '', @ui.error
|
|
|
|
|
|
|
|
assert_equal "No builder for extension ''\n", File.read('gem_make.out')
|
|
|
|
ensure
|
|
|
|
FileUtils.rm_f 'gem_make.out'
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_ensure_dependency
|
2007-12-20 03:39:12 -05:00
|
|
|
dep = Gem::Dependency.new 'a', '>= 2'
|
2007-11-10 02:48:56 -05:00
|
|
|
assert @installer.ensure_dependency(@spec, dep)
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
dep = Gem::Dependency.new 'b', '> 2'
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::InstallError do
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.ensure_dependency @spec, dep
|
|
|
|
end
|
|
|
|
|
2008-06-17 18:04:18 -04:00
|
|
|
assert_equal 'a requires b (> 2, runtime)', e.message
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_expand_and_validate_gem_dir
|
|
|
|
@installer.gem_dir = '/nonexistent'
|
|
|
|
expanded_gem_dir = @installer.send(:expand_and_validate_gem_dir)
|
|
|
|
if win_platform?
|
2008-03-31 18:40:06 -04:00
|
|
|
expected = File.expand_path('/nonexistent').downcase
|
2007-11-10 02:48:56 -05:00
|
|
|
expanded_gem_dir = expanded_gem_dir.downcase
|
|
|
|
else
|
|
|
|
expected = '/nonexistent'
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal expected, expanded_gem_dir
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_extract_files
|
|
|
|
format = Object.new
|
|
|
|
def format.file_entries
|
|
|
|
[[{'size' => 7, 'mode' => 0400, 'path' => 'thefile'}, 'thefile']]
|
|
|
|
end
|
|
|
|
|
|
|
|
@installer.format = format
|
|
|
|
|
|
|
|
@installer.extract_files
|
|
|
|
|
2008-06-17 18:04:18 -04:00
|
|
|
thefile_path = File.join(util_gem_dir, 'thefile')
|
|
|
|
assert_equal 'thefile', File.read(thefile_path)
|
|
|
|
|
|
|
|
unless Gem.win_platform? then
|
|
|
|
assert_equal 0400, File.stat(thefile_path).mode & 0777
|
|
|
|
end
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_extract_files_bad_dest
|
|
|
|
@installer.gem_dir = 'somedir'
|
|
|
|
@installer.format = nil
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises ArgumentError do
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.extract_files
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal 'format required to extract from', e.message
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_extract_files_relative
|
|
|
|
format = Object.new
|
|
|
|
def format.file_entries
|
|
|
|
[[{'size' => 10, 'mode' => 0644, 'path' => '../thefile'}, '../thefile']]
|
|
|
|
end
|
|
|
|
|
|
|
|
@installer.format = format
|
|
|
|
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::InstallError do
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.extract_files
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal "attempt to install file into \"../thefile\" under #{util_gem_dir.inspect}",
|
|
|
|
e.message
|
|
|
|
assert_equal false, File.file?(File.join(@tempdir, '../thefile')),
|
|
|
|
"You may need to remove this file if you broke the test once"
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_extract_files_absolute
|
|
|
|
format = Object.new
|
|
|
|
def format.file_entries
|
|
|
|
[[{'size' => 8, 'mode' => 0644, 'path' => '/thefile'}, '/thefile']]
|
|
|
|
end
|
|
|
|
|
|
|
|
@installer.format = format
|
|
|
|
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::InstallError do
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.extract_files
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal 'attempt to install file into "/thefile"', e.message
|
|
|
|
assert_equal false, File.file?(File.join('/thefile')),
|
|
|
|
"You may need to remove this file if you broke the test once"
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_bindir
|
|
|
|
@installer.wrappers = true
|
|
|
|
|
|
|
|
@spec.executables = ["my_exec"]
|
|
|
|
@spec.bindir = '.'
|
|
|
|
|
|
|
|
exec_file = @installer.formatted_program_filename "my_exec"
|
|
|
|
exec_path = File.join util_gem_dir(@spec.version), exec_file
|
|
|
|
File.open exec_path, 'w' do |f|
|
|
|
|
f.puts '#!/usr/bin/ruby'
|
|
|
|
end
|
|
|
|
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
|
|
|
|
assert_equal true, File.directory?(util_inst_bindir)
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
|
|
|
|
|
|
|
wrapper = File.read installed_exec
|
|
|
|
assert_match %r|generated by RubyGems|, wrapper
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_generate_bin_script
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.wrappers = true
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
assert_equal true, File.directory?(util_inst_bindir)
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
|
|
|
|
|
|
|
wrapper = File.read installed_exec
|
|
|
|
assert_match %r|generated by RubyGems|, wrapper
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_script_format
|
|
|
|
@installer.format_executable = true
|
|
|
|
@installer.wrappers = true
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
Gem::Installer.exec_format = 'foo-%s-bar'
|
|
|
|
@installer.generate_bin
|
|
|
|
assert_equal true, File.directory?(util_inst_bindir)
|
|
|
|
installed_exec = File.join util_inst_bindir, 'foo-my_exec-bar'
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
ensure
|
|
|
|
Gem::Installer.exec_format = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_generate_bin_script_format_disabled
|
|
|
|
@installer.wrappers = true
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
Gem::Installer.exec_format = 'foo-%s-bar'
|
|
|
|
@installer.generate_bin
|
|
|
|
assert_equal true, File.directory?(util_inst_bindir)
|
|
|
|
installed_exec = File.join util_inst_bindir, 'my_exec'
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
ensure
|
|
|
|
Gem::Installer.exec_format = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_generate_bin_script_install_dir
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.wrappers = true
|
|
|
|
@spec.executables = ["my_exec"]
|
|
|
|
|
|
|
|
gem_dir = File.join "#{@gemhome}2", 'gems', @spec.full_name
|
|
|
|
gem_bindir = File.join gem_dir, 'bin'
|
|
|
|
FileUtils.mkdir_p gem_bindir
|
|
|
|
File.open File.join(gem_bindir, "my_exec"), 'w' do |f|
|
|
|
|
f.puts "#!/bin/ruby"
|
|
|
|
end
|
|
|
|
|
|
|
|
@installer.gem_home = "#{@gemhome}2"
|
|
|
|
@installer.gem_dir = gem_dir
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
|
|
|
|
installed_exec = File.join("#{@gemhome}2", 'bin', 'my_exec')
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
|
|
|
|
|
|
|
wrapper = File.read installed_exec
|
|
|
|
assert_match %r|generated by RubyGems|, wrapper
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_script_no_execs
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.wrappers = true
|
|
|
|
@installer.generate_bin
|
|
|
|
assert_equal false, File.exist?(util_inst_bindir)
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_script_no_perms
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.wrappers = true
|
|
|
|
util_make_exec
|
|
|
|
|
|
|
|
Dir.mkdir util_inst_bindir
|
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
if win_platform?
|
|
|
|
skip('test_generate_bin_script_no_perms skipped on MS Windows')
|
|
|
|
else
|
|
|
|
File.chmod 0000, util_inst_bindir
|
2007-11-10 02:48:56 -05:00
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
assert_raises Gem::FilePermissionError do
|
|
|
|
@installer.generate_bin
|
|
|
|
end
|
|
|
|
end
|
2007-11-10 02:48:56 -05:00
|
|
|
ensure
|
|
|
|
File.chmod 0700, util_inst_bindir unless $DEBUG
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_script_no_shebang
|
|
|
|
@installer.wrappers = true
|
|
|
|
@spec.executables = ["my_exec"]
|
|
|
|
|
|
|
|
gem_dir = File.join @gemhome, 'gems', @spec.full_name
|
|
|
|
gem_bindir = File.join gem_dir, 'bin'
|
|
|
|
FileUtils.mkdir_p gem_bindir
|
|
|
|
File.open File.join(gem_bindir, "my_exec"), 'w' do |f|
|
|
|
|
f.puts "blah blah blah"
|
|
|
|
end
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
|
|
|
|
installed_exec = File.join @gemhome, 'bin', 'my_exec'
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
assert_equal 0100755, File.stat(installed_exec).mode unless win_platform?
|
|
|
|
|
|
|
|
wrapper = File.read installed_exec
|
|
|
|
assert_match %r|generated by RubyGems|, wrapper
|
|
|
|
# HACK some gems don't have #! in their executables, restore 2008/06
|
|
|
|
#assert_no_match %r|generated by RubyGems|, wrapper
|
|
|
|
end
|
|
|
|
|
2008-06-17 18:04:18 -04:00
|
|
|
def test_generate_bin_script_wrappers
|
|
|
|
@installer.wrappers = true
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
|
|
|
|
real_exec = File.join util_gem_dir, 'bin', 'my_exec'
|
|
|
|
|
|
|
|
# fake --no-wrappers for previous install
|
2008-06-19 14:15:26 -04:00
|
|
|
unless Gem.win_platform? then
|
|
|
|
FileUtils.mkdir_p File.dirname(installed_exec)
|
|
|
|
FileUtils.ln_s real_exec, installed_exec
|
|
|
|
end
|
2008-06-17 18:04:18 -04:00
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
assert_equal true, File.directory?(util_inst_bindir)
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
assert_equal(0100755, File.stat(installed_exec).mode) unless win_platform?
|
|
|
|
|
|
|
|
assert_match %r|generated by RubyGems|, File.read(installed_exec)
|
|
|
|
|
2008-10-25 18:58:43 -04:00
|
|
|
refute_match %r|generated by RubyGems|, File.read(real_exec),
|
|
|
|
'real executable overwritten'
|
2008-06-17 18:04:18 -04:00
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_symlink
|
2007-11-10 02:48:56 -05:00
|
|
|
return if win_platform? #Windows FS do not support symlinks
|
|
|
|
|
|
|
|
@installer.wrappers = false
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
assert_equal true, File.directory?(util_inst_bindir)
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
assert_equal true, File.symlink?(installed_exec)
|
|
|
|
assert_equal(File.join(util_gem_dir, "bin", "my_exec"),
|
|
|
|
File.readlink(installed_exec))
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_symlink_no_execs
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.wrappers = false
|
|
|
|
@installer.generate_bin
|
|
|
|
assert_equal false, File.exist?(util_inst_bindir)
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_symlink_no_perms
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.wrappers = false
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
Dir.mkdir util_inst_bindir
|
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
if win_platform?
|
|
|
|
skip('test_generate_bin_symlink_no_perms skipped on MS Windows')
|
|
|
|
else
|
|
|
|
File.chmod 0000, util_inst_bindir
|
2007-11-10 02:48:56 -05:00
|
|
|
|
2009-06-09 17:38:59 -04:00
|
|
|
assert_raises Gem::FilePermissionError do
|
|
|
|
@installer.generate_bin
|
|
|
|
end
|
|
|
|
end
|
2007-11-10 02:48:56 -05:00
|
|
|
ensure
|
|
|
|
File.chmod 0700, util_inst_bindir unless $DEBUG
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_symlink_update_newer
|
2007-11-10 02:48:56 -05:00
|
|
|
return if win_platform? #Windows FS do not support symlinks
|
|
|
|
|
|
|
|
@installer.wrappers = false
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
assert_equal(File.join(util_gem_dir, "bin", "my_exec"),
|
|
|
|
File.readlink(installed_exec))
|
|
|
|
|
|
|
|
@spec = Gem::Specification.new do |s|
|
|
|
|
s.files = ['lib/code.rb']
|
|
|
|
s.name = "a"
|
2007-12-20 03:39:12 -05:00
|
|
|
s.version = "3"
|
2007-11-10 02:48:56 -05:00
|
|
|
s.summary = "summary"
|
|
|
|
s.description = "desc"
|
|
|
|
s.require_path = 'lib'
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '3'
|
|
|
|
@installer.gem_dir = File.join util_gem_dir('3')
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.generate_bin
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
2007-12-20 03:39:12 -05:00
|
|
|
assert_equal(File.join(util_gem_bindir('3'), "my_exec"),
|
2007-11-10 02:48:56 -05:00
|
|
|
File.readlink(installed_exec),
|
|
|
|
"Ensure symlink moved to latest version")
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_symlink_update_older
|
2007-11-10 02:48:56 -05:00
|
|
|
return if win_platform? #Windows FS do not support symlinks
|
|
|
|
|
|
|
|
@installer.wrappers = false
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
assert_equal(File.join(util_gem_dir, "bin", "my_exec"),
|
|
|
|
File.readlink(installed_exec))
|
|
|
|
|
|
|
|
spec = Gem::Specification.new do |s|
|
|
|
|
s.files = ['lib/code.rb']
|
|
|
|
s.name = "a"
|
2007-12-20 03:39:12 -05:00
|
|
|
s.version = "1"
|
2007-11-10 02:48:56 -05:00
|
|
|
s.summary = "summary"
|
|
|
|
s.description = "desc"
|
|
|
|
s.require_path = 'lib'
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '1'
|
|
|
|
@installer.gem_dir = util_gem_dir('1')
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.spec = spec
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
2007-12-20 03:39:12 -05:00
|
|
|
assert_equal(File.join(util_gem_dir('2'), "bin", "my_exec"),
|
2007-11-10 02:48:56 -05:00
|
|
|
File.readlink(installed_exec),
|
|
|
|
"Ensure symlink not moved")
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_symlink_update_remove_wrapper
|
2007-11-10 02:48:56 -05:00
|
|
|
return if win_platform? #Windows FS do not support symlinks
|
|
|
|
|
|
|
|
@installer.wrappers = true
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
|
|
|
|
@spec = Gem::Specification.new do |s|
|
|
|
|
s.files = ['lib/code.rb']
|
|
|
|
s.name = "a"
|
2007-12-20 03:39:12 -05:00
|
|
|
s.version = "3"
|
2007-11-10 02:48:56 -05:00
|
|
|
s.summary = "summary"
|
|
|
|
s.description = "desc"
|
|
|
|
s.require_path = 'lib'
|
|
|
|
end
|
|
|
|
|
|
|
|
@installer.wrappers = false
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '3'
|
|
|
|
@installer.gem_dir = util_gem_dir '3'
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.generate_bin
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
2007-12-20 03:39:12 -05:00
|
|
|
assert_equal(File.join(util_gem_dir('3'), "bin", "my_exec"),
|
2007-11-10 02:48:56 -05:00
|
|
|
File.readlink(installed_exec),
|
|
|
|
"Ensure symlink moved to latest version")
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_generate_bin_symlink_win32
|
2007-11-24 22:26:36 -05:00
|
|
|
old_win_platform = Gem.win_platform?
|
|
|
|
Gem.win_platform = true
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.wrappers = false
|
|
|
|
util_make_exec
|
|
|
|
@installer.gem_dir = util_gem_dir
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@installer.generate_bin
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal true, File.directory?(util_inst_bindir)
|
|
|
|
installed_exec = File.join(util_inst_bindir, "my_exec")
|
|
|
|
assert_equal true, File.exist?(installed_exec)
|
|
|
|
|
2007-11-24 22:26:36 -05:00
|
|
|
assert_match(/Unable to use symlinks on Windows, installing wrapper/i,
|
2007-11-10 02:48:56 -05:00
|
|
|
@ui.error)
|
|
|
|
|
|
|
|
wrapper = File.read installed_exec
|
|
|
|
assert_match(/generated by RubyGems/, wrapper)
|
|
|
|
ensure
|
2007-11-24 22:26:36 -05:00
|
|
|
Gem.win_platform = old_win_platform
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_generate_bin_uses_default_shebang
|
|
|
|
return if win_platform? #Windows FS do not support symlinks
|
|
|
|
|
|
|
|
@installer.wrappers = true
|
|
|
|
util_make_exec
|
|
|
|
|
|
|
|
@installer.generate_bin
|
|
|
|
|
2009-01-22 02:28:35 -05:00
|
|
|
default_shebang = Gem.ruby
|
2007-11-10 02:48:56 -05:00
|
|
|
shebang_line = open("#{@gemhome}/bin/my_exec") { |f| f.readlines.first }
|
|
|
|
assert_match(/\A#!/, shebang_line)
|
|
|
|
assert_match(/#{default_shebang}/, shebang_line)
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
def test_initialize
|
|
|
|
spec = quick_gem 'a' do |s| s.platform = Gem::Platform.new 'mswin32' end
|
|
|
|
gem = File.join @tempdir, "#{spec.full_name}.gem"
|
|
|
|
|
2008-06-25 22:06:00 -04:00
|
|
|
Dir.mkdir util_inst_bindir
|
2007-12-20 03:39:12 -05:00
|
|
|
util_build_gem spec
|
|
|
|
FileUtils.mv File.join(@gemhome, 'cache', "#{spec.full_name}.gem"),
|
|
|
|
@tempdir
|
|
|
|
|
|
|
|
installer = Gem::Installer.new gem
|
|
|
|
|
|
|
|
assert_equal File.join(@gemhome, 'gems', spec.full_name), installer.gem_dir
|
|
|
|
end
|
|
|
|
|
2007-11-10 02:48:56 -05:00
|
|
|
def test_install
|
2008-06-25 22:06:00 -04:00
|
|
|
Dir.mkdir util_inst_bindir
|
2007-11-10 02:48:56 -05:00
|
|
|
util_setup_gem
|
|
|
|
|
2008-09-25 06:13:50 -04:00
|
|
|
cache_file = File.join @gemhome, 'cache', "#{@spec.full_name}.gem"
|
|
|
|
|
|
|
|
Gem.pre_install do |installer|
|
2009-06-09 17:38:59 -04:00
|
|
|
refute File.exist?(cache_file), 'cache file should not exist yet'
|
2008-09-25 06:13:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Gem.post_install do |installer|
|
|
|
|
assert File.exist?(cache_file), 'cache file should exist'
|
|
|
|
end
|
|
|
|
|
2008-07-01 08:33:11 -04:00
|
|
|
build_rake_in do
|
|
|
|
use_ui @ui do
|
|
|
|
assert_equal @spec, @installer.install
|
|
|
|
end
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
gemdir = File.join @gemhome, 'gems', @spec.full_name
|
|
|
|
assert File.exist?(gemdir)
|
|
|
|
|
|
|
|
exe = File.join(gemdir, 'bin', 'executable')
|
|
|
|
assert File.exist?(exe)
|
|
|
|
exe_mode = File.stat(exe).mode & 0111
|
|
|
|
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
|
|
|
|
|
|
|
|
assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
|
|
|
|
|
|
|
|
assert File.exist?(File.join(gemdir, 'ext', 'a', 'Rakefile'))
|
|
|
|
|
|
|
|
spec_file = File.join(@gemhome, 'specifications',
|
|
|
|
"#{@spec.full_name}.gemspec")
|
|
|
|
|
|
|
|
assert_equal spec_file, @spec.loaded_from
|
|
|
|
assert File.exist?(spec_file)
|
2008-09-25 06:13:50 -04:00
|
|
|
|
|
|
|
assert_same @installer, @pre_install_hook_arg
|
|
|
|
assert_same @installer, @post_install_hook_arg
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_install_bad_gem
|
|
|
|
gem = nil
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
|
|
|
|
gem = File.join @tempdir, "#{@spec.full_name}.gem"
|
|
|
|
end
|
|
|
|
|
|
|
|
gem_data = File.open gem, 'rb' do |fp| fp.read 1024 end
|
|
|
|
File.open gem, 'wb' do |fp| fp.write gem_data end
|
|
|
|
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::InstallError do
|
2007-11-10 02:48:56 -05:00
|
|
|
use_ui @ui do
|
|
|
|
@installer = Gem::Installer.new gem
|
|
|
|
@installer.install
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal "invalid gem format for #{gem}", e.message
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_install_check_dependencies
|
|
|
|
@spec.add_dependency 'b', '> 5'
|
|
|
|
util_setup_gem
|
|
|
|
|
|
|
|
use_ui @ui do
|
2008-10-25 18:58:43 -04:00
|
|
|
assert_raises Gem::InstallError do
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.install
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-09-25 06:13:50 -04:00
|
|
|
def test_install_check_dependencies_install_dir
|
|
|
|
gemhome2 = "#{@gemhome}2"
|
|
|
|
@spec.add_dependency 'b'
|
|
|
|
|
|
|
|
b2 = quick_gem 'b', 2
|
|
|
|
|
|
|
|
FileUtils.mv @gemhome, gemhome2
|
|
|
|
Gem.source_index.gems.delete b2.full_name
|
|
|
|
source_index = Gem::SourceIndex.from_gems_in File.join(gemhome2,
|
|
|
|
'specifications')
|
|
|
|
|
|
|
|
util_setup_gem
|
|
|
|
|
|
|
|
@installer = Gem::Installer.new @gem, :install_dir => gemhome2,
|
|
|
|
:source_index => source_index
|
|
|
|
|
2008-09-25 06:37:01 -04:00
|
|
|
build_rake_in do
|
|
|
|
use_ui @ui do
|
|
|
|
@installer.install
|
|
|
|
end
|
2008-09-25 06:13:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
assert File.exist?(File.join(gemhome2, 'gems', @spec.full_name))
|
|
|
|
end
|
|
|
|
|
2007-11-10 02:48:56 -05:00
|
|
|
def test_install_force
|
|
|
|
use_ui @ui do
|
|
|
|
installer = Gem::Installer.new old_ruby_required, :force => true
|
|
|
|
installer.install
|
|
|
|
end
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
gem_dir = File.join(@gemhome, 'gems', 'old_ruby_required-1')
|
2007-11-10 02:48:56 -05:00
|
|
|
assert File.exist?(gem_dir)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_install_ignore_dependencies
|
2008-06-25 22:06:00 -04:00
|
|
|
Dir.mkdir util_inst_bindir
|
2007-11-10 02:48:56 -05:00
|
|
|
@spec.add_dependency 'b', '> 5'
|
|
|
|
util_setup_gem
|
|
|
|
@installer.ignore_dependencies = true
|
|
|
|
|
2008-07-01 08:33:11 -04:00
|
|
|
build_rake_in do
|
|
|
|
use_ui @ui do
|
|
|
|
assert_equal @spec, @installer.install
|
|
|
|
end
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
gemdir = File.join @gemhome, 'gems', @spec.full_name
|
|
|
|
assert File.exist?(gemdir)
|
|
|
|
|
|
|
|
exe = File.join(gemdir, 'bin', 'executable')
|
|
|
|
assert File.exist?(exe)
|
|
|
|
exe_mode = File.stat(exe).mode & 0111
|
|
|
|
assert_equal 0111, exe_mode, "0%o" % exe_mode unless win_platform?
|
|
|
|
assert File.exist?(File.join(gemdir, 'lib', 'code.rb'))
|
|
|
|
|
|
|
|
assert File.exist?(File.join(@gemhome, 'specifications',
|
|
|
|
"#{@spec.full_name}.gemspec"))
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_install_missing_dirs
|
|
|
|
FileUtils.rm_f File.join(Gem.dir, 'cache')
|
|
|
|
FileUtils.rm_f File.join(Gem.dir, 'docs')
|
|
|
|
FileUtils.rm_f File.join(Gem.dir, 'specifications')
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
|
|
|
|
gem = File.join @tempdir, "#{@spec.full_name}.gem"
|
|
|
|
|
|
|
|
@installer.install
|
|
|
|
end
|
|
|
|
|
|
|
|
File.directory? File.join(Gem.dir, 'cache')
|
|
|
|
File.directory? File.join(Gem.dir, 'docs')
|
|
|
|
File.directory? File.join(Gem.dir, 'specifications')
|
|
|
|
|
|
|
|
assert File.exist?(File.join(@gemhome, 'cache', "#{@spec.full_name}.gem"))
|
|
|
|
assert File.exist?(File.join(@gemhome, 'specifications',
|
|
|
|
"#{@spec.full_name}.gemspec"))
|
|
|
|
end
|
2008-09-25 06:13:50 -04:00
|
|
|
|
2008-06-25 22:06:00 -04:00
|
|
|
unless win_platform? # File.chmod doesn't work
|
|
|
|
def test_install_user_local_fallback
|
|
|
|
Dir.mkdir util_inst_bindir
|
|
|
|
File.chmod 0755, @userhome
|
|
|
|
File.chmod 0000, util_inst_bindir
|
|
|
|
File.chmod 0000, Gem.dir
|
|
|
|
@spec.executables = ["executable"]
|
|
|
|
|
2008-07-01 08:33:11 -04:00
|
|
|
build_rake_in do
|
|
|
|
use_ui @ui do
|
|
|
|
util_setup_gem
|
|
|
|
@installer.install
|
|
|
|
end
|
2008-06-25 22:06:00 -04:00
|
|
|
end
|
2008-09-25 06:13:50 -04:00
|
|
|
|
|
|
|
assert File.exist?(File.join(Gem.user_dir, 'gems',
|
|
|
|
@spec.full_name, 'lib', 'code.rb'))
|
|
|
|
assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable'))
|
2008-06-25 22:06:00 -04:00
|
|
|
ensure
|
|
|
|
File.chmod 0755, Gem.dir
|
|
|
|
File.chmod 0755, util_inst_bindir
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_install_bindir_read_only
|
|
|
|
Dir.mkdir util_inst_bindir
|
|
|
|
File.chmod 0755, @userhome
|
|
|
|
File.chmod 0000, util_inst_bindir
|
2007-11-10 02:48:56 -05:00
|
|
|
|
2008-07-01 08:33:11 -04:00
|
|
|
build_rake_in do
|
|
|
|
use_ui @ui do
|
|
|
|
util_setup_gem
|
|
|
|
@installer.install
|
|
|
|
end
|
2008-06-25 22:06:00 -04:00
|
|
|
end
|
2008-09-25 06:13:50 -04:00
|
|
|
|
|
|
|
assert File.exist?(File.join(Gem.user_dir, 'bin', 'executable'))
|
2008-06-25 22:06:00 -04:00
|
|
|
ensure
|
|
|
|
File.chmod 0755, util_inst_bindir
|
|
|
|
end
|
|
|
|
end
|
2008-09-25 06:13:50 -04:00
|
|
|
|
2007-11-10 02:48:56 -05:00
|
|
|
def test_install_with_message
|
|
|
|
@spec.post_install_message = 'I am a shiny gem!'
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
|
|
|
|
|
|
|
|
@installer.install
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_match %r|I am a shiny gem!|, @ui.output
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_install_wrong_ruby_version
|
|
|
|
use_ui @ui do
|
|
|
|
installer = Gem::Installer.new old_ruby_required
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::InstallError do
|
2007-11-10 02:48:56 -05:00
|
|
|
installer.install
|
|
|
|
end
|
|
|
|
assert_equal 'old_ruby_required requires Ruby version = 1.4.6',
|
|
|
|
e.message
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_install_wrong_rubygems_version
|
2007-12-20 03:39:12 -05:00
|
|
|
spec = quick_gem 'old_rubygems_required', '1' do |s|
|
|
|
|
s.required_rubygems_version = '< 0'
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
util_build_gem spec
|
|
|
|
|
|
|
|
gem = File.join @gemhome, 'cache', "#{spec.full_name}.gem"
|
|
|
|
|
|
|
|
use_ui @ui do
|
|
|
|
@installer = Gem::Installer.new gem
|
2008-10-25 18:58:43 -04:00
|
|
|
e = assert_raises Gem::InstallError do
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.install
|
|
|
|
end
|
2007-12-20 03:39:12 -05:00
|
|
|
assert_equal 'old_rubygems_required requires RubyGems version < 0',
|
2007-11-10 02:48:56 -05:00
|
|
|
e.message
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_installation_satisfies_dependency_eh
|
2007-12-20 03:39:12 -05:00
|
|
|
dep = Gem::Dependency.new 'a', '>= 2'
|
2007-11-10 02:48:56 -05:00
|
|
|
assert @installer.installation_satisfies_dependency?(dep)
|
|
|
|
|
2007-12-20 03:39:12 -05:00
|
|
|
dep = Gem::Dependency.new 'a', '> 2'
|
2009-06-09 17:38:59 -04:00
|
|
|
refute @installer.installation_satisfies_dependency?(dep)
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/ruby"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby}", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_arguments
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/ruby -ws"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_empty
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', ''
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
assert_equal "#!#{Gem.ruby}", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_env
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/env ruby"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby}", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_env_arguments
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/env ruby -ws"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_env_shebang
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', ''
|
2007-11-10 02:48:56 -05:00
|
|
|
@installer.env_shebang = true
|
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
2009-06-09 17:38:59 -04:00
|
|
|
assert_equal "#!/usr/bin/env #{Gem::ConfigMap[:ruby_install_name]}", shebang
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_nested
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/opt/local/ruby/bin/ruby"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby}", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_nested_arguments
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/opt/local/ruby/bin/ruby -ws"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_version
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/ruby18"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby}", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_version_arguments
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/ruby18 -ws"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_version_env
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/env ruby18"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby}", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_shebang_version_env_arguments
|
2007-12-20 03:39:12 -05:00
|
|
|
util_make_exec '2', "#!/usr/bin/env ruby18 -ws"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
shebang = @installer.shebang 'my_exec'
|
|
|
|
|
|
|
|
assert_equal "#!#{Gem.ruby} -ws", shebang
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_unpack
|
|
|
|
util_setup_gem
|
|
|
|
|
|
|
|
dest = File.join @gemhome, 'gems', @spec.full_name
|
|
|
|
|
|
|
|
@installer.unpack dest
|
|
|
|
|
|
|
|
assert File.exist?(File.join(dest, 'lib', 'code.rb'))
|
|
|
|
assert File.exist?(File.join(dest, 'bin', 'executable'))
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_write_spec
|
|
|
|
spec_dir = File.join @gemhome, 'specifications'
|
|
|
|
spec_file = File.join spec_dir, "#{@spec.full_name}.gemspec"
|
|
|
|
FileUtils.rm spec_file
|
2009-06-09 17:38:59 -04:00
|
|
|
refute File.exist?(spec_file)
|
2007-11-10 02:48:56 -05:00
|
|
|
|
|
|
|
@installer.spec = @spec
|
|
|
|
@installer.gem_home = @gemhome
|
|
|
|
|
|
|
|
@installer.write_spec
|
|
|
|
|
|
|
|
assert File.exist?(spec_file)
|
|
|
|
assert_equal @spec, eval(File.read(spec_file))
|
|
|
|
end
|
|
|
|
|
|
|
|
def old_ruby_required
|
2007-12-20 03:39:12 -05:00
|
|
|
spec = quick_gem 'old_ruby_required', '1' do |s|
|
2007-11-10 02:48:56 -05:00
|
|
|
s.required_ruby_version = '= 1.4.6'
|
|
|
|
end
|
|
|
|
|
|
|
|
util_build_gem spec
|
|
|
|
|
|
|
|
File.join @gemhome, 'cache', "#{spec.full_name}.gem"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|