A test case for Gem::Installer.
# File lib/rubygems/installer_test_case.rb, line 57 57: def setup 58: super 59: 60: @installer_tmp = File.join @tempdir, 'installer' 61: FileUtils.mkdir_p @installer_tmp 62: 63: Gem.use_paths @installer_tmp 64: Gem.ensure_gem_subdirectories @installer_tmp 65: 66: @spec = quick_gem 'a' 67: util_make_exec @spec 68: util_build_gem @spec 69: @gem = @spec.cache_file 70: 71: @user_spec = quick_gem 'b' 72: util_make_exec @user_spec 73: util_build_gem @user_spec 74: @user_gem = @user_spec.cache_file 75: 76: Gem.use_paths @gemhome 77: 78: @installer = util_installer @spec, @gemhome 79: @user_installer = util_installer @user_spec, Gem.user_dir, :user 80: 81: Gem.use_paths @gemhome 82: end
# File lib/rubygems/installer_test_case.rb, line 84 84: def util_gem_bindir spec = @spec 85: # TODO: deprecate 86: spec.bin_dir 87: end
# File lib/rubygems/installer_test_case.rb, line 89 89: def util_gem_dir spec = @spec 90: # TODO: deprecate 91: spec.gem_dir 92: end
# File lib/rubygems/installer_test_case.rb, line 94 94: def util_inst_bindir 95: File.join @gemhome, "bin" 96: end
# File lib/rubygems/installer_test_case.rb, line 139 139: def util_installer(spec, gem_home, user=false) 140: Gem::Installer.new spec.cache_file, :user_install => user 141: end
# File lib/rubygems/installer_test_case.rb, line 98 98: def util_make_exec(spec = @spec, shebang = "#!/usr/bin/ruby") 99: spec.executables = ]executable] 100: spec.files << 'bin/executable' 101: 102: exec_path = spec.bin_file "executable" 103: write_file exec_path do |io| 104: io.puts shebang 105: end 106: 107: bin_path = File.join @tempdir, "bin", "executable" 108: write_file bin_path do |io| 109: io.puts shebang 110: end 111: end
# File lib/rubygems/installer_test_case.rb, line 113 113: def util_setup_gem(ui = @ui) # HACK fix use_ui to make this automatic 114: @spec.files << File.join('lib', 'code.rb') 115: @spec.extensions << File.join('ext', 'a', 'mkrf_conf.rb') 116: 117: Dir.chdir @tempdir do 118: FileUtils.mkdir_p 'bin' 119: FileUtils.mkdir_p 'lib' 120: FileUtils.mkdir_p File.join('ext', 'a') 121: File.open File.join('bin', 'executable'), 'w' do |f| f.puts '1' end 122: File.open File.join('lib', 'code.rb'), 'w' do |f| f.puts '1' end 123: File.open File.join('ext', 'a', 'mkrf_conf.rb'), 'w' do |f| 124: f << File.open 'Rakefile', 'w' do |rf| rf.puts "task :default" end 125: end 126: 127: use_ui ui do 128: FileUtils.rm @gem 129: 130: @gem = Gem::Builder.new(@spec).build 131: end 132: end 133: 134: @installer = Gem::Installer.new @gem 135: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.