php-composer 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +10 -10
  3. data/Gemfile +15 -15
  4. data/LICENSE.txt +21 -21
  5. data/README.md +35 -35
  6. data/Rakefile +1 -1
  7. data/lib/composer.rb +52 -52
  8. data/lib/composer/error.rb +8 -8
  9. data/lib/composer/json/json_file.rb +270 -270
  10. data/lib/composer/package/alias_package.rb +273 -273
  11. data/lib/composer/package/base_package.rb +130 -130
  12. data/lib/composer/package/complete_package.rb +55 -55
  13. data/lib/composer/package/dumper/hash_dumper.rb +169 -169
  14. data/lib/composer/package/link.rb +51 -51
  15. data/lib/composer/package/link_constraint/base_constraint.rb +35 -35
  16. data/lib/composer/package/link_constraint/empty_constraint.rb +34 -34
  17. data/lib/composer/package/link_constraint/multi_constraint.rb +66 -66
  18. data/lib/composer/package/link_constraint/specific_constraint.rb +40 -40
  19. data/lib/composer/package/link_constraint/version_constraint.rb +220 -220
  20. data/lib/composer/package/loader/hash_loader.rb +316 -316
  21. data/lib/composer/package/loader/json_loader.rb +47 -47
  22. data/lib/composer/package/loader/project_attributes_loader.rb +71 -71
  23. data/lib/composer/package/loader/project_root_package_loader.rb +28 -28
  24. data/lib/composer/package/package.rb +118 -118
  25. data/lib/composer/package/root_alias_package.rb +37 -37
  26. data/lib/composer/package/root_package.rb +37 -37
  27. data/lib/composer/package/version/version_parser.rb +583 -583
  28. data/lib/composer/package/version/version_selector.rb +106 -106
  29. data/lib/composer/repository/filesystem_repository.rb +84 -85
  30. data/lib/composer/repository/{array_repository.rb → hash_repository.rb} +195 -195
  31. data/lib/composer/repository/{writeable_array_repository.rb → writeable_hash_repository.rb} +57 -59
  32. data/lib/composer/version.rb +3 -3
  33. data/php-composer.gemspec +31 -31
  34. metadata +4 -4
@@ -1,273 +1,273 @@
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
-
15
- # The root package represents the project's composer.json
16
- # and contains additional metadata
17
- # @php_author Jordi Boggiano <j.boggiano@seld.be>
18
- # @author Ioannis Kappas <ikappas@devworks.gr>
19
- class AliasPackage < Composer::Package::BasePackage
20
-
21
- attr_reader :alias_of, :requires, :conflicts, :provides, :replaces
22
- :dev_requires
23
-
24
- attr_accessor :repositories, :license, :keywords, :authors,
25
- :description, :homepage, :scripts, :support,
26
- :source_url, :source_reference, :source_mirrors
27
-
28
- # All descendants' constructors should call this parent constructor
29
- # @param alias_of Package The package this package is an alias of
30
- # @param version String The version the alias must report
31
- # @param pretty_version String The alias's non-normalized version
32
- def initialize(alias_of, version, pretty_version)
33
- super(alias_of.name)
34
-
35
- @version = version
36
- @pretty_version = pretty_version
37
- @alias_of = alias_of
38
- @stability = Composer::Package::Version::VersionParser::parse_stability(version)
39
- @dev = @stability === 'dev'
40
-
41
- # replace self.version dependencies
42
- %w{requires dev_requires}.each do |type|
43
-
44
- links = alias_of.send(type)
45
- links.each do |index, link|
46
- # link is self.version, but must be replacing also the replaced version
47
- if 'self.version' === link.pretty_constraint
48
- links[index] = Composer::Package::Link.new(
49
- link.source,
50
- link.target,
51
- Composer::Package::LinkConstraint::VersionConstraint.new(
52
- '=',
53
- @version
54
- ),
55
- type,
56
- pretty_version
57
- )
58
- end
59
- end
60
- @type = links
61
- end
62
-
63
- # duplicate self.version provides
64
- %w{conflicts provides replaces}.each do |type|
65
- links = alias_of.send(type)
66
- new_links = []
67
- links.each do |link|
68
- # link is self.version, but must be replacing also the replaced version
69
- if 'self.version' === link.pretty_constraint
70
- new_links = Composer.Package.Link.new(
71
- link.source,
72
- link.target,
73
- Composer::Package::LinkConstraint.VersionConstraint.new(
74
- '=',
75
- @version
76
- ),
77
- type,
78
- pretty_version
79
- )
80
- end
81
- end
82
- @type = links.zip(new_links).flatten.compact
83
- # @type = (links << new_links)
84
- end
85
-
86
- end
87
-
88
- # Determine if development package
89
- # Return: true if development package; Otherwise false.
90
- def is_dev
91
- @dev
92
- end
93
-
94
- # Stores whether this is an alias created by an aliasing in the requirements of the root package or not
95
- # Use by the policy for sorting manually aliased packages first, see #576
96
- # @param bool $value
97
- # @return mixed
98
- def root_package_alias=(value)
99
- @root_package_alias = value
100
- end
101
-
102
- # @see setRootPackageAlias
103
- # @return bool
104
- def is_root_package_alias
105
- @root_package_alias
106
- end
107
-
108
- #######################################
109
- # Wrappers around the aliased package #
110
- #######################################
111
-
112
- def type
113
- @alias_of.Type
114
- end
115
-
116
- def target_dir
117
- @alias_of.target_dir
118
- end
119
-
120
- def extra
121
- @alias_of.extra
122
- end
123
-
124
- def installation_source=(type)
125
- @alias_of.installation_source = type
126
- end
127
-
128
- def installation_source
129
- @alias_of.installation_source
130
- end
131
-
132
- def source_type
133
- @alias_of.source_type
134
- end
135
-
136
- def source_url
137
- @alias_of.source_url
138
- end
139
-
140
- def source_urls
141
- @alias_of.source_urls
142
- end
143
-
144
- def source_reference=(reference)
145
- @alias_of.source_reference = reference
146
- end
147
-
148
- def source_reference
149
- @alias_of.source_reference
150
- end
151
-
152
- def source_mirrors=(mirrors)
153
- @alias_of.source_mirrors = mirrors
154
- end
155
-
156
- def source_mirrors
157
- @alias_of.SourceMirrors
158
- end
159
-
160
- def dist_type
161
- @alias_of.dist_type
162
- end
163
-
164
- def dist_url
165
- @alias_of.dist_url
166
- end
167
-
168
- def dist_urls
169
- @alias_of.dist_urls
170
- end
171
-
172
- def dist_reference
173
- @alias_of.dist_reference
174
- end
175
-
176
- def dist_reference=(reference)
177
- @alias_of.dist_reference = reference
178
- end
179
-
180
- def dist_sha1_checksum
181
- @alias_of.dist_sha1_checksum
182
- end
183
-
184
- def transport_options=(options)
185
- @alias_of.transport_options = options
186
- end
187
-
188
- def transport_options
189
- @alias_of.transport_options
190
- end
191
-
192
- def dist_mirrors=(mirrors)
193
- @alias_of.dist_mirrors = mirrors
194
- end
195
-
196
- def dist_mirrors
197
- @alias_of.dist_mirrors
198
- end
199
-
200
- def scripts
201
- @alias_of.scripts
202
- end
203
-
204
- def license
205
- @alias_of.license
206
- end
207
-
208
- def autoload
209
- @alias_of.autoload
210
- end
211
-
212
- def dev_autoload
213
- @alias_of.dev_autoload
214
- end
215
-
216
- def include_paths
217
- @alias_of.include_paths
218
- end
219
-
220
- def repositories
221
- @alias_of.repositories
222
- end
223
-
224
- def release_date
225
- @alias_of.release_date
226
- end
227
-
228
- def binaries
229
- @alias_of.binaries
230
- end
231
-
232
- def keywords
233
- @alias_of.keywords
234
- end
235
-
236
- def description
237
- @alias_of.description
238
- end
239
-
240
- def homepage
241
- @alias_of.homepage
242
- end
243
-
244
- def suggests
245
- @alias_of.suggests
246
- end
247
-
248
- def authors
249
- @alias_of.authors
250
- end
251
-
252
- def support
253
- @alias_of.support
254
- end
255
-
256
- def notification_url
257
- @alias_of.notification_url
258
- end
259
-
260
- def archive_excludes
261
- @alias_of.archive_excludes
262
- end
263
-
264
- def is_abandoned
265
- @alias_of.is_abandoned
266
- end
267
-
268
- def replacement_package
269
- @alias_of.replacement_package
270
- end
271
- end
272
- end
273
- 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
+
15
+ # The root package represents the project's composer.json
16
+ # and contains additional metadata
17
+ # @php_author Jordi Boggiano <j.boggiano@seld.be>
18
+ # @author Ioannis Kappas <ikappas@devworks.gr>
19
+ class AliasPackage < Composer::Package::BasePackage
20
+
21
+ attr_reader :alias_of, :requires, :conflicts, :provides, :replaces
22
+ :dev_requires
23
+
24
+ attr_accessor :repositories, :license, :keywords, :authors,
25
+ :description, :homepage, :scripts, :support,
26
+ :source_url, :source_reference, :source_mirrors
27
+
28
+ # All descendants' constructors should call this parent constructor
29
+ # @param alias_of Package The package this package is an alias of
30
+ # @param version String The version the alias must report
31
+ # @param pretty_version String The alias's non-normalized version
32
+ def initialize(alias_of, version, pretty_version)
33
+ super(alias_of.name)
34
+
35
+ @version = version
36
+ @pretty_version = pretty_version
37
+ @alias_of = alias_of
38
+ @stability = Composer::Package::Version::VersionParser::parse_stability(version)
39
+ @dev = @stability === 'dev'
40
+
41
+ # replace self.version dependencies
42
+ %w{requires dev_requires}.each do |type|
43
+
44
+ links = alias_of.send(type)
45
+ links.each do |index, link|
46
+ # link is self.version, but must be replacing also the replaced version
47
+ if 'self.version' === link.pretty_constraint
48
+ links[index] = Composer::Package::Link.new(
49
+ link.source,
50
+ link.target,
51
+ Composer::Package::LinkConstraint::VersionConstraint.new(
52
+ '=',
53
+ @version
54
+ ),
55
+ type,
56
+ pretty_version
57
+ )
58
+ end
59
+ end
60
+ @type = links
61
+ end
62
+
63
+ # duplicate self.version provides
64
+ %w{conflicts provides replaces}.each do |type|
65
+ links = alias_of.send(type)
66
+ new_links = []
67
+ links.each do |link|
68
+ # link is self.version, but must be replacing also the replaced version
69
+ if 'self.version' === link.pretty_constraint
70
+ new_links = Composer.Package.Link.new(
71
+ link.source,
72
+ link.target,
73
+ Composer::Package::LinkConstraint.VersionConstraint.new(
74
+ '=',
75
+ @version
76
+ ),
77
+ type,
78
+ pretty_version
79
+ )
80
+ end
81
+ end
82
+ @type = links.zip(new_links).flatten.compact
83
+ # @type = (links << new_links)
84
+ end
85
+
86
+ end
87
+
88
+ # Determine if development package
89
+ # Return: true if development package; Otherwise false.
90
+ def is_dev
91
+ @dev
92
+ end
93
+
94
+ # Stores whether this is an alias created by an aliasing in the requirements of the root package or not
95
+ # Use by the policy for sorting manually aliased packages first, see #576
96
+ # @param bool $value
97
+ # @return mixed
98
+ def root_package_alias=(value)
99
+ @root_package_alias = value
100
+ end
101
+
102
+ # @see setRootPackageAlias
103
+ # @return bool
104
+ def is_root_package_alias
105
+ @root_package_alias
106
+ end
107
+
108
+ #######################################
109
+ # Wrappers around the aliased package #
110
+ #######################################
111
+
112
+ def type
113
+ @alias_of.Type
114
+ end
115
+
116
+ def target_dir
117
+ @alias_of.target_dir
118
+ end
119
+
120
+ def extra
121
+ @alias_of.extra
122
+ end
123
+
124
+ def installation_source=(type)
125
+ @alias_of.installation_source = type
126
+ end
127
+
128
+ def installation_source
129
+ @alias_of.installation_source
130
+ end
131
+
132
+ def source_type
133
+ @alias_of.source_type
134
+ end
135
+
136
+ def source_url
137
+ @alias_of.source_url
138
+ end
139
+
140
+ def source_urls
141
+ @alias_of.source_urls
142
+ end
143
+
144
+ def source_reference=(reference)
145
+ @alias_of.source_reference = reference
146
+ end
147
+
148
+ def source_reference
149
+ @alias_of.source_reference
150
+ end
151
+
152
+ def source_mirrors=(mirrors)
153
+ @alias_of.source_mirrors = mirrors
154
+ end
155
+
156
+ def source_mirrors
157
+ @alias_of.SourceMirrors
158
+ end
159
+
160
+ def dist_type
161
+ @alias_of.dist_type
162
+ end
163
+
164
+ def dist_url
165
+ @alias_of.dist_url
166
+ end
167
+
168
+ def dist_urls
169
+ @alias_of.dist_urls
170
+ end
171
+
172
+ def dist_reference
173
+ @alias_of.dist_reference
174
+ end
175
+
176
+ def dist_reference=(reference)
177
+ @alias_of.dist_reference = reference
178
+ end
179
+
180
+ def dist_sha1_checksum
181
+ @alias_of.dist_sha1_checksum
182
+ end
183
+
184
+ def transport_options=(options)
185
+ @alias_of.transport_options = options
186
+ end
187
+
188
+ def transport_options
189
+ @alias_of.transport_options
190
+ end
191
+
192
+ def dist_mirrors=(mirrors)
193
+ @alias_of.dist_mirrors = mirrors
194
+ end
195
+
196
+ def dist_mirrors
197
+ @alias_of.dist_mirrors
198
+ end
199
+
200
+ def scripts
201
+ @alias_of.scripts
202
+ end
203
+
204
+ def license
205
+ @alias_of.license
206
+ end
207
+
208
+ def autoload
209
+ @alias_of.autoload
210
+ end
211
+
212
+ def dev_autoload
213
+ @alias_of.dev_autoload
214
+ end
215
+
216
+ def include_paths
217
+ @alias_of.include_paths
218
+ end
219
+
220
+ def repositories
221
+ @alias_of.repositories
222
+ end
223
+
224
+ def release_date
225
+ @alias_of.release_date
226
+ end
227
+
228
+ def binaries
229
+ @alias_of.binaries
230
+ end
231
+
232
+ def keywords
233
+ @alias_of.keywords
234
+ end
235
+
236
+ def description
237
+ @alias_of.description
238
+ end
239
+
240
+ def homepage
241
+ @alias_of.homepage
242
+ end
243
+
244
+ def suggests
245
+ @alias_of.suggests
246
+ end
247
+
248
+ def authors
249
+ @alias_of.authors
250
+ end
251
+
252
+ def support
253
+ @alias_of.support
254
+ end
255
+
256
+ def notification_url
257
+ @alias_of.notification_url
258
+ end
259
+
260
+ def archive_excludes
261
+ @alias_of.archive_excludes
262
+ end
263
+
264
+ def is_abandoned?
265
+ @alias_of.is_abandoned?
266
+ end
267
+
268
+ def replacement_package
269
+ @alias_of.replacement_package
270
+ end
271
+ end
272
+ end
273
+ end