Main module to hold all RubyGem classes/modules.
SHA1 | = | Digest::SHA1 | ||
SHA1 | = | DigestAdapter.new(Digest::SHA1) | ||
SHA256 | = | Digest::SHA256 | ||
SHA256 | = | DigestAdapter.new(Digest::SHA256) | ||
RubyGemsVersion | = | '1.1.1' | ||
ConfigMap | = | {} unless defined?(ConfigMap) | ||
RbConfig | = | Config unless defined? ::RbConfig | ||
DIRECTORIES | = | %w[cache doc gems specifications] unless defined?(DIRECTORIES) | ||
MUTEX | = | Mutex.new | ||
RubyGemsPackageVersion | = | RubyGemsVersion | ||
WIN_PATTERNS | = | [ /bccwin/i, /cygwin/i, /djgpp/i, /mingw/i, /mswin/i, /wince/i, ] | An Array of Regexps that match windows ruby platforms. |
== | -> | eql? |
loaded_specs | [R] | |
ssl_available | [W] | Set the value of the ssl_avilable flag. |
Activates an installed gem matching gem. The gem must satisfy version_requirements.
Returns true if the gem is activated, false if it is already loaded, or an exception otherwise.
Gem#activate adds the library paths in gem to $LOAD_PATH. Before a Gem is activated its required Gems are activated. If the version information is omitted, the highest version Gem of the supplied name is loaded. If a Gem is not found that meets the version requirements or a required Gem is not found, a Gem::LoadError is raised.
More information on version requirements can be found in the Gem::Requirement and Gem::Version documentation.
Used to specify the name and default value of a specification attribute. The side effects are:
The reader method behaves like this:
def attribute @attribute ||= (copy of default value) end
This allows lazy initialization of attributes to their default values.
Defines a singular version of an existing plural attribute (i.e. one whose value is expected to be an array). This means just creating a helper method that takes a single value and appends it to the array. These are created for convenience, so that in a spec, one can write
s.require_path = 'mylib'
instead of
s.require_paths = ['mylib']
That above convenience is available courtesy of
attribute_alias_singular :require_path, :require_paths
Shortcut for creating several attributes at once (each with a default value of nil).
Use the given configuration object (which implements the ConfigFile protocol) as the standard configuration object.
The path the the data directory specified by the gem name. If the package is not available as a gem, return nil.
Default home directory path to be used if an alternate value is not specified in the environment.
Quietly ensure the named Gem directory contains all the proper subdirectories. If we can‘t create a directory due to a permission problem, then we will silently continue.
Special loader for YAML files. When a Specification object is loaded from a YAML file, it bypasses the normal Ruby object initialization routine (initialize). This method makes up for that and deals with gems of different ages.
‘input’ can be anything that YAML.load() accepts: String or IO.
The index to insert activated gem paths into the $LOAD_PATH.
Defaults to the site lib directory unless gem_prelude.rb has loaded paths, then it inserts the activated gem‘s paths before the gem_prelude.rb paths so you can override the gem_prelude.rb default $LOAD_PATH paths.
Specification constructor. Assigns the default values to the attributes, adds this spec to the list of loaded specs (see Specification.list), and yields itself for further initialization.
Some attributes require special behaviour when they are accessed. This allows for that.
Adds a dependency to this Gem. For example,
spec.add_dependency('jabber4r', '> 0.1', '<= 0.5')
gem: | [String or Gem::Dependency] The Gem name/dependency. |
requirements: | [default=">= 0"] The version requirements. |
Each attribute has a default value (possibly nil). Here, we initialize all attributes to their default value. This is done through the accessor methods, so special behaviours will be honored. Furthermore, we take a copy of the default so each specification instance has its own empty arrays, etc.
The root directory that the gem was installed into.
return: | [String] the installation path |
Checks if this Specification meets the requirement of the supplied dependency.
dependency: | [Gem::Dependency] the dependency to check |
return: | [Boolean] true if dependency is met, otherwise false |
Returns a Ruby code representation of this specification, such that it can be eval‘ed and reconstruct the same specification later. Attributes that still have their default values are omitted.
Checks that the specification contains all required fields, and does a very basic sanity check.
Raises InvalidSpecificationException if the spec does not pass the checks..