summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--lib/rubygems.rb30
-rw-r--r--lib/rubygems/commands/environment_command.rb6
-rw-r--r--lib/rubygems/dependency.rb2
-rw-r--r--lib/rubygems/dependency_installer.rb2
-rw-r--r--lib/rubygems/doc_manager.rb4
-rw-r--r--lib/rubygems/ext/builder.rb2
-rw-r--r--lib/rubygems/ext/rake_builder.rb12
-rw-r--r--lib/rubygems/format.rb2
-rw-r--r--lib/rubygems/indexer.rb14
-rw-r--r--lib/rubygems/installer.rb34
-rw-r--r--lib/rubygems/installer_test_case.rb (renamed from test/rubygems/gem_installer_test_case.rb)43
-rw-r--r--lib/rubygems/mock_gem_ui.rb (renamed from test/rubygems/mockgemui.rb)6
-rw-r--r--lib/rubygems/package/tar_test_case.rb (renamed from test/rubygems/gem_package_tar_test_case.rb)7
-rw-r--r--lib/rubygems/require_paths_builder.rb2
-rw-r--r--lib/rubygems/specification.rb2
-rw-r--r--lib/rubygems/test_case.rb (renamed from test/rubygems/gemutilities.rb)252
-rw-r--r--lib/rubygems/uninstaller.rb55
-rw-r--r--lib/rubygems/user_interaction.rb23
-rw-r--r--test/rubygems/simple_gem.rb4
-rw-r--r--test/rubygems/test_config.rb4
-rw-r--r--test/rubygems/test_gem.rb4
-rw-r--r--test/rubygems/test_gem_builder.rb4
-rw-r--r--test/rubygems/test_gem_command.rb6
-rw-r--r--test/rubygems/test_gem_command_manager.rb12
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_check_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_dependency_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_generate_index_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_lock_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb10
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_server_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_stale_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb26
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb6
-rw-r--r--test/rubygems/test_gem_config_file.rb4
-rw-r--r--test/rubygems/test_gem_dependency.rb6
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb4
-rw-r--r--test/rubygems/test_gem_dependency_list.rb6
-rw-r--r--test/rubygems/test_gem_doc_manager.rb4
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb4
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb4
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb4
-rw-r--r--test/rubygems/test_gem_format.rb4
-rw-r--r--test/rubygems/test_gem_gem_path_searcher.rb4
-rw-r--r--test/rubygems/test_gem_gem_runner.rb4
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb8
-rw-r--r--test/rubygems/test_gem_indexer.rb8
-rw-r--r--test/rubygems/test_gem_install_update_options.rb4
-rw-r--r--test/rubygems/test_gem_installer.rb11
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb4
-rw-r--r--test/rubygems/test_gem_package_tar_header.rb4
-rw-r--r--test/rubygems/test_gem_package_tar_input.rb4
-rw-r--r--test/rubygems/test_gem_package_tar_output.rb4
-rw-r--r--test/rubygems/test_gem_package_tar_reader.rb4
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb4
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb4
-rw-r--r--test/rubygems/test_gem_package_task.rb4
-rw-r--r--test/rubygems/test_gem_platform.rb4
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb6
-rw-r--r--test/rubygems/test_gem_requirement.rb4
-rw-r--r--test/rubygems/test_gem_security.rb4
-rw-r--r--test/rubygems/test_gem_server.rb4
-rw-r--r--test/rubygems/test_gem_source_index.rb4
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb4
-rw-r--r--test/rubygems/test_gem_specification.rb8
-rw-r--r--test/rubygems/test_gem_stream_ui.rb22
-rw-r--r--test/rubygems/test_gem_text.rb4
-rw-r--r--test/rubygems/test_gem_uninstaller.rb27
-rw-r--r--test/rubygems/test_gem_validator.rb4
-rw-r--r--test/rubygems/test_gem_version.rb4
-rw-r--r--test/rubygems/test_gem_version_option.rb4
-rw-r--r--test/rubygems/test_kernel.rb6
87 files changed, 570 insertions, 331 deletions
@@ -1,3 +1,8 @@
Sat Jan 29 02:02:37 2011 Yusuke Endoh <[email protected]>
* variable.c (rb_mod_const_of, sv_i): Module#constant should exclude
@@ -32,7 +37,7 @@ Sat Jan 29 01:19:17 2011 Yusuke Endoh <[email protected]>
rb_public_const_get_* and rb_public_const_defined_* are introduced,
which raise an exception when the referring constant is private.
see [ruby-core:32912].
-
* vm_insnhelper.c (vm_get_ev_const): use rb_public_const_get_* instead
of rb_const_get_* to follow the constant visibility when user code
refers a constant.
@@ -1,3 +1,9 @@
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
@@ -5,15 +11,20 @@
# See LICENSE.txt for permissions.
#++
-# TODO: remove when 1.9.1 no longer supported
-QUICKLOADER_SUCKAGE = RUBY_VERSION >= "1.9.1" and RUBY_VERSION < "1.9.2"
-# TODO: remove when 1.9.2 no longer supported
-GEM_PRELUDE_SUCKAGE = RUBY_VERSION >= "1.9.2" and RUBY_VERSION < "1.9.3"
-gem_preluded = GEM_PRELUDE_SUCKAGE and defined? Gem
-if GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
- Gem::QuickLoader.load_full_rubygems_library
class << Gem
remove_method :try_activate if Gem.respond_to?(:try_activate, true)
@@ -1165,7 +1176,7 @@ end
module Kernel
- remove_method :gem if respond_to? :gem # defined in gem_prelude.rb on 1.9
##
# Use Kernel#gem to activate a specific version of +gem_name+.
@@ -1217,6 +1228,7 @@ end
require 'rubygems/exceptions'
unless gem_preluded then # TODO: remove guard after 1.9.2 dropped
begin
##
@@ -1240,7 +1252,7 @@ end
##
# Enables the require hook for RubyGems.
-require 'rubygems/custom_require'
Gem.clear_paths
@@ -19,7 +19,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
gempath display path used to search for gems
version display the gem format version
remotesources display the remote gem servers
- platform display the supporte gem platforms
<omitted> display everything
EOF
return args.gsub(/^\s+/, '')
@@ -48,7 +48,7 @@ Example:
install: --no-wrappers
update: --no-wrappers
-RubyGems' default local repository can be overriden with the GEM_PATH and
GEM_HOME environment variables. GEM_HOME sets the default repository to
install into. GEM_PATH allows multiple local repositories to be searched for
gems.
@@ -126,7 +126,7 @@ lib/rubygems/defaults/operating_system.rb
end
else
- raise Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
end
say out
true
@@ -56,7 +56,7 @@ class Gem::Dependency
@type = type
@prerelease = false
- # This is for Marshal backwards compatability. See the comments in
# +requirement+ for the dirty details.
@version_requirements = @requirement
@@ -84,7 +84,7 @@ class Gem::DependencyInstaller
##
# Returns a list of pairs of gemspecs and source_uris that match
# Gem::Dependency +dep+ from both local (Dir.pwd) and remote (Gem.sources)
- # sources. Gems are sorted with newer gems prefered over older gems, and
# local gems preferred over remote gems.
def find_gems_with_sources(dep)
@@ -194,7 +194,9 @@ class Gem::DocManager
rescue Errno::EACCES => e
dirname = File.dirname e.message.split("-")[1].strip
raise Gem::FilePermissionError.new(dirname)
- rescue RuntimeError => ex
alert_error "While generating documentation for #{@spec.full_name}"
ui.errs.puts "... MESSAGE: #{ex}"
ui.errs.puts "... RDOC args: #{args.join(' ')}"
@@ -28,7 +28,7 @@ class Gem::Ext::Builder
File.open('Makefile', 'wb') {|f| f.print mf}
- # try to find make program from Ruby configue arguments first
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
make_program = $1 || ENV['make']
unless make_program then
@@ -25,8 +25,16 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
# Deal with possible spaces in the path, e.g. C:/Program Files
dest_path = '"' + dest_path + '"' if dest_path.include?(' ')
- cmd = ENV['rake'] || "\"#{Gem.ruby}\" -rubygems #{Gem.bin_path('rake')}" rescue Gem.default_exec_format % 'rake'
- cmd += " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}" # ENV is frozen
run cmd, results
@@ -22,8 +22,6 @@ class Gem::Format
attr_accessor :file_entries
attr_accessor :gem_path
- extend Gem::UserInteraction
-
##
# Constructs a Format representing the gem's data which came from +gem_path+
@@ -63,7 +63,7 @@ class Gem::Indexer
require 'tmpdir'
require 'zlib'
- unless ''.respond_to? :to_xs then
raise "Gem::Indexer requires that the XML Builder library be installed:" \
"\n\tgem install builder"
end
@@ -555,10 +555,18 @@ class Gem::Indexer
# Sanitize a single string.
def sanitize_string(string)
# HACK the #to_s is in here because RSpec has an Array of Arrays of
- # Strings for authors. Need a way to disallow bad values on gempsec
# generation. (Probably won't happen.)
- string ? string.to_s.to_xs : string
end
##
@@ -14,6 +14,7 @@ require 'rubygems/format'
require 'rubygems/exceptions'
require 'rubygems/ext'
require 'rubygems/require_paths_builder'
##
# The installer class processes RubyGem .gem files and installs the files
@@ -44,7 +45,7 @@ class Gem::Installer
include Gem::UserInteraction
- include Gem::RequirePathsBuilder if QUICKLOADER_SUCKAGE
##
# The directory a gem's executables will be installed into
@@ -176,7 +177,7 @@ class Gem::Installer
generate_bin
write_spec
- write_require_paths_file_if_needed if QUICKLOADER_SUCKAGE
# HACK remove? Isn't this done in multiple places?
cached_gem = File.join @gem_home, "cache", @gem.split(/\//).pop
@@ -481,7 +482,6 @@ TEXT
def build_extensions
return if @spec.extensions.empty?
say "Building native extensions. This could take a while..."
- start_dir = Dir.pwd
dest_path = File.join @gem_dir, @spec.require_paths.first
ran_rake = false # only run rake once
@@ -502,29 +502,37 @@ TEXT
nil
end
- begin
- Dir.chdir File.join(@gem_dir, File.dirname(extension))
- results = builder.build(extension, @gem_dir, dest_path, results)
- say results.join("\n") if Gem.configuration.really_verbose
rescue
results = results.join "\n"
- File.open('gem_make.out', 'wb') { |f| f.puts results }
message = <<-EOF
ERROR: Failed to build gem native extension.
-#{results}
Gem files will remain installed in #{@gem_dir} for inspection.
-Results logged to #{File.join(Dir.pwd, 'gem_make.out')}
- EOF
raise ExtensionBuildError, message
- ensure
- Dir.chdir start_dir
end
end
end
@@ -4,28 +4,67 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/installer'
class Gem::Installer
attr_accessor :gem_dir
attr_writer :format
attr_writer :gem_home
attr_writer :env_shebang
attr_writer :ignore_dependencies
attr_writer :format_executable
attr_writer :security_policy
attr_writer :spec
attr_writer :wrappers
end
-class GemInstallerTestCase < RubyGemTestCase
def setup
super
@spec = quick_gem 'a'
@gem = File.join @tempdir, @spec.file_name
@installer = util_installer @spec, @gem, @gemhome
@@ -7,7 +7,11 @@
require 'stringio'
require 'rubygems/user_interaction'
-class MockGemUi < Gem::StreamUI
class TermError < RuntimeError; end
module TTY
@@ -4,10 +4,13 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/package'
-class TarTestCase < RubyGemTestCase
def ASCIIZ(str, length)
str + "\0" * (length - str.length)
@@ -20,5 +20,5 @@ module Gem::RequirePathsBuilder
file.puts spec.bindir if spec.bindir
end
end
-end if QUICKLOADER_SUCKAGE
@@ -336,7 +336,7 @@ class Gem::Specification
end
##
- # List of depedencies that will automatically be activated at runtime.
def runtime_dependencies
dependencies.select { |d| d.type == :runtime || d.type == nil }
@@ -6,15 +6,19 @@
at_exit { $SAFE = 1 }
-# $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-
if defined? Gem::QuickLoader
Gem::QuickLoader.load_full_rubygems_library
else
require 'rubygems'
end
-require 'fileutils'
require 'minitest/autorun'
require 'tmpdir'
require 'uri'
require 'rubygems/package'
@@ -35,44 +39,84 @@ end
require 'rdoc/rdoc'
-require "test/rubygems/mockgemui"
module Gem
def self.searcher=(searcher)
@searcher = searcher
end
def self.source_index=(si)
@@source_index = si
end
def self.win_platform=(val)
@@win_platform = val
end
def self.ruby= ruby
@ruby = ruby
end
module DefaultUserInteraction
- @ui = MockGemUi.new
end
end
-class RubyGemTestCase < MiniTest::Unit::TestCase
include Gem::DefaultUserInteraction
undef_method :default_test if instance_methods.include? 'default_test' or
instance_methods.include? :default_test
def setup
super
- @orig_gem_home = ENV['GEM_HOME']
- @orig_gem_path = ENV['GEM_PATH']
- @ui = MockGemUi.new
tmpdir = nil
Dir.chdir Dir.tmpdir do tmpdir = Dir.pwd end # HACK OSX /private/tmp
if ENV['KEEP_FILES'] then
@@ -125,10 +169,10 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
@marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
- @private_key = File.expand_path File.join(File.dirname(__FILE__),
- 'private_key.pem')
- @public_cert = File.expand_path File.join(File.dirname(__FILE__),
- 'public_cert.pem')
Gem.post_build_hooks.clear
Gem.post_install_hooks.clear
@@ -161,6 +205,10 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
@orig_LOAD_PATH = $LOAD_PATH.dup
end
def teardown
$LOAD_PATH.replace @orig_LOAD_PATH
@@ -188,27 +236,36 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
end
end
- def install_gem gem
require 'rubygems/installer'
- use_ui MockGemUi.new do
Dir.chdir @tempdir do
- Gem::Builder.new(gem).build
end
end
- gem = File.join(@tempdir, gem.file_name).untaint
Gem::Installer.new(gem, :wrappers => true).install
end
- def uninstall_gem gem
require 'rubygems/uninstaller'
- uninstaller = Gem::Uninstaller.new gem.name, :executables => true,
:user_install => true
uninstaller.uninstall
end
def mu_pp(obj)
s = ''
s = PP.pp obj, s
@@ -216,33 +273,8 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
s.chomp
end
- def prep_cache_files(lc)
- @usr_si ||= Gem::SourceIndex.new
- @usr_sice ||= Gem::SourceInfoCacheEntry.new @usr_si, 0
-
- @sys_si ||= Gem::SourceIndex.new
- @sys_sice ||= Gem::SourceInfoCacheEntry.new @sys_si, 0
-
- latest_si = Gem::SourceIndex.new
- latest_si.add_specs(*@sys_si.latest_specs)
- latest_sys_sice = Gem::SourceInfoCacheEntry.new latest_si, 0
-
- latest_si = Gem::SourceIndex.new
- latest_si.add_specs(*@usr_si.latest_specs)
- latest_usr_sice = Gem::SourceInfoCacheEntry.new latest_si, 0
-
- [ [lc.system_cache_file, @sys_sice],
- [lc.latest_system_cache_file, latest_sys_sice],
- [lc.user_cache_file, @usr_sice],
- [lc.latest_user_cache_file, latest_usr_sice],
- ].each do |filename, data|
- FileUtils.mkdir_p File.dirname(filename).untaint
-
- open filename.dup.untaint, 'wb' do |f|
- f.write Marshal.dump({ @gem_repo => data })
- end
- end
- end
def read_cache(path)
open path.dup.untaint, 'rb' do |io|
@@ -250,28 +282,45 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
end
end
def read_binary(path)
Gem.read_binary path
end
def write_file(path)
- path = File.join(@gemhome, path)
dir = File.dirname path
FileUtils.mkdir_p dir
open path, 'wb' do |io|
- yield io
end
path
end
- def quick_gem(gemname, version='2')
require 'rubygems/specification'
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
- s.name = gemname
s.version = version
s.author = 'A User'
s.email = '[email protected]'
@@ -295,6 +344,10 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
return spec
end
def util_build_gem(spec)
dir = File.join(@gemhome, 'gems', spec.full_name)
FileUtils.mkdir_p dir
@@ -306,7 +359,7 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
File.open file, 'w' do |fp| fp.puts "# #{file}" end
end
- use_ui MockGemUi.new do
Gem::Builder.new(spec).build
end
@@ -315,14 +368,23 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
end
end
def util_clear_gems
FileUtils.rm_r File.join(@gemhome, 'gems')
FileUtils.rm_r File.join(@gemhome, 'specifications')
Gem.source_index.refresh!
end
def util_gem(name, version, deps = nil, &block)
- if deps then # fuck you eric
block = proc do |s|
deps.each do |n, req|
s.add_dependency n, (req || '>= 0')
@@ -345,6 +407,9 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
[spec, cache_file]
end
def util_gzip(data)
out = StringIO.new
@@ -355,6 +420,23 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
out.string
end
def util_make_gems(prerelease = false)
@a1 = quick_gem 'a', '1' do |s|
s.files = %w[lib/code.rb]
@@ -391,17 +473,16 @@ Also, a list:
if prerelease
@a2_pre = quick_gem('a', '2.a', &init)
- write_file File.join(*%W[gems #{@a2_pre.original_name} lib code.rb]) do
- end
util_build_gem @a2_pre
end
- write_file File.join(*%W[gems #{@a1.original_name} lib code.rb]) do end
- write_file File.join(*%W[gems #{@a2.original_name} lib code.rb]) do end
- write_file File.join(*%W[gems #{@a3a.original_name} lib code.rb]) do end
- write_file File.join(*%W[gems #{@b2.original_name} lib code.rb]) do end
- write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb]) do end
- write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb]) do end
[@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1].each do |spec|
util_build_gem spec
@@ -425,6 +506,12 @@ Also, a list:
platform
end
def util_setup_fake_fetcher(prerelease = false)
require 'zlib'
require 'socket'
@@ -451,6 +538,10 @@ Also, a list:
Gem::RemoteFetcher.fetcher = @fetcher
end
def util_setup_spec_fetcher(*specs)
specs = Hash[*specs.map { |spec| [spec.full_name, spec] }.flatten]
si = Gem::SourceIndex.new specs
@@ -485,65 +576,87 @@ Also, a list:
si
end
def util_zip(data)
Zlib::Deflate.deflate data
end
def self.win_platform?
Gem.win_platform?
end
def win_platform?
Gem.win_platform?
end
# Returns whether or not we're on a version of Ruby built with VC++ (or
# Borland) versus Cygwin, Mingw, etc.
- #
def self.vc_windows?
RUBY_PLATFORM.match('mswin')
end
# Returns whether or not we're on a version of Ruby built with VC++ (or
# Borland) versus Cygwin, Mingw, etc.
- #
def vc_windows?
RUBY_PLATFORM.match('mswin')
end
# Returns the make command for the current platform. For versions of Ruby
# built on MS Windows with VC++ or Borland it will return 'nmake'. On all
# other platforms, including Cygwin, it will return 'make'.
- #
def self.make_command
ENV["make"] || (vc_windows? ? 'nmake' : 'make')
end
# Returns the make command for the current platform. For versions of Ruby
# built on MS Windows with VC++ or Borland it will return 'nmake'. On all
# other platforms, including Cygwin, it will return 'make'.
- #
def make_command
ENV["make"] || (vc_windows? ? 'nmake' : 'make')
end
# Returns whether or not the nmake command could be found.
- #
def nmake_found?
system('nmake /? 1>NUL 2>&1')
end
- # NOTE Allow tests to use a random (but controlled) port number instead of
# a hardcoded one. This helps CI tools when running parallels builds on
# the same builder slave.
def self.process_based_port
@@process_based_port ||= 8000 + $$ % 1000
end
def process_based_port
self.class.process_based_port
end
def build_rake_in
gem_ruby = Gem.ruby
Gem.ruby = @@ruby
@@ -559,6 +672,9 @@ Also, a list:
end
end
def self.rubybin
ruby = ENV["RUBY"]
return ruby if ruby
@@ -604,7 +720,7 @@ Also, a list:
end
##
- # Construct a new Gem::Requirement.
def req *requirements
return requirements.first if Gem::Requirement === requirements.first
@@ -612,7 +728,7 @@ Also, a list:
end
##
- # Construct a new Gem::Specification.
def spec name, version, &block
Gem::Specification.new name, v(version), &block
@@ -127,43 +127,42 @@ class Gem::Uninstaller
# +gemspec+.
def remove_executables(spec)
- return if spec.nil?
- unless spec.executables.empty? then
- bindir = @bin_dir ? @bin_dir : Gem.bindir(spec.installation_path)
- list = @source_index.find_name(spec.name).delete_if { |s|
- s.version == spec.version
- }
- executables = spec.executables.clone
- list.each do |s|
- s.executables.each do |exe_name|
- executables.delete exe_name
- end
end
- return if executables.empty?
- answer = if @force_executables.nil? then
- ask_yes_no("Remove executables:\n" \
- "\t#{spec.executables.join(", ")}\n\nin addition to the gem?",
- true) # " # appease ruby-mode - don't ask
- else
- @force_executables
- end
- unless answer then
- say "Executables and scripts will remain installed."
- else
- raise Gem::FilePermissionError, bindir unless File.writable? bindir
- spec.executables.each do |exe_name|
- say "Removing #{exe_name}"
- FileUtils.rm_f File.join(bindir, exe_name)
- FileUtils.rm_f File.join(bindir, "#{exe_name}.bat")
- end
end
end
end
@@ -72,7 +72,7 @@ module Gem::DefaultUserInteraction
end
##
-# Make the default UI accessable without the "ui." prefix. Classes
# including this module may use the interaction methods on the default UI
# directly. Classes may also reference the ui and ui= methods.
#
@@ -224,7 +224,7 @@ class Gem::StreamUI
result
end
- if RUBY_VERSION >= "1.9" then
##
# Ask for a password. Does not echo response to terminal.
@@ -477,12 +477,20 @@ class Gem::StreamUI
end
def fetch(file_name, total_bytes)
- @file_name, @total_bytes = file_name, total_bytes
update_display(false)
end
def update(bytes)
- new_progress = ((bytes.to_f * 100) / total_bytes.to_f).ceil
return if new_progress == @progress
@progress = new_progress
@@ -490,7 +498,7 @@ class Gem::StreamUI
end
def done
- @progress = 100
update_display(true, true)
end
@@ -498,8 +506,9 @@ class Gem::StreamUI
def update_display(show_progress = true, new_line = false)
return unless @out.tty?
- if show_progress
- @out.print "\rFetching: %s (%3d%%)" % [@file_name, @progress]
else
@out.print "Fetching: %s" % @file_name
end
@@ -5,7 +5,7 @@
######################################################################
SIMPLE_GEM = <<-GEMDATA
- MD5SUM = "b12a4d48febeb2289c539c2574c4b6f8"
if $0 == __FILE__
require 'optparse'
@@ -13,7 +13,7 @@ SIMPLE_GEM = <<-GEMDATA
ARGV.options do |opts|
opts.on_tail("--help", "show this message") {puts opts; exit}
opts.on('--dir=DIRNAME', "Installation directory for the Gem") {|options[:directory]|}
- opts.on('--force', "Force Gem to intall, bypassing dependency checks") {|options[:force]|}
opts.on('--gen-rdoc', "Generate RDoc documentation for the Gem") {|options[:gen_rdoc]|}
opts.parse!
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems'
-class TestConfig < RubyGemTestCase
def test_datadir
_, err = capture_io do
@@ -4,14 +4,14 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems'
require 'rubygems/gem_openssl'
require 'rubygems/installer'
require 'pathname'
require 'tmpdir'
-class TestGem < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/builder'
-class TestGemBuilder < RubyGemTestCase
def test_build
builder = Gem::Builder.new quick_gem('a')
@@ -4,14 +4,14 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/command'
class Gem::Command
public :parser
end
-class TestGemCommand < RubyGemTestCase
def setup
super
@@ -93,7 +93,7 @@ class TestGemCommand < RubyGemTestCase
assert done
end
- def test_invode_with_bad_options
use_ui @ui do
@cmd.when_invoked do true end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/command_manager'
-class TestGemCommandManager < RubyGemTestCase
def setup
super
@@ -21,7 +21,7 @@ class TestGemCommandManager < RubyGemTestCase
Gem.load_env_plugins
use_ui @ui do
- assert_raises MockGemUi::TermError do
@command_manager.run 'interrupt'
end
assert_equal '', ui.output
@@ -37,7 +37,7 @@ class TestGemCommandManager < RubyGemTestCase
@command_manager.register_command :crash
use_ui @ui do
- assert_raises MockGemUi::TermError do
@command_manager.run 'crash'
end
assert_equal '', ui.output
@@ -50,9 +50,9 @@ class TestGemCommandManager < RubyGemTestCase
def test_process_args_bad_arg
use_ui @ui do
- assert_raises(MockGemUi::TermError) {
@command_manager.process_args("--bad-arg")
- }
end
assert_match(/invalid option: --bad-arg/i, @ui.error)
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/build_command'
require 'rubygems/format'
-class TestGemCommandsBuildCommand < RubyGemTestCase
def setup
super
@@ -4,14 +4,14 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/cert_command'
unless defined? OpenSSL then
warn "`gem cert` tests are being skipped, module OpenSSL not found"
end
-class TestGemCommandsCertCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/check_command'
-class TestGemCommandsCheckCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/contents_command'
-class TestGemCommandsContentsCommand < RubyGemTestCase
def setup
super
@@ -54,7 +54,7 @@ class TestGemCommandsContentsCommand < RubyGemTestCase
def test_execute_bad_gem
@cmd.options[:args] = %w[foo]
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/dependency_command'
-class TestGemCommandsDependencyCommand < RubyGemTestCase
def setup
super
@@ -72,7 +72,7 @@ Gem pl-1-x86-linux
def test_execute_no_match
@cmd.options[:args] = %w[foo]
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
@@ -161,7 +161,7 @@ Gem foo-2
@cmd.options[:reverse_dependencies] = true
@cmd.options[:domain] = :remote
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/environment_command'
-class TestGemCommandsEnvironmentCommand < RubyGemTestCase
def setup
super
@@ -4,12 +4,12 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/package'
require 'rubygems/security'
require 'rubygems/commands/fetch_command'
-class TestGemCommandsFetchCommand < RubyGemTestCase
def setup
super
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/indexer'
require 'rubygems/commands/generate_index_command'
-class TestGemCommandsGenerateIndexCommand < RubyGemTestCase
def setup
super
@@ -35,7 +35,7 @@ class TestGemCommandsGenerateIndexCommand < RubyGemTestCase
@cmd.options[:rss_gems_host] = 'gems.example.com'
use_ui @ui do
- assert_raises MockGemUi::TermError do
@cmd.execute
end
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/install_command'
-class TestGemCommandsInstallCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/list_command'
-class TestGemCommandsListCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/lock_command'
-class TestGemCommandsLockCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/outdated_command'
-class TestGemCommandsOutdatedCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/owner_command'
-class TestGemCommandsOwnerCommand < RubyGemTestCase
def setup
super
@@ -44,7 +44,7 @@ EOF
response = "You don't have permission to push to this gem"
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 403, 'Forbidden']
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.show_owners("freewill")
end
@@ -72,7 +72,7 @@ EOF
response = "You don't have permission to push to this gem"
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.add_owners("freewill", ["[email protected]"])
end
@@ -100,7 +100,7 @@ EOF
response = "You don't have permission to push to this gem"
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 403, 'Forbidden']
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.remove_owners("freewill", ["[email protected]"])
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/pristine_command'
-class TestGemCommandsPristineCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/push_command'
-class TestGemCommandsPushCommand < RubyGemTestCase
def setup
super
@@ -74,7 +74,7 @@ class TestGemCommandsPushCommand < RubyGemTestCase
response = "You don't have permission to push to this gem"
@fetcher.data["#{Gem.host}/api/v1/gems"] = [response, 403, 'Forbidden']
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.send_gem(@path)
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/query_command'
-class TestGemCommandsQueryCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/server_command'
-class TestGemCommandsServerCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/sources_command'
-class TestGemCommandsSourcesCommand < RubyGemTestCase
def setup
super
@@ -90,7 +90,7 @@ class TestGemCommandsSourcesCommand < RubyGemTestCase
util_setup_spec_fetcher
use_ui @ui do
- assert_raises MockGemUi::TermError do
@cmd.execute
end
end
@@ -110,7 +110,7 @@ Error fetching http://beta-gems.example.com:
util_setup_spec_fetcher
use_ui @ui do
- assert_raises MockGemUi::TermError do
@cmd.execute
end
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/specification_command'
-class TestGemCommandsSpecificationCommand < RubyGemTestCase
def setup
super
@@ -51,7 +51,7 @@ class TestGemCommandsSpecificationCommand < RubyGemTestCase
def test_execute_bad_name
@cmd.options[:args] = %w[foo]
- assert_raises MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/stale_command'
-class TestGemCommandsStaleCommand < RubyGemTestCase
def setup
super
@@ -4,20 +4,16 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
-require "test/rubygems/gem_installer_test_case"
require 'rubygems/commands/uninstall_command'
-class TestGemCommandsUninstallCommand < GemInstallerTestCase
def setup
super
- ui = MockGemUi.new
- util_setup_gem ui
-
build_rake_in do
- use_ui ui do
@installer.install
end
end
@@ -28,15 +24,25 @@ class TestGemCommandsUninstallCommand < GemInstallerTestCase
end
def test_execute_removes_executable
if win_platform?
- assert_equal true, File.exist?(@executable)
else
- assert_equal true, File.symlink?(@executable)
end
# Evil hack to prevent false removal success
FileUtils.rm_f @executable
- File.open(@executable, "wb+") {|f| f.puts "binary"}
@cmd.options[:args] = Array(@spec.name)
use_ui @ui do
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/unpack_command'
-class TestGemCommandsUnpackCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/update_command'
-class TestGemCommandsUpdateCommand < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/commands/which_command'
-class TestGemCommandsWhichCommand < RubyGemTestCase
def setup
super
@@ -45,7 +45,7 @@ class TestGemCommandsWhichCommand < RubyGemTestCase
@cmd.handle_options %w[missing]
use_ui @ui do
- assert_raises MockGemUi::TermError do
@cmd.execute
end
end
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/config_file'
-class TestGemConfigFile < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/dependency'
-class TestGemDependency < RubyGemTestCase
def test_initialize
d = dep "pkg", "> 1.0"
@@ -64,7 +64,7 @@ class TestGemDependency < RubyGemTestCase
def test_equals_tilde
d = dep "a", "0"
- assert_match d, d, "matche self"
assert_match dep("a", ">= 0"), d, "match version exact"
assert_match dep("a", ">= 0"), dep("a", "1"), "match version"
assert_match dep(/a/, ">= 0"), d, "match simple regexp"
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/dependency_installer'
-class TestGemDependencyInstaller < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/dependency_list'
-class TestGemDependencyList < RubyGemTestCase
def setup
super
@@ -110,7 +110,7 @@ class TestGemDependencyList < RubyGemTestCase
'deps of trimmed specs not included'
end
- def test_dependency_order_no_dependendencies
@deplist.add @a1, @c2
order = @deplist.dependency_order
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/doc_manager'
-class TestGemDocManager < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/ext'
-class TestGemExtConfigureBuilder < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/ext'
-class TestGemExtExtConfBuilder < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/ext'
-class TestGemExtRakeBuilder < RubyGemTestCase
def setup
super
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require "test/rubygems/simple_gem"
require 'rubygems/format'
-class TestGemFormat < RubyGemTestCase
def setup
super
@@ -4,7 +4,7 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/gem_path_searcher'
class Gem::GemPathSearcher
@@ -12,7 +12,7 @@ class Gem::GemPathSearcher
attr_accessor :lib_dirs
end
-class TestGemGemPathSearcher < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/gem_runner'
-class TestGemGemRunner < RubyGemTestCase
def test_do_configuration
Gem.clear_paths
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems'
require 'rubygems/gemcutter_utilities'
-class TestGemGemcutterUtilities < RubyGemTestCase
def setup
super
@@ -74,7 +74,7 @@ class TestGemGemcutterUtilities < RubyGemTestCase
def test_sign_in_with_bad_credentials
skip 'Always uses $stdin on windows' if Gem.win_platform?
- assert_raises MockGemUi::TermError do
util_sign_in ['Access Denied.', 403, 'Forbidden']
end
@@ -98,7 +98,7 @@ class TestGemGemcutterUtilities < RubyGemTestCase
@fetcher.data["#{host}/api/v1/api_key"] = response
Gem::RemoteFetcher.fetcher = @fetcher
- @sign_in_ui = MockGemUi.new "#{email}\n#{password}\n"
use_ui @sign_in_ui do
@cmd.sign_in
@@ -4,14 +4,14 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/indexer'
-unless ''.respond_to? :to_xs then
warn "Gem::Indexer tests are being skipped. Install builder gem." if $VERBOSE
end
-class TestGemIndexer < RubyGemTestCase
def setup
super
@@ -558,5 +558,5 @@ eighty characters.&lt;/pre&gt;
refute File.exist?(file), "#{file} exists"
end
-end if ''.respond_to? :to_xs
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_installer_test_case"
require 'rubygems/install_update_options'
require 'rubygems/command'
-class TestGemInstallUpdateOptions < GemInstallerTestCase
def setup
super
@@ -4,9 +4,9 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_installer_test_case"
-class TestGemInstaller < GemInstallerTestCase
def test_app_script_text
util_make_exec '2', ''
@@ -72,6 +72,7 @@ load Gem.bin_path('a', 'my_exec', version)
end
def test_build_extensions_unsupported
@spec.extensions << nil
e = assert_raises Gem::Installer::ExtensionBuildError do
@@ -80,15 +81,15 @@ load Gem.bin_path('a', 'my_exec', version)
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
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/local_remote_options'
require 'rubygems/command'
-class TestGemLocalRemoteOptions < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_package_tar_test_case"
require 'rubygems/package'
-class TestGemPackageTarHeader < TarTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_package_tar_test_case"
require 'rubygems/package/tar_input'
-class TestGemPackageTarInput < TarTestCase
# Sometimes the setgid bit doesn't take. Don't know if this is a problem on
# all systems, or just some. But for now, we will ignore it in the tests.
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_package_tar_test_case"
require 'rubygems/package/tar_output'
-class TestGemPackageTarOutput < TarTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_package_tar_test_case"
require 'rubygems/package'
-class TestGemPackageTarReader < TarTestCase
def test_each_entry
tar = tar_dir_header "foo", "bar", 0
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_package_tar_test_case"
require 'rubygems/package'
-class TestGemPackageTarReaderEntry < TarTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_package_tar_test_case"
require 'rubygems/package/tar_writer'
-class TestTarWriter < TarTestCase
def setup
super
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems'
require 'rubygems/package_task'
-class TestGemPackageTask < RubyGemTestCase
def test_gem_package
gem = Gem::Specification.new do |g|
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/platform'
require 'rbconfig'
-class TestGemPlatform < RubyGemTestCase
def test_self_local
util_set_arch 'i686-darwin8.10.1'
@@ -4,7 +4,7 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'ostruct'
require 'webrick'
require 'rubygems/remote_fetcher'
@@ -24,7 +24,7 @@ require 'rubygems/format'
# software doesn't really care, as long as we hit the proxy URL when a
# proxy is configured.
-class TestGemRemoteFetcher < RubyGemTestCase
include Gem::DefaultUserInteraction
@@ -617,7 +617,7 @@ gems:
assert_equal '', response.body
end
- def test_request_unmodifed
uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}"
conn = util_stub_connection_for :body => '', :code => 304
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require "rubygems/requirement"
-class TestGemRequirement < RubyGemTestCase
def test_equals2
r = req "= 1.2"
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/security'
-class TestGemSecurity < RubyGemTestCase
def test_class_build_cert
name = OpenSSL::X509::Name.parse "CN=nobody/DC=example"
@@ -4,7 +4,7 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/server'
require 'stringio'
@@ -13,7 +13,7 @@ class Gem::Server
attr_reader :server
end
-class TestGemServer < RubyGemTestCase
def setup
super
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/source_index'
require 'rubygems/config_file'
-class TestGemSourceIndex < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/spec_fetcher'
-class TestGemSpecFetcher < RubyGemTestCase
def setup
super
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'stringio'
require 'rubygems/specification'
-class TestGemSpecification < RubyGemTestCase
LEGACY_YAML_SPEC = <<-EOF
--- !ruby/object:Gem::Specification
@@ -997,7 +997,7 @@ end
assert_equal "WARNING: no description specified\n", @ui.error, 'error'
- @ui = MockGemUi.new
@a1.summary = 'this is my summary'
@a1.description = @a1.summary
@@ -1133,7 +1133,7 @@ end
assert_equal "WARNING: no homepage specified\n", @ui.error, 'error'
- @ui = MockGemUi.new
@a1.homepage = ''
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/user_interaction'
require 'timeout'
-class TestGemStreamUI < RubyGemTestCase
module IsTty
attr_accessor :tty
@@ -199,6 +199,24 @@ class TestGemStreamUI < RubyGemTestCase
assert_equal "Fetching: a.gem\rFetching: a.gem ( 50%)\rFetching: a.gem (100%)\n", @out.string
end
def test_verbose_download_reporter_no_tty
@out.tty = false
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require "rubygems/text"
-class TestGemText < RubyGemTestCase
include Gem::Text
def test_format_text
@@ -4,31 +4,28 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gem_installer_test_case"
require 'rubygems/uninstaller'
-class TestGemUninstaller < GemInstallerTestCase
def setup
super
- ui = MockGemUi.new
- util_setup_gem ui
-
@user_spec.executables = ["my_exec"]
# HACK util_make_exec
user_bin_dir = File.join Gem.user_dir, 'gems', @user_spec.full_name, 'bin'
FileUtils.mkdir_p user_bin_dir
exec_path = File.join user_bin_dir, "my_exec"
- File.open exec_path, 'w' do |f|
f.puts "#!/usr/bin/ruby"
end
user_bin_dir = File.join Gem.user_dir, 'bin'
FileUtils.mkdir_p user_bin_dir
exec_path = File.join user_bin_dir, "my_exec"
- File.open exec_path, 'w' do |f|
f.puts "#!/usr/bin/ruby"
end
@@ -50,11 +47,14 @@ class TestGemUninstaller < GemInstallerTestCase
def test_remove_executables_force_keep
uninstaller = Gem::Uninstaller.new nil, :executables => false
use_ui @ui do
- uninstaller.remove_executables @spec
end
- assert_equal true, File.exist?(File.join(@gemhome, 'bin', 'executable'))
assert_equal "Executables and scripts will remain installed.\n", @ui.output
end
@@ -62,13 +62,16 @@ class TestGemUninstaller < GemInstallerTestCase
def test_remove_executables_force_remove
uninstaller = Gem::Uninstaller.new nil, :executables => true
use_ui @ui do
- uninstaller.remove_executables @spec
end
- assert_equal "Removing executable\n", @ui.output
- assert_equal false, File.exist?(File.join(@gemhome, 'bin', 'executable'))
end
def test_remove_executables_user
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require "test/rubygems/simple_gem"
require 'rubygems/validator'
-class TestGemValidator < RubyGemTestCase
def setup
super
@@ -4,10 +4,10 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require "rubygems/version"
-class TestGemVersion < RubyGemTestCase
def test_bump
assert_bumped_version_equal "5.3", "5.2.4"
@@ -4,11 +4,11 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
require 'rubygems/command'
require 'rubygems/version_option'
-class TestGemVersionOption < RubyGemTestCase
def setup
super
@@ -4,9 +4,9 @@
# File a instead and assign it to Ryan Davis or Eric Hodel.
######################################################################
-require "test/rubygems/gemutilities"
-class TestKernel < RubyGemTestCase
def setup
super
@@ -27,7 +27,7 @@ class TestKernel < RubyGemTestCase
assert $:.any? { |p| %r{a-1/lib} =~ p }
end
- def test_gem_redundent
assert gem('a', '= 1'), "Should load"
refute gem('a', '= 1'), "Should not load"
assert_equal 1, $:.select { |p| %r{a-1/lib} =~ p }.size