php-composer 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +10 -10
- data/Gemfile +15 -15
- data/LICENSE.txt +21 -21
- data/README.md +35 -35
- data/Rakefile +1 -1
- data/lib/composer.rb +52 -52
- data/lib/composer/error.rb +8 -8
- data/lib/composer/json/json_file.rb +270 -270
- data/lib/composer/package/alias_package.rb +273 -273
- data/lib/composer/package/base_package.rb +130 -130
- data/lib/composer/package/complete_package.rb +55 -55
- data/lib/composer/package/dumper/hash_dumper.rb +169 -169
- data/lib/composer/package/link.rb +51 -51
- data/lib/composer/package/link_constraint/base_constraint.rb +35 -35
- data/lib/composer/package/link_constraint/empty_constraint.rb +34 -34
- data/lib/composer/package/link_constraint/multi_constraint.rb +66 -66
- data/lib/composer/package/link_constraint/specific_constraint.rb +40 -40
- data/lib/composer/package/link_constraint/version_constraint.rb +220 -220
- data/lib/composer/package/loader/hash_loader.rb +316 -316
- data/lib/composer/package/loader/json_loader.rb +47 -47
- data/lib/composer/package/loader/project_attributes_loader.rb +71 -71
- data/lib/composer/package/loader/project_root_package_loader.rb +28 -28
- data/lib/composer/package/package.rb +118 -118
- data/lib/composer/package/root_alias_package.rb +37 -37
- data/lib/composer/package/root_package.rb +37 -37
- data/lib/composer/package/version/version_parser.rb +583 -583
- data/lib/composer/package/version/version_selector.rb +106 -106
- data/lib/composer/repository/filesystem_repository.rb +84 -85
- data/lib/composer/repository/{array_repository.rb → hash_repository.rb} +195 -195
- data/lib/composer/repository/{writeable_array_repository.rb → writeable_hash_repository.rb} +57 -59
- data/lib/composer/version.rb +3 -3
- data/php-composer.gemspec +31 -31
- metadata +4 -4
@@ -1,51 +1,51 @@
|
|
1
|
-
#
|
2
|
-
# This file was ported to ruby from Composer php source code file.
|
3
|
-
# Original Source: Composer\Package\Link.php
|
4
|
-
#
|
5
|
-
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
-
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
-
#
|
8
|
-
# For the full copyright and license information, please view the LICENSE
|
9
|
-
# file that was distributed with this source code.
|
10
|
-
#
|
11
|
-
|
12
|
-
module Composer
|
13
|
-
module Package
|
14
|
-
|
15
|
-
# Represents a link between two packages, represented by their names
|
16
|
-
class Link
|
17
|
-
|
18
|
-
attr_reader :source, :target, :constraint
|
19
|
-
|
20
|
-
# Creates a new package link.
|
21
|
-
# @param string source
|
22
|
-
# @param string target
|
23
|
-
# @param LinkConstraintInterface constraint Constraint applying to the target of this link
|
24
|
-
# @param string description Used to create a descriptive string representation
|
25
|
-
# @param string prettyConstraint
|
26
|
-
def initialize(source, target, constraint = nil, description = 'relates to', pretty_constraint = nil)
|
27
|
-
@source = source.downcase
|
28
|
-
@target = target.downcase
|
29
|
-
@constraint = constraint
|
30
|
-
@description = description
|
31
|
-
@pretty_constraint = pretty_constraint
|
32
|
-
end
|
33
|
-
|
34
|
-
def pretty_constraint
|
35
|
-
unless @pretty_constraint
|
36
|
-
raise UnexpectedValueError, "Link #{self} has been misconfigured and had no pretty constraint given."
|
37
|
-
end
|
38
|
-
@pretty_constraint
|
39
|
-
end
|
40
|
-
|
41
|
-
def pretty_string(source_package)
|
42
|
-
"#{source_package.pretty_string} #{@description} #{@target} #{@constraint.pretty_string}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def to_s
|
46
|
-
"#{@source} #{@description} #{@target} (#{@constraint})"
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
1
|
+
#
|
2
|
+
# This file was ported to ruby from Composer php source code file.
|
3
|
+
# Original Source: Composer\Package\Link.php
|
4
|
+
#
|
5
|
+
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
+
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
+
#
|
8
|
+
# For the full copyright and license information, please view the LICENSE
|
9
|
+
# file that was distributed with this source code.
|
10
|
+
#
|
11
|
+
|
12
|
+
module Composer
|
13
|
+
module Package
|
14
|
+
|
15
|
+
# Represents a link between two packages, represented by their names
|
16
|
+
class Link
|
17
|
+
|
18
|
+
attr_reader :source, :target, :constraint
|
19
|
+
|
20
|
+
# Creates a new package link.
|
21
|
+
# @param string source
|
22
|
+
# @param string target
|
23
|
+
# @param LinkConstraintInterface constraint Constraint applying to the target of this link
|
24
|
+
# @param string description Used to create a descriptive string representation
|
25
|
+
# @param string prettyConstraint
|
26
|
+
def initialize(source, target, constraint = nil, description = 'relates to', pretty_constraint = nil)
|
27
|
+
@source = source.downcase
|
28
|
+
@target = target.downcase
|
29
|
+
@constraint = constraint
|
30
|
+
@description = description
|
31
|
+
@pretty_constraint = pretty_constraint
|
32
|
+
end
|
33
|
+
|
34
|
+
def pretty_constraint
|
35
|
+
unless @pretty_constraint
|
36
|
+
raise UnexpectedValueError, "Link #{self} has been misconfigured and had no pretty constraint given."
|
37
|
+
end
|
38
|
+
@pretty_constraint
|
39
|
+
end
|
40
|
+
|
41
|
+
def pretty_string(source_package)
|
42
|
+
"#{source_package.pretty_string} #{@description} #{@target} #{@constraint.pretty_string}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_s
|
46
|
+
"#{@source} #{@description} #{@target} (#{@constraint})"
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,36 +1,36 @@
|
|
1
|
-
#
|
2
|
-
# This file was ported to ruby from Composer php source code file.
|
3
|
-
# Original Source: Composer\Package\AliasPackage.php
|
4
|
-
#
|
5
|
-
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
-
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
-
#
|
8
|
-
# For the full copyright and license information, please view the LICENSE
|
9
|
-
# file that was distributed with this source code.
|
10
|
-
#
|
11
|
-
|
12
|
-
module Composer
|
13
|
-
module Package
|
14
|
-
module LinkConstraint
|
15
|
-
class BaseConstraint
|
16
|
-
|
17
|
-
def matches(provider)
|
18
|
-
raise NotImplementedError
|
19
|
-
end
|
20
|
-
|
21
|
-
def pretty_string=(pretty_string)
|
22
|
-
raise NotImplementedError
|
23
|
-
end
|
24
|
-
|
25
|
-
def pretty_string
|
26
|
-
raise NotImplementedError
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_s
|
30
|
-
raise NotImplementedError
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
#
|
2
|
+
# This file was ported to ruby from Composer php source code file.
|
3
|
+
# Original Source: Composer\Package\AliasPackage.php
|
4
|
+
#
|
5
|
+
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
+
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
+
#
|
8
|
+
# For the full copyright and license information, please view the LICENSE
|
9
|
+
# file that was distributed with this source code.
|
10
|
+
#
|
11
|
+
|
12
|
+
module Composer
|
13
|
+
module Package
|
14
|
+
module LinkConstraint
|
15
|
+
class BaseConstraint
|
16
|
+
|
17
|
+
def matches(provider)
|
18
|
+
raise NotImplementedError
|
19
|
+
end
|
20
|
+
|
21
|
+
def pretty_string=(pretty_string)
|
22
|
+
raise NotImplementedError
|
23
|
+
end
|
24
|
+
|
25
|
+
def pretty_string
|
26
|
+
raise NotImplementedError
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
raise NotImplementedError
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
36
|
end
|
@@ -1,35 +1,35 @@
|
|
1
|
-
#
|
2
|
-
# This file was ported to ruby from Composer php source code file.
|
3
|
-
# Original Source: Composer\Package\AliasPackage.php
|
4
|
-
#
|
5
|
-
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
-
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
-
#
|
8
|
-
# For the full copyright and license information, please view the LICENSE
|
9
|
-
# file that was distributed with this source code.
|
10
|
-
#
|
11
|
-
|
12
|
-
module Composer
|
13
|
-
module Package
|
14
|
-
module LinkConstraint
|
15
|
-
class EmptyConstraint < BaseConstraint
|
16
|
-
def matches(provider)
|
17
|
-
true
|
18
|
-
end
|
19
|
-
|
20
|
-
def pretty_string=(pretty_string)
|
21
|
-
@pretty_string = pretty_string
|
22
|
-
end
|
23
|
-
|
24
|
-
def pretty_string
|
25
|
-
return to_s unless @pretty_string
|
26
|
-
@pretty_string
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_s
|
30
|
-
'[]'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
1
|
+
#
|
2
|
+
# This file was ported to ruby from Composer php source code file.
|
3
|
+
# Original Source: Composer\Package\AliasPackage.php
|
4
|
+
#
|
5
|
+
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
+
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
+
#
|
8
|
+
# For the full copyright and license information, please view the LICENSE
|
9
|
+
# file that was distributed with this source code.
|
10
|
+
#
|
11
|
+
|
12
|
+
module Composer
|
13
|
+
module Package
|
14
|
+
module LinkConstraint
|
15
|
+
class EmptyConstraint < BaseConstraint
|
16
|
+
def matches(provider)
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def pretty_string=(pretty_string)
|
21
|
+
@pretty_string = pretty_string
|
22
|
+
end
|
23
|
+
|
24
|
+
def pretty_string
|
25
|
+
return to_s unless @pretty_string
|
26
|
+
@pretty_string
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
'[]'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
35
|
end
|
@@ -1,67 +1,67 @@
|
|
1
|
-
#
|
2
|
-
# This file was ported to ruby from Composer php source code file.
|
3
|
-
# Original Source: Composer\Package\AliasPackage.php
|
4
|
-
#
|
5
|
-
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
-
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
-
#
|
8
|
-
# For the full copyright and license information, please view the LICENSE
|
9
|
-
# file that was distributed with this source code.
|
10
|
-
#
|
11
|
-
|
12
|
-
module Composer
|
13
|
-
module Package
|
14
|
-
module LinkConstraint
|
15
|
-
class MultiConstraint < BaseConstraint
|
16
|
-
# Sets operator and version to compare a package with
|
17
|
-
# @param array $constraints A set of constraints
|
18
|
-
# @param bool $conjunctive Whether the constraints should be treated as conjunctive or disjunctive
|
19
|
-
def initialize(constraints, conjunctive = true)
|
20
|
-
@constraints = constraints
|
21
|
-
@conjunctive = conjunctive
|
22
|
-
end
|
23
|
-
|
24
|
-
def matches(provider)
|
25
|
-
if @conjunctive === false
|
26
|
-
@constraints.each do |constraint|
|
27
|
-
if constraint.matches(provider)
|
28
|
-
return true
|
29
|
-
end
|
30
|
-
end
|
31
|
-
return false
|
32
|
-
end
|
33
|
-
|
34
|
-
@constraints.each do |constraint|
|
35
|
-
if !constraint.matches(provider)
|
36
|
-
return false
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
true
|
41
|
-
end
|
42
|
-
|
43
|
-
def pretty_string=(pretty_string)
|
44
|
-
@pretty_string = pretty_string
|
45
|
-
end
|
46
|
-
|
47
|
-
def pretty_string
|
48
|
-
return to_s unless @pretty_string
|
49
|
-
@pretty_string
|
50
|
-
end
|
51
|
-
|
52
|
-
def to_s
|
53
|
-
constraints = []
|
54
|
-
@constraints.each do |constraint|
|
55
|
-
if constraint.is_a?(Array)
|
56
|
-
constraints << String(constraint[0])
|
57
|
-
else
|
58
|
-
constraints << String(constraint)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
separator = @conjunctive ? ' ' : ' || '
|
62
|
-
"[#{constraints.join(separator)}]"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
1
|
+
#
|
2
|
+
# This file was ported to ruby from Composer php source code file.
|
3
|
+
# Original Source: Composer\Package\AliasPackage.php
|
4
|
+
#
|
5
|
+
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
+
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
+
#
|
8
|
+
# For the full copyright and license information, please view the LICENSE
|
9
|
+
# file that was distributed with this source code.
|
10
|
+
#
|
11
|
+
|
12
|
+
module Composer
|
13
|
+
module Package
|
14
|
+
module LinkConstraint
|
15
|
+
class MultiConstraint < BaseConstraint
|
16
|
+
# Sets operator and version to compare a package with
|
17
|
+
# @param array $constraints A set of constraints
|
18
|
+
# @param bool $conjunctive Whether the constraints should be treated as conjunctive or disjunctive
|
19
|
+
def initialize(constraints, conjunctive = true)
|
20
|
+
@constraints = constraints
|
21
|
+
@conjunctive = conjunctive
|
22
|
+
end
|
23
|
+
|
24
|
+
def matches(provider)
|
25
|
+
if @conjunctive === false
|
26
|
+
@constraints.each do |constraint|
|
27
|
+
if constraint.matches(provider)
|
28
|
+
return true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
|
34
|
+
@constraints.each do |constraint|
|
35
|
+
if !constraint.matches(provider)
|
36
|
+
return false
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
def pretty_string=(pretty_string)
|
44
|
+
@pretty_string = pretty_string
|
45
|
+
end
|
46
|
+
|
47
|
+
def pretty_string
|
48
|
+
return to_s unless @pretty_string
|
49
|
+
@pretty_string
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_s
|
53
|
+
constraints = []
|
54
|
+
@constraints.each do |constraint|
|
55
|
+
if constraint.is_a?(Array)
|
56
|
+
constraints << String(constraint[0])
|
57
|
+
else
|
58
|
+
constraints << String(constraint)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
separator = @conjunctive ? ' ' : ' || '
|
62
|
+
"[#{constraints.join(separator)}]"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
67
|
end
|
@@ -1,41 +1,41 @@
|
|
1
|
-
#
|
2
|
-
# This file was ported to ruby from Composer php source code file.
|
3
|
-
# Original Source: Composer\Package\AliasPackage.php
|
4
|
-
#
|
5
|
-
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
-
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
-
#
|
8
|
-
# For the full copyright and license information, please view the LICENSE
|
9
|
-
# file that was distributed with this source code.
|
10
|
-
#
|
11
|
-
|
12
|
-
module Composer
|
13
|
-
module Package
|
14
|
-
module LinkConstraint
|
15
|
-
class SpecificConstraint < BaseConstraint
|
16
|
-
|
17
|
-
def matches(provider)
|
18
|
-
|
19
|
-
if provider.is_a?(MultiConstraint)
|
20
|
-
# turn matching around to find a match
|
21
|
-
return provider.matches(self)
|
22
|
-
elsif provider.is_a?(SpecificConstraint)
|
23
|
-
return match_specific(provider)
|
24
|
-
end
|
25
|
-
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
def pretty_string=(pretty_string)
|
30
|
-
@prettyString = pretty_string
|
31
|
-
end
|
32
|
-
|
33
|
-
def pretty_string
|
34
|
-
return to_s unless @pretty_string
|
35
|
-
@pretty_string
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
1
|
+
#
|
2
|
+
# This file was ported to ruby from Composer php source code file.
|
3
|
+
# Original Source: Composer\Package\AliasPackage.php
|
4
|
+
#
|
5
|
+
# (c) Nils Adermann <naderman@naderman.de>
|
6
|
+
# Jordi Boggiano <j.boggiano@seld.be>
|
7
|
+
#
|
8
|
+
# For the full copyright and license information, please view the LICENSE
|
9
|
+
# file that was distributed with this source code.
|
10
|
+
#
|
11
|
+
|
12
|
+
module Composer
|
13
|
+
module Package
|
14
|
+
module LinkConstraint
|
15
|
+
class SpecificConstraint < BaseConstraint
|
16
|
+
|
17
|
+
def matches(provider)
|
18
|
+
|
19
|
+
if provider.is_a?(MultiConstraint)
|
20
|
+
# turn matching around to find a match
|
21
|
+
return provider.matches(self)
|
22
|
+
elsif provider.is_a?(SpecificConstraint)
|
23
|
+
return match_specific(provider)
|
24
|
+
end
|
25
|
+
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def pretty_string=(pretty_string)
|
30
|
+
@prettyString = pretty_string
|
31
|
+
end
|
32
|
+
|
33
|
+
def pretty_string
|
34
|
+
return to_s unless @pretty_string
|
35
|
+
@pretty_string
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
41
|
end
|