Class Gem::Installer
In: 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 fires 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

Attributes

bin_dir  [R]  The directory a gem‘s executables will be installed into
exec_format  [W] 
gem_home  [R]  The gem repository the gem will be installed into
home_install_warning  [RW]  True if we‘ve warned about ~/.gems install
path_warning  [RW]  True if we‘ve warned about PATH not including Gem.bindir
spec  [R]  The Gem::Specification for the gem being installed

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.

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.

Prefix and suffix the program filename the same as ruby.

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.

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]