Class: Composer::Package::Package
- Inherits:
-
BasePackage
- Object
- BasePackage
- Composer::Package::Package
- Defined in:
- lib/composer/package/package.rb
Overview
Core package definitions that are needed to resolve dependencies and install packages
Direct Known Subclasses
Constant Summary
Constants inherited from BasePackage
BasePackage::STABILITY_ALPHA, BasePackage::STABILITY_BETA, BasePackage::STABILITY_DEV, BasePackage::STABILITY_RC, BasePackage::STABILITY_STABLE, BasePackage::SUPPORTED_LINK_TYPES
Instance Attribute Summary collapse
-
#archive_excludes ⇒ Object
Returns the value of attribute archive_excludes.
-
#autoload ⇒ Object
Returns the value of attribute autoload.
-
#binaries ⇒ Object
Returns the value of attribute binaries.
-
#conflicts ⇒ Object
Returns the value of attribute conflicts.
-
#dev_autoload ⇒ Object
Returns the value of attribute dev_autoload.
-
#dev_requires ⇒ Object
Returns the value of attribute dev_requires.
-
#dist_mirrors ⇒ Object
Returns the value of attribute dist_mirrors.
-
#dist_reference ⇒ Object
Returns the value of attribute dist_reference.
-
#dist_sha1_checksum ⇒ Object
Returns the value of attribute dist_sha1_checksum.
-
#dist_type ⇒ Object
Returns the value of attribute dist_type.
-
#dist_url ⇒ Object
Returns the value of attribute dist_url.
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#include_paths ⇒ Object
Returns the value of attribute include_paths.
-
#installation_source ⇒ Object
Returns the value of attribute installation_source.
-
#notification_url ⇒ Object
Returns the value of attribute notification_url.
-
#provides ⇒ Object
Returns the value of attribute provides.
-
#release_date ⇒ Object
Returns the value of attribute release_date.
-
#replaces ⇒ Object
Returns the value of attribute replaces.
-
#requires ⇒ Object
Returns the value of attribute requires.
-
#source_mirrors ⇒ Object
Returns the value of attribute source_mirrors.
-
#source_reference ⇒ Object
Returns the value of attribute source_reference.
-
#source_type ⇒ Object
Returns the value of attribute source_type.
-
#source_url ⇒ Object
Returns the value of attribute source_url.
-
#stability ⇒ Object
readonly
Returns the value of attribute stability.
-
#suggests ⇒ Object
Returns the value of attribute suggests.
Attributes inherited from BasePackage
#id, #name, #pretty_name, #pretty_version, #repository, #transport_options, #version
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(name, version, pretty_version) ⇒ Package
constructor
Creates a new in memory package.
-
#is_dev ⇒ Object
Determine if development package Return: true if development package; Otherwise false.
- #pretty_string ⇒ Object
-
#replace_version(version, pretty_version) ⇒ Object
Replaces current version and pretty version with passed values.
- #target_dir ⇒ Object
- #target_dir=(target_dir) ⇒ Object
-
#type ⇒ Object
Get package type Return: string.
-
#type=(type) ⇒ Object
Set package type Param: string type.
-
#unique_name ⇒ Object
Returns package unique name, constructed from name, version and release type.
Methods inherited from BasePackage
Constructor Details
#initialize(name, version, pretty_version) ⇒ Package
Creates a new in memory package. Param: string name The package’s name Param: string version The package’s version Param: string prettyVersion The package’s non-normalized version
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/composer/package/package.rb', line 38 def initialize(name, version, pretty_version) super(name) # default values @extra = {} @binaries = [] @requires = {} @conflicts = {} @provides = {} @replaces = {} @dev_requires = {} @suggests = {} @autoload = {} @dev_autoload = {} @include_paths = [] @archive_excludes = [] # init package attributes replace_version(version, pretty_version) end |
Instance Attribute Details
#archive_excludes ⇒ Object
Returns the value of attribute archive_excludes.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def archive_excludes @archive_excludes end |
#autoload ⇒ Object
Returns the value of attribute autoload.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def autoload @autoload end |
#binaries ⇒ Object
Returns the value of attribute binaries.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def binaries @binaries end |
#conflicts ⇒ Object
Returns the value of attribute conflicts.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def conflicts @conflicts end |
#dev_autoload ⇒ Object
Returns the value of attribute dev_autoload.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def dev_autoload @dev_autoload end |
#dev_requires ⇒ Object
Returns the value of attribute dev_requires.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def dev_requires @dev_requires end |
#dist_mirrors ⇒ Object
Returns the value of attribute dist_mirrors.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def dist_mirrors @dist_mirrors end |
#dist_reference ⇒ Object
Returns the value of attribute dist_reference.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def dist_reference @dist_reference end |
#dist_sha1_checksum ⇒ Object
Returns the value of attribute dist_sha1_checksum.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def dist_sha1_checksum @dist_sha1_checksum end |
#dist_type ⇒ Object
Returns the value of attribute dist_type.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def dist_type @dist_type end |
#dist_url ⇒ Object
Returns the value of attribute dist_url.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def dist_url @dist_url end |
#extra ⇒ Object
Returns the value of attribute extra.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def extra @extra end |
#include_paths ⇒ Object
Returns the value of attribute include_paths.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def include_paths @include_paths end |
#installation_source ⇒ Object
Returns the value of attribute installation_source.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def installation_source @installation_source end |
#notification_url ⇒ Object
Returns the value of attribute notification_url.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def notification_url @notification_url end |
#provides ⇒ Object
Returns the value of attribute provides.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def provides @provides end |
#release_date ⇒ Object
Returns the value of attribute release_date.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def release_date @release_date end |
#replaces ⇒ Object
Returns the value of attribute replaces.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def replaces @replaces end |
#requires ⇒ Object
Returns the value of attribute requires.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def requires @requires end |
#source_mirrors ⇒ Object
Returns the value of attribute source_mirrors.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def source_mirrors @source_mirrors end |
#source_reference ⇒ Object
Returns the value of attribute source_reference.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def source_reference @source_reference end |
#source_type ⇒ Object
Returns the value of attribute source_type.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def source_type @source_type end |
#source_url ⇒ Object
Returns the value of attribute source_url.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def source_url @source_url end |
#stability ⇒ Object (readonly)
Returns the value of attribute stability.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def stability @stability end |
#suggests ⇒ Object
Returns the value of attribute suggests.
23 24 25 |
# File 'lib/composer/package/package.rb', line 23 def suggests @suggests end |
Instance Method Details
#attributes ⇒ Object
60 61 62 63 |
# File 'lib/composer/package/package.rb', line 60 def attributes dumper = Composer::Package::Dumper::HashDumper.new dumper.dump(self) end |
#is_dev ⇒ Object
Determine if development package Return: true if development package; Otherwise false.
100 101 102 |
# File 'lib/composer/package/package.rb', line 100 def is_dev @dev end |
#pretty_string ⇒ Object
94 95 96 |
# File 'lib/composer/package/package.rb', line 94 def pretty_string "#{pretty_name} #{pretty_version}" end |
#replace_version(version, pretty_version) ⇒ Object
Replaces current version and pretty version with passed values. It also sets stability. Param: string version The package’s normalized version Param: string prettyVersion The package’s non-normalized version
108 109 110 111 112 113 114 |
# File 'lib/composer/package/package.rb', line 108 def replace_version(version, pretty_version) @version = version @pretty_version = pretty_version @stability = Composer::Package::Version::VersionParser::parse_stability(version) @dev = @stability === 'dev' end |
#target_dir ⇒ Object
81 82 83 84 85 |
# File 'lib/composer/package/package.rb', line 81 def target_dir return unless @target_dir regex = '(?:^|[\\\\/]+)\.\.?(?:[\\\\/]+|$)(?:\.\.?(?:[\\\\/]+|$))*' @target_dir.gsub(/#{regex}/x, '/').gsub(/^\/+/, '') end |
#target_dir=(target_dir) ⇒ Object
77 78 79 |
# File 'lib/composer/package/package.rb', line 77 def target_dir=(target_dir) @target_dir = target_dir end |
#type ⇒ Object
Get package type Return: string
73 74 75 |
# File 'lib/composer/package/package.rb', line 73 def type @type ? @type : 'library' end |
#type=(type) ⇒ Object
Set package type Param: string type
67 68 69 |
# File 'lib/composer/package/package.rb', line 67 def type=(type) @type = type end |
#unique_name ⇒ Object
Returns package unique name, constructed from name, version and release type. Return: string
90 91 92 |
# File 'lib/composer/package/package.rb', line 90 def unique_name "#{name}-#{version}" end |