Class: Composer::Package::AliasPackage

Inherits:
BasePackage show all
Defined in:
lib/composer/package/alias_package.rb

Overview

The root package represents the project’s composer.json and contains additional metadata

Author:

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

Attributes inherited from BasePackage

#id, #name, #pretty_name, #pretty_version, #repository, #stability, #version

Instance Method Summary collapse

Methods inherited from BasePackage

#attributes, #pretty_string, stabilities, #to_s, #type=, #unique_name

Constructor Details

#initialize(alias_of, version, pretty_version) ⇒ AliasPackage

All descendants’ constructors should call this parent constructor

Parameters:

  • alias_of

    Package The package this package is an alias of

  • version

    String The version the alias must report

  • pretty_version

    String The alias’s non-normalized version



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/composer/package/alias_package.rb', line 32

def initialize(alias_of, version, pretty_version)
  super(alias_of.name)

  @version = version
  @pretty_version = pretty_version
  @alias_of = alias_of
  @stability = Composer::Package::Version::VersionParser::parse_stability(version)
  @dev = @stability === 'dev'

  # replace self.version dependencies
  %w{requires dev_requires}.each do |type|

    links = alias_of.send(type)
    links.each do |index, link|
      # link is self.version, but must be replacing also the replaced version
      if 'self.version' === link.pretty_constraint
        links[index] = Composer::Package::Link.new(
          link.source,
          link.target,
          Composer::Package::LinkConstraint::VersionConstraint.new(
            '=',
            @version
          ),
          type,
          pretty_version
        )
      end
    end
    @type = links
  end

  # duplicate self.version provides
  %w{conflicts provides replaces}.each do |type|
    links = alias_of.send(type)
    new_links = []
    links.each do |link|
      # link is self.version, but must be replacing also the replaced version
      if 'self.version' === link.pretty_constraint
        new_links = Composer.Package.Link.new(
          link.source,
          link.target,
          Composer::Package::LinkConstraint.VersionConstraint.new(
            '=',
            @version
          ),
          type,
          pretty_version
        )
      end
    end
    @type = links.zip(new_links).flatten.compact
    # @type = (links << new_links)
  end

end

Instance Attribute Details

#alias_ofObject (readonly)

Returns the value of attribute alias_of.



21
22
23
# File 'lib/composer/package/alias_package.rb', line 21

def alias_of
  @alias_of
end

#authorsObject

Returns the value of attribute authors.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def authors
  @authors
end

#conflictsObject (readonly)

Returns the value of attribute conflicts.



21
22
23
# File 'lib/composer/package/alias_package.rb', line 21

def conflicts
  @conflicts
end

#descriptionObject

Returns the value of attribute description.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def description
  @description
end

#homepageObject

Returns the value of attribute homepage.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def homepage
  @homepage
end

#keywordsObject

Returns the value of attribute keywords.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def keywords
  @keywords
end

#licenseObject

Returns the value of attribute license.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def license
  @license
end

#providesObject (readonly)

Returns the value of attribute provides.



21
22
23
# File 'lib/composer/package/alias_package.rb', line 21

def provides
  @provides
end

#replacesObject (readonly)

Returns the value of attribute replaces.



21
22
23
# File 'lib/composer/package/alias_package.rb', line 21

def replaces
  @replaces
end

#repositoriesObject

Returns the value of attribute repositories.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def repositories
  @repositories
end

#requiresObject (readonly)

Returns the value of attribute requires.



21
22
23
# File 'lib/composer/package/alias_package.rb', line 21

def requires
  @requires
end

#scriptsObject

Returns the value of attribute scripts.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def scripts
  @scripts
end

#source_mirrorsObject

Returns the value of attribute source_mirrors.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def source_mirrors
  @source_mirrors
end

#source_referenceObject

Returns the value of attribute source_reference.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def source_reference
  @source_reference
end

#source_urlObject

Returns the value of attribute source_url.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def source_url
  @source_url
end

#supportObject

Returns the value of attribute support.



24
25
26
# File 'lib/composer/package/alias_package.rb', line 24

def support
  @support
end

Instance Method Details

#archive_excludesObject



260
261
262
# File 'lib/composer/package/alias_package.rb', line 260

def archive_excludes
  @alias_of.archive_excludes
end

#autoloadObject



208
209
210
# File 'lib/composer/package/alias_package.rb', line 208

def autoload
  @alias_of.autoload
end

#binariesObject



228
229
230
# File 'lib/composer/package/alias_package.rb', line 228

def binaries
  @alias_of.binaries
end

#dev_autoloadObject



212
213
214
# File 'lib/composer/package/alias_package.rb', line 212

def dev_autoload
  @alias_of.dev_autoload
end

#dist_mirrorsObject



196
197
198
# File 'lib/composer/package/alias_package.rb', line 196

def dist_mirrors
  @alias_of.dist_mirrors
end

#dist_mirrors=(mirrors) ⇒ Object



192
193
194
# File 'lib/composer/package/alias_package.rb', line 192

def dist_mirrors=(mirrors)
  @alias_of.dist_mirrors = mirrors
end

#dist_referenceObject



172
173
174
# File 'lib/composer/package/alias_package.rb', line 172

def dist_reference
  @alias_of.dist_reference
end

#dist_reference=(reference) ⇒ Object



176
177
178
# File 'lib/composer/package/alias_package.rb', line 176

def dist_reference=(reference)
  @alias_of.dist_reference = reference
end

#dist_sha1_checksumObject



180
181
182
# File 'lib/composer/package/alias_package.rb', line 180

def dist_sha1_checksum
  @alias_of.dist_sha1_checksum
end

#dist_typeObject



160
161
162
# File 'lib/composer/package/alias_package.rb', line 160

def dist_type
  @alias_of.dist_type
end

#dist_urlObject



164
165
166
# File 'lib/composer/package/alias_package.rb', line 164

def dist_url
  @alias_of.dist_url
end

#dist_urlsObject



168
169
170
# File 'lib/composer/package/alias_package.rb', line 168

def dist_urls
  @alias_of.dist_urls
end

#extraObject



120
121
122
# File 'lib/composer/package/alias_package.rb', line 120

def extra
  @alias_of.extra
end

#include_pathsObject



216
217
218
# File 'lib/composer/package/alias_package.rb', line 216

def include_paths
  @alias_of.include_paths
end

#installation_sourceObject



128
129
130
# File 'lib/composer/package/alias_package.rb', line 128

def installation_source
  @alias_of.installation_source
end

#installation_source=(type) ⇒ Object



124
125
126
# File 'lib/composer/package/alias_package.rb', line 124

def installation_source=(type)
  @alias_of.installation_source = type
end

#is_abandoned?Boolean

Returns:

  • (Boolean)


264
265
266
# File 'lib/composer/package/alias_package.rb', line 264

def is_abandoned?
  @alias_of.is_abandoned?
end

#is_devObject

Determine if development package Return: true if development package; Otherwise false.



90
91
92
# File 'lib/composer/package/alias_package.rb', line 90

def is_dev
  @dev
end

#is_root_package_aliasObject

Returns bool.

Returns:

  • bool

See Also:

  • setRootPackageAlias


104
105
106
# File 'lib/composer/package/alias_package.rb', line 104

def is_root_package_alias
  @root_package_alias
end

#notification_urlObject



256
257
258
# File 'lib/composer/package/alias_package.rb', line 256

def notification_url
  @alias_of.notification_url
end

#release_dateObject



224
225
226
# File 'lib/composer/package/alias_package.rb', line 224

def release_date
  @alias_of.release_date
end

#replacement_packageObject



268
269
270
# File 'lib/composer/package/alias_package.rb', line 268

def replacement_package
  @alias_of.replacement_package
end

#root_package_alias=(value) ⇒ Object

Stores whether this is an alias created by an aliasing in the requirements of the root package or not Use by the policy for sorting manually aliased packages first, see #576

Parameters:

  • bool

    $value

Returns:

  • mixed



98
99
100
# File 'lib/composer/package/alias_package.rb', line 98

def root_package_alias=(value)
  @root_package_alias = value
end

#source_typeObject



132
133
134
# File 'lib/composer/package/alias_package.rb', line 132

def source_type
  @alias_of.source_type
end

#source_urlsObject



140
141
142
# File 'lib/composer/package/alias_package.rb', line 140

def source_urls
  @alias_of.source_urls
end

#suggestsObject



244
245
246
# File 'lib/composer/package/alias_package.rb', line 244

def suggests
  @alias_of.suggests
end

#target_dirObject



116
117
118
# File 'lib/composer/package/alias_package.rb', line 116

def target_dir
  @alias_of.target_dir
end

#transport_optionsObject



188
189
190
# File 'lib/composer/package/alias_package.rb', line 188

def transport_options
  @alias_of.transport_options
end

#transport_options=(options) ⇒ Object



184
185
186
# File 'lib/composer/package/alias_package.rb', line 184

def transport_options=(options)
  @alias_of.transport_options = options
end

#typeObject

Wrappers around the aliased package #



112
113
114
# File 'lib/composer/package/alias_package.rb', line 112

def type
  @alias_of.Type
end