The installer installs the files contained in the .gem into the Gem.home.

Gem::Installer does the work of putting files in all the right places on the filesystem including unpacking the gem into its gem dir, installing the gemspec in the specifications dir, storing the cached gem in the cache dir, and installing either wrappers or symlinks for executables.

The installer invokes pre and post install hooks. Hooks can be added either through a rubygems_plugin.rb file in an installed gem or via a rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb file. See Gem.pre_install and Gem.post_install for details.

Constants

Paths where env(1) might live. Some systems are broken and have it in /bin

Deprecated in favor of Gem::Ext::BuildError

Attributes
Read

The directory a gem’s executables will be installed into

Read

The gem repository the gem will be installed into

Read

The options passed when the Gem::Installer was instantiated.

Read

The gem package instance.

Read & Write

True if we’ve warned about PATH not including Gem.bindir

Write

Overrides the executable format.

This is a sprintf format with a “%s” which will be replaced with the executable name. It is based off the ruby executable name’s difference from “ruby”.

Class Methods

Construct an installer object for the gem file located at path

Defaults to use Ruby’s program prefix and suffix.

Construct an installer object for an ephemeral gem (one where we don’t actually have a .gem file, just a spec)

Changes in rubygems to lazily loading ‘rubygems/command` (in order to lazily load `optparse` as a side effect) affect bundler’s custom installer which uses ‘Gem::Command` without requiring it (up until bundler 2.2.29). This hook is to compensate for that missing require.

TODO: Remove when rubygems no longer supports running on bundler older than 2.2.29.

Constructs an Installer instance that will install the gem at package which can either be a path or an instance of Gem::Package. options is a Hash with the following keys:

:bin_dir

Where to put a bin wrapper if needed.

:development

Whether or not development dependencies should be installed.

:env_shebang

Use /usr/bin/env in bin wrappers.

:force

Overrides all version checks and security policy checks, except for a signed-gems-only policy.

:format_executable

Format the executable the same as the Ruby executable. If your Ruby is ruby18, foo_exec will be installed as foo_exec18.

:ignore_dependencies

Don’t raise if a dependency is missing.

:install_dir

The directory to install the gem into.

:security_policy

Use the specified security policy. See Gem::Security

:user_install

Indicate that the gem should be unpacked into the users personal gem directory.

:only_install_dir

Only validate dependencies against what is in the install_dir

:wrappers

Install wrappers if true, symlinks if false.

:build_args

An Array of arguments to pass to the extension builder process. If not set, then Gem::Command.build_args is used

:post_install_message

Print gem post install message if true

Instance Methods

Return the text for an application file.

No documentation available

Builds extensions. Valid types of extensions are extconf.rb files, configure scripts and rakefiles or mkrf_conf files.

The location of the default spec file for default gems.

Return the target directory where the gem is to be installed. This directory is not guaranteed to be populated.

Ensure that the dependency is satisfied by the current installation of gem. If it is not an exception is raised.

spec

Gem::Specification

dependency

Gem::Dependency

Ensures the Gem::Specification written out for this gem is loadable upon installation.

Extracts only the bin/ files from the gem into the gem directory. This is used by default gems to allow a gem-aware stub to function without the full gem installed.

Reads the file index and extracts each file into the gem directory.

Ensures that files can’t be installed outside the gem directory.

Prefix and suffix the program filename the same as ruby.

Filename of the gem being installed.

Lazy accessor for the spec’s gem directory.

No documentation available

Creates the scripts to run the applications in the gem.

Creates the symlinks to run the applications in the gem. Moves the symlink if the gem being installed has a newer version.

Creates windows .bat files for easy running of commands

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

True if the gems in the system satisfy dependency.

Return an Array of Specifications contained within the gem_home we’ll be installing into.

Performs various checks before installing the gem such as the install repository is writable and its directories exist, required Ruby and rubygems versions are met and that dependencies are installed.

Version and dependency checks are skipped if this install is forced.

The dependent check will be skipped if the install is ignoring dependencies.

Generates a ! line for bin_file_name‘s wrapper copying arguments if necessary.

If the :custom_shebang config is set, then it is used as a template for how to create the shebang used for to run a gem’s executables.

The template supports 4 expansions:

$env    the path to the unix env utility
$ruby   the path to the currently running ruby interpreter
$exec   the path to the gem's executable
$name   the name of the gem the executable is for

Lazy accessor for the installer’s spec.

The location of the spec file that is installed.

Unpacks the gem into the given directory.

No documentation available

return the stub script text used to launch the true Ruby script

Writes the file containing the arguments for building this gem’s extensions.

Writes the .gem file to the cache directory

Writes the full .gemspec specification (in Ruby) to the gem home’s specifications/default directory.

Writes the .gemspec specification (in Ruby) to the gem home’s specifications directory.