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
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/composer/package/package.rb', line 36 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.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def archive_excludes @archive_excludes end |
#autoload ⇒ Object
Returns the value of attribute autoload.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def autoload @autoload end |
#binaries ⇒ Object
Returns the value of attribute binaries.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def binaries @binaries end |
#conflicts ⇒ Object
Returns the value of attribute conflicts.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def conflicts @conflicts end |
#dev_autoload ⇒ Object
Returns the value of attribute dev_autoload.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def dev_autoload @dev_autoload end |
#dev_requires ⇒ Object
Returns the value of attribute dev_requires.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def dev_requires @dev_requires end |
#dist_mirrors ⇒ Object
Returns the value of attribute dist_mirrors.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def dist_mirrors @dist_mirrors end |
#dist_reference ⇒ Object
Returns the value of attribute dist_reference.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def dist_reference @dist_reference end |
#dist_sha1_checksum ⇒ Object
Returns the value of attribute dist_sha1_checksum.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def dist_sha1_checksum @dist_sha1_checksum end |
#dist_type ⇒ Object
Returns the value of attribute dist_type.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def dist_type @dist_type end |
#dist_url ⇒ Object
Returns the value of attribute dist_url.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def dist_url @dist_url end |
#extra ⇒ Object
Returns the value of attribute extra.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def extra @extra end |
#include_paths ⇒ Object
Returns the value of attribute include_paths.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def include_paths @include_paths end |
#installation_source ⇒ Object
Returns the value of attribute installation_source.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def installation_source @installation_source end |
#notification_url ⇒ Object
Returns the value of attribute notification_url.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def notification_url @notification_url end |
#provides ⇒ Object
Returns the value of attribute provides.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def provides @provides end |
#release_date ⇒ Object
Returns the value of attribute release_date.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def release_date @release_date end |
#replaces ⇒ Object
Returns the value of attribute replaces.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def replaces @replaces end |
#requires ⇒ Object
Returns the value of attribute requires.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def requires @requires end |
#source_mirrors ⇒ Object
Returns the value of attribute source_mirrors.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def source_mirrors @source_mirrors end |
#source_reference ⇒ Object
Returns the value of attribute source_reference.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def source_reference @source_reference end |
#source_type ⇒ Object
Returns the value of attribute source_type.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def source_type @source_type end |
#source_url ⇒ Object
Returns the value of attribute source_url.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def source_url @source_url end |
#stability ⇒ Object (readonly)
Returns the value of attribute stability.
19 20 21 |
# File 'lib/composer/package/package.rb', line 19 def stability @stability end |
#suggests ⇒ Object
Returns the value of attribute suggests.
21 22 23 |
# File 'lib/composer/package/package.rb', line 21 def suggests @suggests end |
Instance Method Details
#attributes ⇒ Object
58 59 60 61 |
# File 'lib/composer/package/package.rb', line 58 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.
98 99 100 |
# File 'lib/composer/package/package.rb', line 98 def is_dev @dev end |
#pretty_string ⇒ Object
92 93 94 |
# File 'lib/composer/package/package.rb', line 92 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
106 107 108 109 110 111 112 |
# File 'lib/composer/package/package.rb', line 106 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
79 80 81 82 83 |
# File 'lib/composer/package/package.rb', line 79 def target_dir return unless @target_dir regex = '(?:^|[\\\\/]+)\.\.?(?:[\\\\/]+|$)(?:\.\.?(?:[\\\\/]+|$))*' @target_dir.gsub(/#{regex}/x, '/').gsub(/^\/+/, '') end |
#target_dir=(target_dir) ⇒ Object
75 76 77 |
# File 'lib/composer/package/package.rb', line 75 def target_dir=(target_dir) @target_dir = target_dir end |
#type ⇒ Object
Get package type Return: string
71 72 73 |
# File 'lib/composer/package/package.rb', line 71 def type @type ? @type : 'library' end |
#type=(type) ⇒ Object
Set package type Param: string type
65 66 67 |
# File 'lib/composer/package/package.rb', line 65 def type=(type) @type = type end |
#unique_name ⇒ Object
Returns package unique name, constructed from name, version and release type. Return: string
88 89 90 |
# File 'lib/composer/package/package.rb', line 88 def unique_name "#{name}-#{version}" end |