Skip to content

Commit b7b239b

Browse files
committed
Ensure that PHP Composer packages are recognzied #776
* add PHPComposer to PACKAGE_TYPES * Fix PHPComposer settings (use real tuples in class-level attributes) * misc cosmetics changes (unused imports, blank lines) * add new reconize tests for composer and npm * add CLI-level test for composer.json Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 6b93456 commit b7b239b

File tree

9 files changed

+452
-17
lines changed

9 files changed

+452
-17
lines changed

src/packagedcode/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
from packagedcode import maven
2727
from packagedcode import npm
2828
from packagedcode import nuget
29+
from packagedcode import phpcomposer
2930
from packagedcode import rpm
3031

3132

3233
# Note: the order matters: from the most to the least specific
34+
# Package classes MUST be added to this list to be active
3335
PACKAGE_TYPES = [
3436
rpm.RpmPackage,
3537
models.DebianPackage,
@@ -43,8 +45,9 @@
4345
models.Axis2Mar,
4446

4547
npm.NpmPackage,
46-
models.BowerPackage,
48+
phpcomposer.PHPComposerPackage,
4749
models.MeteorPackage,
50+
models.BowerPackage,
4851
models.CpanModule,
4952
models.RubyGem,
5053
models.AndroidApp,

src/packagedcode/phpcomposer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050

5151

5252
class PHPComposerPackage(models.Package):
53-
metafiles = ('composer.json')
53+
metafiles = ('composer.json',)
5454
filetypes = ('.json',)
55-
mimetypes = ('application/json')
55+
mimetypes = ('application/json',)
5656
repo_types = (models.repo_phpcomposer,)
5757

5858
type = models.StringType(default='phpcomposer')
@@ -106,7 +106,8 @@ def parse(location):
106106
# a composer.json is at the root of a PHP composer package
107107
base_dir = fileutils.parent_directory(location)
108108
package.location = base_dir
109-
package.metafile_locations = [location]
109+
metafile = fileutils.file_name(location)
110+
package.metafile_locations = [metafile]
110111

111112
for source, target in plain_fields.items():
112113
value = data.get(source)

src/packagedcode/recognize.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
from packagedcode import PACKAGE_TYPES
3434
from commoncode.system import on_linux
35-
from commoncode.fileutils import path_to_unicode
3635
from commoncode.fileutils import path_to_bytes
3736

3837

@@ -74,7 +73,6 @@ def recognize_package(location):
7473
else:
7574
mime_matched = False
7675

77-
7876
extensions = package.extensions
7977
if extensions:
8078
if on_linux:
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
{
2+
"name" : "narrowspark/framework",
3+
"type" : "framework",
4+
"description": "Narrowspark Framework for Creative People.",
5+
"keywords" : [
6+
"framework",
7+
"narrowspark",
8+
"http",
9+
"request",
10+
"response",
11+
"viserio",
12+
"container",
13+
"pipeline",
14+
"event",
15+
"translation"
16+
],
17+
"license" : "MIT",
18+
"homepage" : "https://github.com/narrowspark/framework",
19+
"support" : {
20+
"issues": "https://github.com/narrowspark/framework/issues",
21+
"source": "https://github.com/narrowspark/framework"
22+
},
23+
"authors" : [
24+
{
25+
"name" : "Daniel Bannert",
26+
"email" : "[email protected]",
27+
"homepage": "http://www.anolilab.de",
28+
"role" : "Developer"
29+
}
30+
],
31+
"require": {
32+
"php" : "7.0.0 - 7.0.5 || ^7.0.7",
33+
"ext-openssl" : "*",
34+
"cache/chain-adapter" : "^0.4",
35+
"cache/namespaced-cache" : "^0.1",
36+
"cakephp/chronos" : "^1.0",
37+
"classpreloader/classpreloader" : "^3.0",
38+
"container-interop/container-interop" : "^1.1",
39+
"container-interop/service-provider" : "^0.3",
40+
"danielstjules/stringy" : "^2.3",
41+
"defuse/php-encryption" : "^2.0",
42+
"doctrine/dbal" : "^2.5",
43+
"doctrine/migrations" : "^1.4",
44+
"egulias/email-validator" : "^2.1",
45+
"filp/whoops" : "^2.0",
46+
"http-interop/http-factory" : "^0.2",
47+
"http-interop/http-middleware" : "^0.3",
48+
"league/flysystem" : "^1.0.27",
49+
"monolog/monolog" : "^1.17",
50+
"narrowspark/arr" : "^2.1",
51+
"narrowspark/collection" : "^0.1",
52+
"narrowspark/http-status" : "^2.0",
53+
"mtdowling/cron-expression" : "^1.1",
54+
"opis/closure" : "^2.2.1",
55+
"ocramius/proxy-manager" : "^2",
56+
"php-di/invoker" : "^1.3",
57+
"paragonie/password_lock" : "^3.0",
58+
"psr/http-message" : "^1.0",
59+
"psy/psysh" : "^0.6",
60+
"ramsey/uuid" : "^3.4",
61+
"respect/validation" : "^1.1",
62+
"schnittstabil/csrf-tokenservice" : "^2.0",
63+
"stecman/symfony-console-completion" : "^0.6",
64+
"symfony/console" : "^3.1",
65+
"symfony/debug" : "^3.1",
66+
"symfony/finder" : "^3.1",
67+
"symfony/filesystem" : "^3.1",
68+
"symfony/polyfill-intl-icu" : "^1.0",
69+
"symfony/polyfill-mbstring" : "^1.0",
70+
"symfony/var-dumper" : "^3.1",
71+
"swiftmailer/swiftmailer" : "^5.4",
72+
"vlucas/phpdotenv" : "^2.3"
73+
},
74+
"replace": {
75+
"viserio/cache" : "self.version",
76+
"viserio/conifg" : "self.version",
77+
"viserio/console" : "self.version",
78+
"viserio/container" : "self.version",
79+
"viserio/contracts" : "self.version",
80+
"viserio/cookie" : "self.version",
81+
"viserio/database" : "self.version",
82+
"viserio/encrypter" : "self.version",
83+
"viserio/events" : "self.version",
84+
"viserio/exception" : "self.version",
85+
"viserio/filessystem" : "self.version",
86+
"viserio/hashing" : "self.version",
87+
"viserio/http" : "self.version",
88+
"viserio/http-factory" : "self.version",
89+
"viserio/log" : "self.version",
90+
"viserio/mail" : "self.version",
91+
"viserio/parsers" : "self.version",
92+
"viserio/pipeline" : "self.version",
93+
"viserio/routing" : "self.version",
94+
"viserio/session" : "self.version",
95+
"viserio/statical-proxy" : "self.version",
96+
"viserio/support" : "self.version",
97+
"viserio/translator" : "self.version",
98+
"viserio/validation" : "self.version",
99+
"viserio/view" : "self.version"
100+
},
101+
"provide": {
102+
"container-interop/container-interop-implementation" : "^1.1",
103+
"psr/cache-implementation" : "^1.0",
104+
"psr/container-implementation" : "^1.0",
105+
"psr/http-message" : "^1.0",
106+
"psr/http-message-implementation" : "^1.0",
107+
"psr/log-implementation" : "^1.0"
108+
},
109+
"require-dev": {
110+
"aws/aws-sdk-php" : "^3.18",
111+
"cache/array-adapter" : "^0.4",
112+
"cache/filesystem-adapter" : "^0.3",
113+
"cache/session-handler" : "^0.2",
114+
"cache/void-adapter" : "^0.3",
115+
"guzzlehttp/guzzle" : "^6.0",
116+
"league/flysystem-aws-s3-v3" : "^1.0",
117+
"league/flysystem-cached-adapter" : "^1.0.3",
118+
"league/flysystem-dropbox" : "^1.0",
119+
"league/flysystem-gridfs" : "^1.0",
120+
"league/flysystem-rackspace" : "^1.0",
121+
"league/flysystem-sftp" : "^1.0",
122+
"league/flysystem-webdav" : "^1.0",
123+
"league/flysystem-vfs" : "^1.0",
124+
"league/flysystem-ziparchive" : "^1.0",
125+
"league/plates" : "^3.1",
126+
"mikey179/vfsStream" : "^1.6",
127+
"mouf/picotainer" : "^1.0",
128+
"narrowspark/php-cs-fixer-config" : "^2.1",
129+
"narrowspark/testing-helper" : "^2.0",
130+
"mockery/mockery" : "^0.9.5",
131+
"phpunit/phpunit" : "^5.1",
132+
"phpbench/phpbench" : "^0.12",
133+
"predis/predis" : "^1.0",
134+
"php-amqplib/php-amqplib" : "^2.6",
135+
"pda/pheanstalk" : "^3.1",
136+
"spatie/array-to-xml" : "^2.1",
137+
"twig/twig" : "^1.24",
138+
"sepia/po-parser" : "^4.2",
139+
"symfony/yaml" : "^3.1",
140+
"yosymfony/toml" : "^0.3"
141+
},
142+
"autoload": {
143+
"files": [
144+
"src/Viserio/helpers.php"
145+
],
146+
"psr-4": {
147+
"Viserio\\" : "src/Viserio/",
148+
"Narrowspark\\" : "benchmarks/"
149+
},
150+
"exclude-from-classmap" : ["src/Viserio/**/Tests/", "benchmarks/"]
151+
},
152+
"extra": {
153+
"branch-alias": {
154+
"dev-master" : "1.0-dev"
155+
}
156+
},
157+
"suggest": {
158+
"alcaeus/mongo-php-adapter" : "Required to use the ext-mongo interface on ext-mongodb interface (^1.0).",
159+
"aws/aws-sdk-php" : "Required to use the SQS queue driver and SES mail driver (^3.18).",
160+
"cache/apc-adapter" : "Required to use the Apc cache (^0.3).",
161+
"cache/apcu-adapter" : "Required to use the Apcu cache (^0.3).",
162+
"cache/array-adapter" : "Required to use the Array cache (^0.2)",
163+
"cache/filesystem-adapter" : "Required to use the Filesystem cache (^0.3).",
164+
"cache/memcache-adapter" : "Required to use the Memcache cache (^0.3).",
165+
"cache/memcached-adapter" : "Required to use the Memcached cache (^0.3).",
166+
"cache/mongodb-adapter" : "Required to use the Mongodb cache (^0.2).",
167+
"cache/predis-adapter" : "Required to use the Predis cache (^0.4).",
168+
"cache/session-handler" : "Required to use the Session cache (^0.1).",
169+
"cache/void-adapter" : "Required to use the Void cache (^0.3).",
170+
"ext-pdo" : "Required to use PDO adapters",
171+
"ext-pdo_dblib" : "Required to use MSSQL databases on Liunx/UNIX platform",
172+
"ext-pdo-firebird" : "Required to use Firebird databases",
173+
"ext-pdo-mysql" : "Required to use MySQL or MariaDB databases",
174+
"ext-pdo-pqsql" : "Required to use PostgreSQL databases",
175+
"ext-pdo-sqlite" : "Required to use SQLite databases",
176+
"ext-pdo_sqlsrv" : "Required to use MSSQL databases on Windows platform",
177+
"guzzlehttp/guzzle" : "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (^6.0).",
178+
"league/flysystem-aws-s3-v3" : "Required to use the Flysystem S3 adapter (^1.0).",
179+
"league/flysystem-cached-adapter" : "Required to use the Flysystem Caching adapter (^1.0.3).",
180+
"league/flysystem-dropbox" : "Required to use the Flysystem Dropbox adapter (^1.0).",
181+
"league/flysystem-gridfs" : "Required to use the Flysystem GridFS adapter (^1.0).",
182+
"league/flysystem-rackspace" : "Required to use the Flysystem Rackspace adapter (^1.0).",
183+
"league/flysystem-replicate-adapter" : "Required to use the Flysystem Replicate adapter (^1.0).",
184+
"league/flysystem-sftp" : "Required to use the Flysystem SFTP adapter (^1.0).",
185+
"league/flysystem-webdav" : "Required to use the Flysystem WebDav adapter (^1.0).",
186+
"league/flysystem-vfs" : "Required to use the Flysystem VFS adapter (^1.0).",
187+
"league/flysystem-ziparchive" : "Required to use the Flysystem ZipArchive adapter (^1.0).",
188+
"league/plates" : "Required to use the League Plates view adapter (^3.1).",
189+
"pda/pheanstalk" : "Required to use the Beanstalk queue driver (^3.0).",
190+
"predis/predis" : "Required to use the Redis cache and Queue drivers (^1.0).",
191+
"twig/twig" : "Required to use the Twig view adapter (^1.24).",
192+
"spatie/array-to-xml" : "Required to use the XML dump (^2.1.1).",
193+
"yosymfony/toml" : "Required to use the TOML parser (^0.3).",
194+
"symfony/yaml" : "Required to use the Yaml parser (^3.1)."
195+
},
196+
"minimum-stability" : "dev",
197+
"prefer-stable" : true
198+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "cookie-signature",
3+
"version": "1.0.3",
4+
"description": "Sign and unsign cookies",
5+
"keywords": [
6+
"cookie",
7+
"sign",
8+
"unsign"
9+
],
10+
"author": {
11+
"name": "TJ Holowaychuk",
12+
"email": "[email protected]"
13+
},
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/visionmedia/node-cookie-signature.git"
17+
},
18+
"dependencies": {},
19+
"devDependencies": {
20+
"mocha": "*",
21+
"should": "*"
22+
},
23+
"main": "index",
24+
"readme": "\n# cookie-signature\n\n Sign and unsign cookies.\n\n## Example\n\n```js\nvar cookie = require('cookie-signature');\n\nvar val = cookie.sign('hello', 'tobiiscool');\nval.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');\n\nvar val = cookie.sign('hello', 'tobiiscool');\ncookie.unsign(val, 'tobiiscool').should.equal('hello');\ncookie.unsign(val, 'luna').should.be.false;\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 LearnBoost &lt;[email protected]&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
25+
"readmeFilename": "Readme.md",
26+
"bugs": {
27+
"url": "https://github.com/visionmedia/node-cookie-signature/issues"
28+
},
29+
30+
"_from": "[email protected]"
31+
}

0 commit comments

Comments
 (0)