Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Installer#install
install
lib/rubygems/installer.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/installer.rb, line 274
def install
assign_content_address
pre_install_checks
run_pre_install_hooks
# Set loaded_from to ensure extension_dir is correct
spec.loaded_from = spec_file
# Completely remove any previous gem files
FileUtils.rm_rf gem_dir
FileUtils.rm_rf spec.extension_dir
dir_mode = options[:dir_mode]
FileUtils.mkdir_p gem_dir, mode: dir_mode && 0o755
extract_files
build_extensions
write_build_info_file
run_post_build_hooks
generate_bin
if options[:install_plugin] == false
remove_stale_plugins
warn_skipped_plugins
else
generate_plugins
end
write_spec
write_cache_file
File.chmod(dir_mode, gem_dir) if dir_mode
say clean_text(spec.post_install_message.to_s) if options[:post_install_message] && !spec.post_install_message.nil?
if incompatible_abi_install?
say "#{spec.full_name} is scoped to Ruby ABI #{spec.ruby_abi} and will not be visible to the running Ruby (ABI #{Gem.ruby_abi})"
else
Gem::Specification.add_spec(spec) unless @install_dir
end
load_plugin unless options[:install_plugin] == false
run_post_install_hooks
spec
rescue Errno::EACCES => e
# Permission denied - /path/to/foo
raise Gem::FilePermissionError, e.message.split(" - ").last
end
Installs the gem and returns a loaded Gem::Specification for the installed gem.
The gem will be installed with the following structure:
@gem_home/ cache/<gem-version>.gem #=> a cached copy of the installed gem gems/<gem-version>/... #=> extracted files specifications/<gem-version>.gemspec #=> the Gem::Specification
See also
#incompatible_abi_install?
#installation_satisfies_dependency?
#generate_windows_script
#installed_specs
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0