teardown()public
#teardown restores the process to its original state and removes the tempdir unless the KEEP_FILES environment variable was set.
# File lib/rubygems/test_case.rb, line 372
def teardown
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
if @orig_LOADED_FEATURES
if @orig_LOAD_PATH
paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
unless paths.any? {|path| feat.start_with?(path)}
$LOADED_FEATURES.delete(feat)
end
end
else
$LOADED_FEATURES.replace @orig_LOADED_FEATURES
end
end
if @orig_BASERUBY
RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY
else
RbConfig::CONFIG.delete('BASERUBY')
end
RbConfig::CONFIG['arch'] = @orig_arch
if defined? Gem::RemoteFetcher then
Gem::RemoteFetcher.fetcher = nil
end
Dir.chdir @current_dir
FileUtils.rm_rf @tempdir unless ENV['KEEP_FILES']
ENV.clear
@orig_gem_env_requirements.each do |k,v|
ENV[k] = v
end
ENV['GEM_HOME'] = @orig_gem_home
ENV['GEM_PATH'] = @orig_gem_path
ENV['GEM_VENDOR'] = @orig_gem_vendor
ENV['GEM_SPEC_CACHE'] = @orig_gem_spec_cache
ENV['RUBYGEMS_GEMDEPS'] = @orig_rubygems_gemdeps
ENV['BUNDLE_GEMFILE'] = @orig_bundle_gemfile
ENV['RUBYGEMS_HOST'] = @orig_rubygems_host
Gem.ruby = @orig_ruby if @orig_ruby
if @orig_ENV_HOME then
ENV['HOME'] = @orig_ENV_HOME
else
ENV.delete 'HOME'
end
Gem.instance_variable_set :@default_dir, nil
ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = @orig_gem_private_key_passphrase
Gem::Specification._clear_load_cache
Gem::Specification.unresolved_deps.clear
Gem::refresh
@back_ui.close
end Related methods
- Instance methods
- add_to_fetcher
- all_spec_names
- ask_if_ok
- assert_activate
- assert_contains_make_command
- assert_path_exists
- build_rake_in
- common_installer_setup
- common_installer_teardown
- create_tmpdir
- dep
- dependency_request
- enable_shared
- git_gem
- have_git?
- in_path?
- install_default_gems
- install_default_specs
- install_gem
- install_gem_user
- install_specs
- loaded_spec_names
- make_command
- mu_pp
- new_default_spec
- new_spec
- nmake_found?
- parse_make_command_line
- process_based_port
- quick_gem
- quick_spec
- read_binary
- read_cache
- refute_path_exists
- req
- save_gemspec
- save_loaded_features
- scan_make_command_lines
- setup
- spec
- spec_fetcher
- teardown
- uninstall_gem
- unresolved_names
- util_build_gem
- util_clear_gems
- util_gem
- util_gzip
- util_make_gems
- util_remove_gem
- util_restore_RUBY_VERSION
- util_set_RUBY_VERSION
- util_set_arch
- util_setup_fake_fetcher
- util_setup_spec_fetcher
- util_spec
- util_zip
- v
- vc_windows?
- vendor_gem
- wait_for_child_process_to_exit
- win_platform?
- write_file
- Class methods
- cert_path
- key_path
- load_cert
- load_key
- make_command
- process_based_port
- rubybin
- vc_windows?
- win_platform?