Class Gem::Installer
In: lib/rubygems/installer_test_case.rb
lib/rubygems/installer.rb
Parent: Object

The installer class processes RubyGem .gem files and installs the files contained in the .gem into the Gem.path.

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.

Methods

Included Modules

Gem::UserInteraction Gem::RequirePathsBuilder

Classes and Modules

Class Gem::Installer::ExtensionBuildError

Constants

ENV_PATHS = %w[/usr/bin/env /bin/env]   Paths where env(1) might live. Some systems are broken and have it in /bin

Attributes

bin_dir  [R]  The directory a gem‘s executables will be installed into
env_shebang  [W]  Available through requiring rubygems/installer_test_case
exec_format  [W] 
format  [W]  Available through requiring rubygems/installer_test_case
format_executable  [W]  Available through requiring rubygems/installer_test_case
gem  [R] 
gem_dir  [W]  Available through requiring rubygems/installer_test_case
gem_home  [R]  The gem repository the gem will be installed into
gem_home  [W]  Available through requiring rubygems/installer_test_case
ignore_dependencies  [W]  Available through requiring rubygems/installer_test_case
options  [R]  The options passed when the Gem::Installer was instantiated.
path_warning  [RW]  True if we‘ve warned about PATH not including Gem.bindir
security_policy  [W]  Available through requiring rubygems/installer_test_case
spec  [W]  Available through requiring rubygems/installer_test_case
wrappers  [W]  Available through requiring rubygems/installer_test_case

Public Class methods

Defaults to use Ruby‘s program prefix and suffix.

Constructs an Installer instance that will install the gem located at gem. options is a Hash with the following keys:

: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.
:ignore_dependencies:Don‘t raise if a dependency is missing.
:install_dir:The directory to install the gem into.
:format_executable:Format the executable the same as the ruby executable. If your ruby is ruby18, foo_exec will be installed as foo_exec18.
:security_policy:Use the specified security policy. See Gem::Security
:wrappers:Install wrappers if true, symlinks if false.

Public Instance methods

Return the text for an application file.

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

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

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

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

Lazy accessor for the installer‘s Gem::Format instance.

Prefix and suffix the program filename the same as ruby.

Lazy accessor for the spec‘s gem directory.

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 source_index satisfy dependency.

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

Lazy accessor for the installer‘s spec.

Unpacks the gem into the given directory.

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

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

[Validate]