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.

### Methods

app_script_text build_extensions ensure_dependency exec_format extract_files formatted_program_filename generate_bin generate_bin_script generate_bin_symlink generate_windows_script install installation_satisfies_dependency? new shebang unpack windows_stub_script write_spec

### Included Modules

Gem::UserInteraction Gem::RequirePathsBuilder

### Classes and Modules

Class Gem::Installer::ExtensionBuildError

### Attributes

exec_format | [W] |

### Public Class methods

exec_format()

Defaults to use Ruby‘s program prefix and suffix.

new(gem, options={})

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

app_script_text(bin_file_name)

Return the text for an application file.

build_extensions()

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

ensure_dependency(spec, dependency)

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

extract_files()

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

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

formatted_program_filename(filename)

Prefix and suffix the program filename the same as ruby.

generate_bin()
generate_bin_script(filename, bindir)

Creates the scripts to run the applications in the gem.

generate_bin_symlink(filename, bindir)

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

generate_windows_script(bindir, filename)

Creates windows .bat files for easy running of commands

install()

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

installation_satisfies_dependency?(dependency)

True if the gems in Gem.source_index satisfy `dependency`.

shebang(bin_file_name)

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

unpack(directory)

Unpacks the gem into the given directory.

windows_stub_script(bindir, bin_file_name)

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

write_spec()

Writes the .gemspec specification (in Ruby) to the supplied spec_path.

spec: | [Gem::Specification] The Gem specification to output
spec_path: | [String] The location (path) to write the gemspec to

[Validate]