diff --git a/.travis.yml b/.travis.yml
index e55eba6..7c3a860 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,10 @@
language: php
-php:
- - '5.3'
- - '5.6'
- - '7.0'
- - '7.1'
- - hhvm
+matrix:
+ include:
+ - php: 5.3
+ dist: precise
+ - php: 5.6
+ - php: 7.0
+ - php: 7.1
-script: python tests/tests.py
\ No newline at end of file
+script: python tests/tests.py
diff --git a/README.md b/README.md
index fc83297..c49be2a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# scriptsdev for [Composer](https://github.com/composer/composer) 
+# scriptsdev for [Composer](https://github.com/composer/composer) [](https://travis-ci.org/neronmoon/scriptsdev)
It's like require-dev, but for scripts
-## Installation
+## Installation
Just run `composer require neronmoon/scriptsdev --dev`
## Usage
@@ -12,7 +12,8 @@ After installing you able to add extra.scripts-dev directive in your `composer.j
"post-install-cmd": [
"npm install --dev"
],
- "post-update-cmd": "php ./someCoolCommand.php"
+ "post-update-cmd": "php ./someCoolCommand.php",
+ "test": "phpunit"
},
}
...
@@ -28,4 +29,14 @@ After installing you able to add extra.scripts-dev directive in your `composer.j
"post-update-cmd": "php ./someCoolCommand.php"
}
...
-```
\ No newline at end of file
+```
+
+## Known issues
+
+- Usage of this plugin will cause minor warning of validation process.
+`composer validate` command will display something like this.
+```
+./composer.json is valid, but with a few warnings
+See https://getcomposer.org/doc/04-schema.md for details on the schema
+Description for non-existent script "test" found in "scripts-descriptions"
+```
diff --git a/composer.json b/composer.json
index fc7f75d..701a36b 100644
--- a/composer.json
+++ b/composer.json
@@ -1,28 +1,37 @@
{
- "name": "neronmoon/scriptsdev",
- "description": "Scripts-dev behaviour for Composer",
- "keywords": ["dev", "scripts", "composer", "commands", "commands execution"],
- "homepage": "https://github.com/neronmoon/scriptsdev",
- "type": "composer-plugin",
- "license": "MIT",
- "authors": [
- {
- "name": "Vitaliy Krasnoperov",
- "email": "alistar.neron@gmail.com"
+ "name": "neronmoon/scriptsdev",
+ "description": "Scripts-dev behaviour for Composer",
+ "keywords": [
+ "dev",
+ "scripts",
+ "composer",
+ "commands",
+ "commands execution"
+ ],
+ "homepage": "https://github.com/neronmoon/scriptsdev",
+ "type": "composer-plugin",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Vitaliy Krasnoperov",
+ "email": "alistar.neron@gmail.com"
+ }
+ ],
+ "autoload": {
+ "psr-4": {
+ "ScriptsDev\\": "src/"
+ }
+ },
+ "require": {
+ "composer-plugin-api": "^1.0 || ^2.0"
+ },
+ "require-dev": {
+ "composer/composer": "~1.0@dev || ~2.0@dev"
+ },
+ "extra": {
+ "class": "ScriptsDev\\Plugin"
+ },
+ "scripts": {
+ "test": "python tests/tests.py"
}
- ],
- "autoload": {
- "psr-4": {
- "ScriptsDev\\": "src/"
- }
- },
- "require": {
- "composer-plugin-api": "^1.0"
- },
- "require-dev": {
- "composer/composer": "~1.0@dev"
- },
- "extra": {
- "class": "ScriptsDev\\Plugin"
- }
-}
\ No newline at end of file
+}
diff --git a/composer.lock b/composer.lock
index 0320979..d6ecbbb 100644
--- a/composer.lock
+++ b/composer.lock
@@ -9,16 +9,16 @@
"packages-dev": [
{
"name": "composer/ca-bundle",
- "version": "1.0.7",
+ "version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
- "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12"
+ "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
- "reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/d2c0a83b7533d6912e8d516756ebd34f893e9169",
+ "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169",
"shasum": ""
},
"require": {
@@ -27,12 +27,9 @@
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5",
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
"psr/log": "^1.0",
- "symfony/process": "^2.5 || ^3.0"
- },
- "suggest": {
- "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+"
+ "symfony/process": "^2.5 || ^3.0 || ^4.0"
},
"type": "library",
"extra": {
@@ -64,7 +61,7 @@
"ssl",
"tls"
],
- "time": "2017-03-06T11:59:08+00:00"
+ "time": "2018-03-29T19:57:20+00:00"
},
{
"name": "composer/composer",
@@ -72,31 +69,34 @@
"source": {
"type": "git",
"url": "https://github.com/composer/composer.git",
- "reference": "2e9dbb79ef63036090d01b07d005428e05c8a5fc"
+ "reference": "9bc578e24a32f265f01f46e389edb028a61e9a07"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/composer/zipball/2e9dbb79ef63036090d01b07d005428e05c8a5fc",
- "reference": "2e9dbb79ef63036090d01b07d005428e05c8a5fc",
+ "url": "https://api.github.com/repos/composer/composer/zipball/9bc578e24a32f265f01f46e389edb028a61e9a07",
+ "reference": "9bc578e24a32f265f01f46e389edb028a61e9a07",
"shasum": ""
},
"require": {
"composer/ca-bundle": "^1.0",
"composer/semver": "^1.0",
- "composer/spdx-licenses": "^1.0",
+ "composer/spdx-licenses": "^1.2",
+ "composer/xdebug-handler": "^1.1",
"justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0",
"php": "^5.3.2 || ^7.0",
"psr/log": "^1.0",
- "seld/cli-prompt": "^1.0",
"seld/jsonlint": "^1.4",
"seld/phar-utils": "^1.0",
- "symfony/console": "^2.7 || ^3.0",
- "symfony/filesystem": "^2.7 || ^3.0",
- "symfony/finder": "^2.7 || ^3.0",
- "symfony/process": "^2.7 || ^3.0"
+ "symfony/console": "^2.7 || ^3.0 || ^4.0",
+ "symfony/filesystem": "^2.7 || ^3.0 || ^4.0",
+ "symfony/finder": "^2.7 || ^3.0 || ^4.0",
+ "symfony/process": "^2.7 || ^3.0 || ^4.0"
+ },
+ "conflict": {
+ "symfony/console": "2.8.38"
},
"require-dev": {
- "phpunit/phpunit": "^4.5 || ^5.0.5",
+ "phpunit/phpunit": "^4.8.35 || ^5.7",
"phpunit/phpunit-mock-objects": "^2.3 || ^3.0"
},
"suggest": {
@@ -110,7 +110,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.5-dev"
+ "dev-master": "1.7-dev"
}
},
"autoload": {
@@ -141,7 +141,7 @@
"dependency",
"package"
],
- "time": "2017-03-11 16:11:59"
+ "time": "2018-07-26T12:15:32+00:00"
},
{
"name": "composer/semver",
@@ -207,23 +207,23 @@
},
{
"name": "composer/spdx-licenses",
- "version": "1.1.5",
+ "version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/composer/spdx-licenses.git",
- "reference": "96c6a07b05b716e89a44529d060bc7f5c263cb13"
+ "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/96c6a07b05b716e89a44529d060bc7f5c263cb13",
- "reference": "96c6a07b05b716e89a44529d060bc7f5c263cb13",
+ "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/cb17687e9f936acd7e7245ad3890f953770dec1b",
+ "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5 || ^5.0.5",
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
"phpunit/phpunit-mock-objects": "2.3.0 || ^3.0"
},
"type": "library",
@@ -264,29 +264,73 @@
"spdx",
"validator"
],
- "time": "2016-09-28T07:17:45+00:00"
+ "time": "2018-04-30T10:33:04+00:00"
+ },
+ {
+ "name": "composer/xdebug-handler",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/xdebug-handler.git",
+ "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/c919dc6c62e221fc6406f861ea13433c0aa24f08",
+ "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.2 || ^7.0",
+ "psr/log": "^1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Composer\\XdebugHandler\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "John Stevenson",
+ "email": "john-stevenson@blueyonder.co.uk"
+ }
+ ],
+ "description": "Restarts a process without xdebug.",
+ "keywords": [
+ "Xdebug",
+ "performance"
+ ],
+ "time": "2018-04-11T15:42:36+00:00"
},
{
"name": "justinrainbow/json-schema",
- "version": "5.1.0",
+ "version": "5.2.7",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
- "reference": "48817e5f95c9d29e11513f12e43cc0223fa5eb6c"
+ "reference": "8560d4314577199ba51bf2032f02cd1315587c23"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/48817e5f95c9d29e11513f12e43cc0223fa5eb6c",
- "reference": "48817e5f95c9d29e11513f12e43cc0223fa5eb6c",
+ "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8560d4314577199ba51bf2032f02cd1315587c23",
+ "reference": "8560d4314577199ba51bf2032f02cd1315587c23",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
+ "friendsofphp/php-cs-fixer": "^2.1",
"json-schema/json-schema-test-suite": "1.2.0",
- "phpdocumentor/phpdocumentor": "~2",
- "phpunit/phpunit": "^4.8.22"
+ "phpunit/phpunit": "^4.8.35"
},
"bin": [
"bin/validate-json"
@@ -330,7 +374,7 @@
"json",
"schema"
],
- "time": "2017-02-22T03:28:16+00:00"
+ "time": "2018-02-14T22:26:30+00:00"
},
{
"name": "psr/log",
@@ -379,73 +423,25 @@
],
"time": "2016-10-10T12:19:37+00:00"
},
- {
- "name": "seld/cli-prompt",
- "version": "1.0.2",
- "source": {
- "type": "git",
- "url": "https://github.com/Seldaek/cli-prompt.git",
- "reference": "8cbe10923cae5bcd7c5a713f6703fc4727c8c1b4"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/8cbe10923cae5bcd7c5a713f6703fc4727c8c1b4",
- "reference": "8cbe10923cae5bcd7c5a713f6703fc4727c8c1b4",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Seld\\CliPrompt\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jordi Boggiano",
- "email": "j.boggiano@seld.be"
- }
- ],
- "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type",
- "keywords": [
- "cli",
- "console",
- "hidden",
- "input",
- "prompt"
- ],
- "time": "2016-04-18T09:31:41+00:00"
- },
{
"name": "seld/jsonlint",
- "version": "1.6.0",
+ "version": "1.7.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/jsonlint.git",
- "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8"
+ "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/791f8c594f300d246cdf01c6b3e1e19611e301d8",
- "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8",
+ "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38",
+ "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38",
"shasum": ""
},
"require": {
"php": "^5.3 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^4.5"
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"bin": [
"bin/jsonlint"
@@ -474,7 +470,7 @@
"parser",
"validator"
],
- "time": "2017-03-06T16:42:24+00:00"
+ "time": "2018-01-24T12:46:19+00:00"
},
{
"name": "seld/phar-utils",
@@ -522,39 +518,44 @@
},
{
"name": "symfony/console",
- "version": "v3.2.6",
+ "version": "v4.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "28fb243a2b5727774ca309ec2d92da240f1af0dd"
+ "reference": "5c31f6a97c1c240707f6d786e7e59bfacdbc0219"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/28fb243a2b5727774ca309ec2d92da240f1af0dd",
- "reference": "28fb243a2b5727774ca309ec2d92da240f1af0dd",
+ "url": "https://api.github.com/repos/symfony/console/zipball/5c31f6a97c1c240707f6d786e7e59bfacdbc0219",
+ "reference": "5c31f6a97c1c240707f6d786e7e59bfacdbc0219",
"shasum": ""
},
"require": {
- "php": ">=5.5.9",
- "symfony/debug": "~2.8|~3.0",
+ "php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0"
},
+ "conflict": {
+ "symfony/dependency-injection": "<3.4",
+ "symfony/process": "<3.3"
+ },
"require-dev": {
"psr/log": "~1.0",
- "symfony/event-dispatcher": "~2.8|~3.0",
- "symfony/filesystem": "~2.8|~3.0",
- "symfony/process": "~2.8|~3.0"
+ "symfony/config": "~3.4|~4.0",
+ "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/event-dispatcher": "~3.4|~4.0",
+ "symfony/lock": "~3.4|~4.0",
+ "symfony/process": "~3.4|~4.0"
},
"suggest": {
- "psr/log": "For using the console logger",
+ "psr/log-implementation": "For using the console logger",
"symfony/event-dispatcher": "",
- "symfony/filesystem": "",
+ "symfony/lock": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.2-dev"
+ "dev-master": "4.1-dev"
}
},
"autoload": {
@@ -581,42 +582,35 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2017-03-06T19:30:27+00:00"
+ "time": "2018-07-16T14:05:40+00:00"
},
{
- "name": "symfony/debug",
- "version": "v3.2.6",
+ "name": "symfony/filesystem",
+ "version": "v4.1.2",
"source": {
"type": "git",
- "url": "https://github.com/symfony/debug.git",
- "reference": "b90c9f91ad8ac37d9f114e369042d3226b34dc1a"
+ "url": "https://github.com/symfony/filesystem.git",
+ "reference": "562bf7005b55fd80d26b582d28e3e10f2dd5ae9c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/debug/zipball/b90c9f91ad8ac37d9f114e369042d3226b34dc1a",
- "reference": "b90c9f91ad8ac37d9f114e369042d3226b34dc1a",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/562bf7005b55fd80d26b582d28e3e10f2dd5ae9c",
+ "reference": "562bf7005b55fd80d26b582d28e3e10f2dd5ae9c",
"shasum": ""
},
"require": {
- "php": ">=5.5.9",
- "psr/log": "~1.0"
- },
- "conflict": {
- "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
- },
- "require-dev": {
- "symfony/class-loader": "~2.8|~3.0",
- "symfony/http-kernel": "~2.8|~3.0"
+ "php": "^7.1.3",
+ "symfony/polyfill-ctype": "~1.8"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.2-dev"
+ "dev-master": "4.1-dev"
}
},
"autoload": {
"psr-4": {
- "Symfony\\Component\\Debug\\": ""
+ "Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
@@ -636,36 +630,36 @@
"homepage": "https://symfony.com/contributors"
}
],
- "description": "Symfony Debug Component",
+ "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2017-02-18T17:28:00+00:00"
+ "time": "2018-05-30T07:26:09+00:00"
},
{
- "name": "symfony/filesystem",
- "version": "v3.2.6",
+ "name": "symfony/finder",
+ "version": "v4.1.2",
"source": {
"type": "git",
- "url": "https://github.com/symfony/filesystem.git",
- "reference": "bc0f17bed914df2cceb989972c3b996043c4da4a"
+ "url": "https://github.com/symfony/finder.git",
+ "reference": "84714b8417d19e4ba02ea78a41a975b3efaafddb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/bc0f17bed914df2cceb989972c3b996043c4da4a",
- "reference": "bc0f17bed914df2cceb989972c3b996043c4da4a",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/84714b8417d19e4ba02ea78a41a975b3efaafddb",
+ "reference": "84714b8417d19e4ba02ea78a41a975b3efaafddb",
"shasum": ""
},
"require": {
- "php": ">=5.5.9"
+ "php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.2-dev"
+ "dev-master": "4.1-dev"
}
},
"autoload": {
"psr-4": {
- "Symfony\\Component\\Filesystem\\": ""
+ "Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
@@ -685,39 +679,39 @@
"homepage": "https://symfony.com/contributors"
}
],
- "description": "Symfony Filesystem Component",
+ "description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2017-03-06T19:30:27+00:00"
+ "time": "2018-06-19T21:38:16+00:00"
},
{
- "name": "symfony/finder",
- "version": "v3.2.6",
+ "name": "symfony/polyfill-ctype",
+ "version": "v1.8.0",
"source": {
"type": "git",
- "url": "https://github.com/symfony/finder.git",
- "reference": "92d7476d2df60cd851a3e13e078664b1deb8ce10"
+ "url": "https://github.com/symfony/polyfill-ctype.git",
+ "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/92d7476d2df60cd851a3e13e078664b1deb8ce10",
- "reference": "92d7476d2df60cd851a3e13e078664b1deb8ce10",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
+ "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"shasum": ""
},
"require": {
- "php": ">=5.5.9"
+ "php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.2-dev"
+ "dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
- "Symfony\\Component\\Finder\\": ""
+ "Symfony\\Polyfill\\Ctype\\": ""
},
- "exclude-from-classmap": [
- "/Tests/"
+ "files": [
+ "bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -725,31 +719,37 @@
"MIT"
],
"authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
+ },
+ {
+ "name": "Gert de Pagter",
+ "email": "BackEndTea@gmail.com"
}
],
- "description": "Symfony Finder Component",
+ "description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
- "time": "2017-02-21T09:12:04+00:00"
+ "keywords": [
+ "compatibility",
+ "ctype",
+ "polyfill",
+ "portable"
+ ],
+ "time": "2018-04-30T19:57:29+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.3.0",
+ "version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
+ "reference": "3296adf6a6454a050679cde90f95350ad604b171"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
- "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171",
+ "reference": "3296adf6a6454a050679cde90f95350ad604b171",
"shasum": ""
},
"require": {
@@ -761,7 +761,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.3-dev"
+ "dev-master": "1.8-dev"
}
},
"autoload": {
@@ -795,29 +795,29 @@
"portable",
"shim"
],
- "time": "2016-11-14T01:06:16+00:00"
+ "time": "2018-04-26T10:06:28+00:00"
},
{
"name": "symfony/process",
- "version": "v3.2.6",
+ "version": "v4.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "68bfa8c83f24c0ac04ea7193bcdcda4519f41892"
+ "reference": "1d1677391ecf00d1c5b9482d6050c0c27aa3ac3a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/68bfa8c83f24c0ac04ea7193bcdcda4519f41892",
- "reference": "68bfa8c83f24c0ac04ea7193bcdcda4519f41892",
+ "url": "https://api.github.com/repos/symfony/process/zipball/1d1677391ecf00d1c5b9482d6050c0c27aa3ac3a",
+ "reference": "1d1677391ecf00d1c5b9482d6050c0c27aa3ac3a",
"shasum": ""
},
"require": {
- "php": ">=5.5.9"
+ "php": "^7.1.3"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.2-dev"
+ "dev-master": "4.1-dev"
}
},
"autoload": {
@@ -844,7 +844,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2017-03-04T12:23:14+00:00"
+ "time": "2018-05-31T10:17:53+00:00"
}
],
"aliases": [],
diff --git a/src/DevScriptProxyCommand.php b/src/DevScriptProxyCommand.php
new file mode 100644
index 0000000..a69668e
--- /dev/null
+++ b/src/DevScriptProxyCommand.php
@@ -0,0 +1,49 @@
+setName('{name}')
+ ->setDescription('Run the {name} defined in composer.json.')
+ ->setDefinition(array(
+ new InputArgument('script', InputArgument::OPTIONAL, ''),
+ new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
+ new InputOption('timeout', null, InputOption::VALUE_REQUIRED,
+ 'Sets script timeout in seconds, or 0 for never.'),
+ new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
+ new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
+ new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
+ ));
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $args = array(
+ 'command' => 'run-script',
+ 'script' => $this->getName(),
+ 'args' => $input->getArgument('args'),
+ '--timeout' => $input->getOption('timeout') ?: '0',
+ '--dev' => $input->getOption('dev'),
+ '--no-dev' => $input->getOption('no-dev'),
+ '--list' => $input->getOption('list'),
+ );
+
+ $command = $this->getApplication()->find('run-script');
+
+ $arrayInput = new ArrayInput($args);
+ $statusCode = $command->run($arrayInput, $output);
+ return is_numeric($statusCode) ? (int) $statusCode : 0;
+ }
+}
diff --git a/src/DevScriptsCommandProvider.php b/src/DevScriptsCommandProvider.php
new file mode 100644
index 0000000..a241cf4
--- /dev/null
+++ b/src/DevScriptsCommandProvider.php
@@ -0,0 +1,60 @@
+composer = $args['composer'];
+ $this->io = $args['io'];
+ }
+
+ public function getCommands()
+ {
+ $package = $this->composer->getPackage();
+ $extractor = new PackageScriptsExtractor($this->io);
+ $devScripts = $extractor->extract($package);
+ $commands = array();
+ foreach ($devScripts as $name => $cmd) {
+ $commands[] = $this->buildCommand($name);
+ }
+ return $commands;
+ }
+
+ /**
+ * @param $name
+ * @return DevScriptProxyCommand
+ */
+ private function buildCommand($name)
+ {
+ $command = new DevScriptProxyCommand($name);
+ $command->setName($this->replaceName($command->getName(), $name));
+ $command->setDescription($this->replaceName($command->getDescription(), $name));
+ return $command;
+ }
+
+ private function replaceName($string, $replacement)
+ {
+ return str_replace('{name}', $replacement, $string);
+ }
+}
diff --git a/src/PackageScriptsExtractor.php b/src/PackageScriptsExtractor.php
new file mode 100644
index 0000000..1995dbd
--- /dev/null
+++ b/src/PackageScriptsExtractor.php
@@ -0,0 +1,59 @@
+io = $io;
+ }
+
+ /**
+ * @param PackageInterface $package
+ * @return array
+ */
+ public function extract(PackageInterface $package)
+ {
+ if ($package instanceof CompletePackage && isset($_SERVER['argv']) && in_array('--no-dev', $_SERVER['argv'], true)) {
+ return array();
+ }
+
+ $devScripts = array();
+ $config = json_decode(file_get_contents(getcwd() . '/composer.json'), true);
+ if (isset($config['scripts-dev']) && is_array($config['scripts-dev'])) {
+ if (!static::$warningPrinted) {
+ $this->io->writeError(
+ "You're using deprecated way to define development-only scripts.
+Please, move commands under `scripts-dev` directive into `extra` field.
+See https://github.com/neronmoon/scriptsdev/blob/master/README.md for more details."
+ );
+ static::$warningPrinted = true;
+ }
+ $devScripts = array_merge_recursive($devScripts, $config['scripts-dev']);
+ }
+
+ $extra = $package->getExtra();
+ if (isset($extra['scripts-dev']) && is_array($extra['scripts-dev'])) {
+ $devScripts = array_merge_recursive($devScripts, $extra['scripts-dev']);
+ }
+
+ foreach ($devScripts as $event => &$listeners) {
+ $listeners = (array)$listeners;
+ }
+
+ return $devScripts;
+ }
+}
diff --git a/src/Plugin.php b/src/Plugin.php
index bf241ac..def704a 100644
--- a/src/Plugin.php
+++ b/src/Plugin.php
@@ -4,36 +4,38 @@
use Composer\Composer;
use Composer\IO\IOInterface;
-use Composer\Package\CompletePackage;
+use Composer\Package\AliasPackage;
+use Composer\Plugin\Capable;
use Composer\Plugin\PluginInterface;
-class Plugin implements PluginInterface
+class Plugin implements PluginInterface, Capable
{
- public function activate(Composer $composer, IOInterface $io)
- {
- $package = $composer->getPackage();
-
- if ($package instanceof CompletePackage && in_array('--no-dev', $_SERVER['argv'], true)) {
- return;
- }
-
- $devScripts = array();
- $config = json_decode(file_get_contents(getcwd() . '/composer.json'), true);
- if (isset($config['scripts-dev']) && is_array($config['scripts-dev'])) {
- $io->writeError("You're using deprecated way to define development-only scripts.
-Please, move commands under `scripts-dev` directive into `extra` field.
-See README.md for more details.");
- $devScripts = array_merge_recursive($devScripts, $config['scripts-dev']);
- }
-
- $extra = $package->getExtra();
- if (isset($extra['scripts-dev']) && is_array($extra['scripts-dev'])) {
- $devScripts = array_merge_recursive($devScripts, $extra['scripts-dev']);
- }
-
- foreach ($devScripts as $event => &$listeners) {
- $listeners = (array)$listeners;
- }
- $package->setScripts(array_merge_recursive($package->getScripts(), $devScripts));
- }
+ public function getCapabilities()
+ {
+ return array(
+ 'Composer\Plugin\Capability\CommandProvider' => 'ScriptsDev\DevScriptsCommandProvider',
+ );
+ }
+
+ public function activate(Composer $composer, IOInterface $io)
+ {
+ $package = $composer->getPackage();
+ // If we have extra.branch-alias, package will be an instanceof RootAliasPackage instead of RootPackage
+ if ($package instanceof AliasPackage) {
+ $package = $package->getAliasOf();
+ }
+
+ $extractor = new PackageScriptsExtractor($io);
+ $devScripts = $extractor->extract($package);
+
+ $package->setScripts(array_merge_recursive($package->getScripts(), $devScripts));
+ }
+
+ public function deactivate(Composer $composer, IOInterface $io)
+ {
+ }
+
+ public function uninstall(Composer $composer, IOInterface $io)
+ {
+ }
}
diff --git a/tests/extra-with-branch-alias.json b/tests/extra-with-branch-alias.json
new file mode 100644
index 0000000..2dda890
--- /dev/null
+++ b/tests/extra-with-branch-alias.json
@@ -0,0 +1,38 @@
+{
+ "name": "neronmoon/scriptsdev-test",
+ "description": "Scripts-dev behaviour for Composer",
+ "keywords": [
+ "dev",
+ "scripts",
+ "composer",
+ "commands",
+ "commands execution"
+ ],
+ "homepage": "https://github.com/neronmoon/scriptsdev",
+ "type": "project",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Vitaliy Krasnoperov",
+ "email": "alistar.neron@gmail.com"
+ }
+ ],
+ "repositories": [
+ {
+ "type": "path",
+ "url": ""
+ }
+ ],
+ "require": {
+ "neronmoon/scriptsdev": "*@dev"
+ },
+ "version": "dev-master",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "99.0.0-dev"
+ },
+ "scripts-dev": {
+ "post-update-cmd": "echo SCRIPTSDEV RULEZ"
+ }
+ }
+}
diff --git a/tests/extra-with-custom-script-run-script-dev.json b/tests/extra-with-custom-script-run-script-dev.json
new file mode 100644
index 0000000..451dd1c
--- /dev/null
+++ b/tests/extra-with-custom-script-run-script-dev.json
@@ -0,0 +1,28 @@
+{
+ "name": "neronmoon/scriptsdev-test",
+ "description": "Scripts-dev behaviour for Composer",
+ "keywords": ["dev", "scripts", "composer", "commands", "commands execution"],
+ "homepage": "https://github.com/neronmoon/scriptsdev",
+ "type": "project",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Vitaliy Krasnoperov",
+ "email": "alistar.neron@gmail.com"
+ }
+ ],
+ "repositories": [
+ {
+ "type": "path",
+ "url": ""
+ }
+ ],
+ "require": {
+ "neronmoon/scriptsdev": "*@dev"
+ },
+ "extra": {
+ "scripts-dev": {
+ "test": "echo SCRIPTSDEV RULEZ"
+ }
+ }
+}
diff --git a/tests/legacy-with-run-scripts-dev.json b/tests/legacy-with-run-scripts-dev.json
new file mode 100644
index 0000000..704b1b8
--- /dev/null
+++ b/tests/legacy-with-run-scripts-dev.json
@@ -0,0 +1,26 @@
+{
+ "name": "neronmoon/scriptsdev-test",
+ "description": "Scripts-dev behaviour for Composer",
+ "keywords": ["dev", "scripts", "composer", "commands", "commands execution"],
+ "homepage": "https://github.com/neronmoon/scriptsdev",
+ "type": "project",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Vitaliy Krasnoperov",
+ "email": "alistar.neron@gmail.com"
+ }
+ ],
+ "repositories": [
+ {
+ "type": "path",
+ "url": ""
+ }
+ ],
+ "require": {
+ "neronmoon/scriptsdev": "*@dev"
+ },
+ "scripts-dev": {
+ "test": "echo SCRIPTSDEV RULEZ"
+ }
+}
diff --git a/tests/legacy.json b/tests/legacy.json
index 7aacdda..74be368 100644
--- a/tests/legacy.json
+++ b/tests/legacy.json
@@ -23,4 +23,4 @@
"scripts-dev": {
"post-update-cmd": "echo SCRIPTSDEV RULEZ"
}
-}
\ No newline at end of file
+}
diff --git a/tests/tests.py b/tests/tests.py
index 06cde99..70302ce 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -1,48 +1,91 @@
-from subprocess import check_output, check_call
import os
+from subprocess import check_output, check_call
-def test(test, args=[], cmd=['composer', 'update', '-v'], clean_dir=True):
+def test(test, cmds):
+ print "Testing:", test, cmds,
+
working_dir = '/tmp/scriptsdev/' + test
- if clean_dir:
- check_call(['rm', '-rf', working_dir])
- check_call(['mkdir', '-p', working_dir])
+ check_call(['rm', '-rf', working_dir])
+ check_call(['mkdir', '-p', working_dir])
+
+ if isinstance(cmds[0], basestring):
+ cmds = [cmds]
- source_composer_json = open('tests/%s.json' % test, 'r').read()
- source_composer_json = source_composer_json.replace('', os.getcwd())
+ output = ''
+ for cmd in cmds:
+ source_composer_json = open('tests/%s.json' % test, 'r').read()
+ source_composer_json = source_composer_json.replace('', os.getcwd())
- target_composer_json = open(working_dir + '/composer.json', 'w')
- target_composer_json.write(source_composer_json)
- target_composer_json.close()
+ target_composer_json = open(working_dir + '/composer.json', 'w')
+ target_composer_json.write(source_composer_json)
+ target_composer_json.close()
- return check_output(cmd + args, cwd=working_dir)
+ try:
+ output += check_output(cmd, cwd=working_dir)
+ except Exception, e:
+ output += str(e.output)
+ return output
def check(expect, actual):
- print "expect: ", expect
- print "actual: ", actual
if not expect in actual:
raise Exception('EXPECTED\n"%s"\nBUT FOUND\n"%s"' % (expect, actual))
+ else:
+ print 'OK'
def check_not(expect_not, actual):
- print "expect not: ", expect_not
- print "actual: ", actual
if expect_not in actual:
raise Exception('EXPECTED\n"%s"\nBUT FOUND\n"%s"' % (expect_not, actual))
+ else:
+ print 'OK'
############ TESTS HERE #############
-check('SCRIPTSDEV RULEZ', test('extra'))
-check_not('SCRIPTSDEV RULEZ', test('extra', ['--no-dev']))
-
-check('SCRIPTSDEV RULEZ', test('legacy'))
-check_not('SCRIPTSDEV RULEZ', test('legacy', ['--no-dev']))
-
-check('SCRIPTSDEV RULEZ', test('extra-with-custom-script', cmd=['composer', 'run-script', 'test-update']))
-check_not('SCRIPTSDEV RULEZ', test('extra-with-custom-script', cmd=['composer', 'run-script', 'test-update-no-dev']))
-
-check('SCRIPTSDEV RULEZ', test('extra-with-custom-script', cmd=['composer', 'run-script', 'test-install'], clean_dir=False))
-check_not('SCRIPTSDEV RULEZ', test('extra-with-custom-script', cmd=['composer', 'run-script', 'test-install-no-dev'], clean_dir=False))
\ No newline at end of file
+check('SCRIPTSDEV RULEZ', test('legacy', ['composer', 'update']))
+check_not('SCRIPTSDEV RULEZ', test('legacy', ['composer', '--no-dev', 'update']))
+
+check('SCRIPTSDEV RULEZ', test('legacy-with-run-scripts-dev', [
+ ['composer', 'update'],
+ ['composer', 'run-script', 'test']]))
+check('SCRIPTSDEV RULEZ', test('legacy-with-run-scripts-dev', [
+ ['composer', 'update'],
+ ['composer', '--dev', 'run-script', 'test']]))
+check_not('SCRIPTSDEV RULEZ', test('legacy-with-run-scripts-dev', [
+ ['composer', 'update'],
+ ['composer', '--no-dev', 'run-script', 'test']]))
+
+check('SCRIPTSDEV RULEZ', test('extra', ['composer', 'update']))
+check_not('SCRIPTSDEV RULEZ', test('extra', ['composer', '--no-dev', 'update']))
+
+check('SCRIPTSDEV RULEZ', test('extra-with-branch-alias', ['composer', 'update']))
+check_not('SCRIPTSDEV RULEZ', test('extra-with-branch-alias', ['composer', '--no-dev', 'update']))
+
+check('SCRIPTSDEV RULEZ', test('extra-with-custom-script', ['composer', 'run-script', 'test-update']))
+check_not('SCRIPTSDEV RULEZ', test('extra-with-custom-script', ['composer', 'run-script', 'test-update-no-dev']))
+
+check('SCRIPTSDEV RULEZ', test('extra-with-custom-script', ['composer', 'run-script', 'test-install']))
+check_not('SCRIPTSDEV RULEZ', test('extra-with-custom-script', ['composer', 'run-script', 'test-install-no-dev']))
+
+check('SCRIPTSDEV RULEZ', test('extra-with-custom-script-run-script-dev', [
+ ['composer', 'update'],
+ ['composer', 'run-script', 'test']]))
+check('SCRIPTSDEV RULEZ', test('extra-with-custom-script-run-script-dev', [
+ ['composer', 'update'],
+ ['composer', '--dev', 'run-script', 'test']]))
+check_not('SCRIPTSDEV RULEZ', test('extra-with-custom-script-run-script-dev', [
+ ['composer', 'update'],
+ ['composer', '--no-dev', 'run-script', 'test']]))
+
+check('SCRIPTSDEV RULEZ', test('extra-with-custom-script-run-script-dev', [
+ ['composer', 'update'],
+ ['composer', 'test']]))
+check('SCRIPTSDEV RULEZ', test('extra-with-custom-script-run-script-dev', [
+ ['composer', 'update'],
+ ['composer', '--dev', 'test']]))
+check_not('SCRIPTSDEV RULEZ', test('extra-with-custom-script-run-script-dev', [
+ ['composer', 'update'],
+ ['composer', '--no-dev', 'test']]))