Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
1
vendor/consolidation/self-update/.gitignore
vendored
Normal file
1
vendor/consolidation/self-update/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
vendor
|
20
vendor/consolidation/self-update/LICENSE
vendored
Normal file
20
vendor/consolidation/self-update/LICENSE
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Codegyre Developers Team, Consolidation Team
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
17
vendor/consolidation/self-update/README.md
vendored
Normal file
17
vendor/consolidation/self-update/README.md
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
# SelfUpdate
|
||||
|
||||
Symfony Console command to update a phar in place.
|
||||
|
||||
## Usage
|
||||
|
||||
To use the self:update command, instantiate it with the name of the application,
|
||||
its current version, and the full name of the GitHub project.
|
||||
```
|
||||
$cmd = new SelfUpdateCommand('MyAppName', '1.0.0', 'org/my-app');
|
||||
$app->add($cmd);
|
||||
```
|
||||
|
||||
## Similar Projects
|
||||
|
||||
- https://github.com/DavaHome/self-update
|
||||
- https://github.com/padraic/phar-updater
|
1
vendor/consolidation/self-update/VERSION
vendored
Normal file
1
vendor/consolidation/self-update/VERSION
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
1.1.5
|
43
vendor/consolidation/self-update/composer.json
vendored
Normal file
43
vendor/consolidation/self-update/composer.json
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "consolidation/self-update",
|
||||
"description": "Provides a self:update command for Symfony Console applications.",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Alexander Menk",
|
||||
"email": "menk@mestrona.net"
|
||||
},
|
||||
{
|
||||
"name": "Greg Anderson",
|
||||
"email": "greg.1.anderson@greenknowe.org"
|
||||
}
|
||||
],
|
||||
"autoload":{
|
||||
"psr-4":{
|
||||
"SelfUpdate\\":"src"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0",
|
||||
"symfony/console": "^2.8|^3|^4",
|
||||
"symfony/filesystem": "^2.5|^3|^4"
|
||||
},
|
||||
"bin": [
|
||||
"scripts/release"
|
||||
],
|
||||
"scripts": {
|
||||
"release": "./scripts/release VERSION"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"platform": {
|
||||
"php": "5.6.3"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
362
vendor/consolidation/self-update/composer.lock
generated
vendored
Normal file
362
vendor/consolidation/self-update/composer.lock
generated
vendored
Normal file
|
@ -0,0 +1,362 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "3c87d0a607c776a773e52613a1ae51a9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v3.4.14",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/6b217594552b9323bcdcfc14f8a0ce126e84cd73",
|
||||
"reference": "6b217594552b9323bcdcfc14f8a0ce126e84cd73",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/debug": "~2.8|~3.0|~4.0",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/dependency-injection": "<3.4",
|
||||
"symfony/process": "<3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~3.3|~4.0",
|
||||
"symfony/dependency-injection": "~3.4|~4.0",
|
||||
"symfony/event-dispatcher": "~2.8|~3.0|~4.0",
|
||||
"symfony/lock": "~3.4|~4.0",
|
||||
"symfony/process": "~3.3|~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log-implementation": "For using the console logger",
|
||||
"symfony/event-dispatcher": "",
|
||||
"symfony/lock": "",
|
||||
"symfony/process": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Console\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-07-26T11:19:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v3.4.14",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/d5a058ff6ecad26b30c1ba452241306ea34c65cc",
|
||||
"reference": "d5a058ff6ecad26b30c1ba452241306ea34c65cc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"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/http-kernel": "~2.8|~3.0|~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Debug\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-07-26T11:19:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v3.4.14",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "a59f917e3c5d82332514cb4538387638f5bde2d6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a59f917e3c5d82332514cb4538387638f5bde2d6",
|
||||
"reference": "a59f917e3c5d82332514cb4538387638f5bde2d6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/polyfill-ctype": "~1.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Filesystem\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2018-07-26T11:19:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
|
||||
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2018-08-06T14:22:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8",
|
||||
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2018-08-06T14:22:27+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "5.6.3"
|
||||
}
|
||||
}
|
178
vendor/consolidation/self-update/scripts/release
vendored
Executable file
178
vendor/consolidation/self-update/scripts/release
vendored
Executable file
|
@ -0,0 +1,178 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Usage:
|
||||
*
|
||||
* ./vendor/bin/release VERSION
|
||||
*/
|
||||
|
||||
$semverRegEx = '(?<version>[0-9]+\.[0-9]+\.[0-9]+)(?<prerelease>-[0-9a-zA-Z.]+)?(?<build>\+[0-9a-zA-Z.]*)?';
|
||||
|
||||
$optind = null;
|
||||
$options = getopt ("dvy", [
|
||||
'pattern:',
|
||||
'simulate',
|
||||
'yes',
|
||||
], $optind) + [
|
||||
'pattern' => "^SEMVER$",
|
||||
];
|
||||
$simulate = array_key_exists('simulate', $options);
|
||||
$yes = array_key_exists('yes', $options) || array_key_exists('y', $options);
|
||||
|
||||
$pos_args = array_slice($argv, $optind);
|
||||
$path = array_shift($pos_args);
|
||||
|
||||
if (empty($path)) {
|
||||
print "Path to version file must be specified as a commandline argument\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!file_exists($path)) {
|
||||
print "Version file not found at $path\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// The --pattern option is expected to contain the string SEMVER
|
||||
$regex = str_replace('SEMVER', "$semverRegEx", $options['pattern']);
|
||||
if ($regex == $options['pattern']) {
|
||||
print "Pattern '$regex' must contain the string 'SEMVER'.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Read the contents of the version file and find the version string
|
||||
$contents = file_get_contents($path);
|
||||
if (!preg_match("#$regex#m", $contents, $matches)) {
|
||||
print "A semver version not found in $path\n";
|
||||
exit(1);
|
||||
}
|
||||
$matches += ['prerelease' => '', 'build' => ''];
|
||||
|
||||
// Calculate the stable and next version strings
|
||||
$original_version_match = $matches[0];
|
||||
$original_version = $matches['version'] . $matches['prerelease'] . $matches['build'];
|
||||
$stable_version = $matches['version'] . (has_prerelease($matches) ? $matches['prerelease'] : '');
|
||||
$next_version = next_version($matches);
|
||||
|
||||
$stable_version_replacement = str_replace($original_version, $stable_version, $original_version_match);
|
||||
$next_version_replacement = str_replace($original_version, $next_version, $original_version_match);
|
||||
|
||||
$stable_version_contents = str_replace($original_version_match, $stable_version_replacement, $contents);
|
||||
$next_version_contents = str_replace($original_version_match, $next_version_replacement, $contents);
|
||||
|
||||
$composerContents = file_get_contents('composer.json');
|
||||
$composerData = json_decode($composerContents, true);
|
||||
$project = $composerData['name'];
|
||||
|
||||
$msg = "Release $project version $stable_version";
|
||||
$dashes = str_pad('', strlen($msg) + 8, '-', STR_PAD_LEFT);
|
||||
|
||||
print "\n$dashes\n\n";
|
||||
print " $msg\n";
|
||||
print "\n$dashes\n\n";
|
||||
|
||||
// Write the stable version into the version file, tag and push the release
|
||||
if (!$simulate) {
|
||||
file_put_contents($path, $stable_version_contents);
|
||||
}
|
||||
else {
|
||||
print "Replace stable version in $path:\n> $stable_version_replacement\n";
|
||||
}
|
||||
|
||||
run('git add {path}', ['{path}' => $path], $simulate);
|
||||
run('git commit -m "Version {version}"', ['{version}' => $stable_version], $simulate);
|
||||
run('git tag {version}', ['{version}' => $stable_version], $simulate);
|
||||
run('git push origin {version}', ['{version}' => $stable_version], $simulate);
|
||||
|
||||
// Put the next version into the version file and push the result back to master
|
||||
if (!$simulate) {
|
||||
file_put_contents($path, $next_version_contents);
|
||||
}
|
||||
else {
|
||||
print "Replace next version in $path:\n> $next_version_replacement\n";
|
||||
}
|
||||
|
||||
run('git add {path}', ['{path}' => $path], $simulate);
|
||||
run('git commit -m "[ci skip] Back to {version}"', ['{version}' => $next_version], $simulate);
|
||||
run('git push origin master', [], $simulate);
|
||||
|
||||
exit(0);
|
||||
|
||||
/**
|
||||
* inflect replaces the placeholders in the command with the provided parameter values
|
||||
* @param string $cmd
|
||||
* @param array $parameters
|
||||
* @return string
|
||||
*/
|
||||
function inflect($cmd, $parameters = [])
|
||||
{
|
||||
if (!empty($parameters)) {
|
||||
return str_replace(array_keys($parameters), array_values($parameters), $cmd);
|
||||
}
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the specified command. Abort most rudely if an error is encountered
|
||||
*/
|
||||
function run($cmd, $parameters = [], $simulate = false)
|
||||
{
|
||||
$cmd = inflect($cmd, $parameters);
|
||||
if ($simulate) {
|
||||
print "$cmd\n";
|
||||
return;
|
||||
}
|
||||
passthru($cmd, $status);
|
||||
if ($status) {
|
||||
exit($status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the next version after the current release
|
||||
*/
|
||||
function next_version($matches)
|
||||
{
|
||||
$version = $matches['version'];
|
||||
|
||||
$next_version = next_version_prerelease($matches);
|
||||
if ($next_version !== false) {
|
||||
return $next_version;
|
||||
}
|
||||
return next_version_stable($matches);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the next version given that the current version is stable
|
||||
*/
|
||||
function next_version_stable($matches)
|
||||
{
|
||||
$version_parts = explode('.', $matches['version']);
|
||||
$last_version = array_pop($version_parts);
|
||||
$last_version++;
|
||||
$version_parts[] = $last_version;
|
||||
|
||||
return implode('.', $version_parts) . (empty($matches['prerelease']) ? '-dev' : $matches['prerelease']);
|
||||
}
|
||||
|
||||
function has_prerelease($matches)
|
||||
{
|
||||
if (empty($matches['prerelease'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_numeric(substr($matches['prerelease'], -1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the next version given that the current version has a pre-release
|
||||
* (e.g. '-alpha5').
|
||||
*/
|
||||
function next_version_prerelease($version_parts)
|
||||
{
|
||||
if (!preg_match('#(.*?)([0-9]+)$#', $version_parts['prerelease'], $matches)) {
|
||||
return false;
|
||||
}
|
||||
$next = $matches[2] + 1;
|
||||
return $version_parts['version'] . $matches[1] . $next . '+dev';
|
||||
}
|
154
vendor/consolidation/self-update/src/SelfUpdateCommand.php
vendored
Normal file
154
vendor/consolidation/self-update/src/SelfUpdateCommand.php
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
|
||||
namespace SelfUpdate;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem as sfFilesystem;
|
||||
|
||||
/**
|
||||
* Update the robo.phar from the latest github release
|
||||
*
|
||||
* @author Alexander Menk <alex.menk@gmail.com>
|
||||
*/
|
||||
class SelfUpdateCommand extends Command
|
||||
{
|
||||
const SELF_UPDATE_COMMAND_NAME = 'self:update';
|
||||
|
||||
protected $gitHubRepository;
|
||||
|
||||
protected $currentVersion;
|
||||
|
||||
protected $applicationName;
|
||||
|
||||
public function __construct($applicationName = null, $currentVersion = null, $gitHubRepository = null)
|
||||
{
|
||||
$this->applicationName = $applicationName;
|
||||
$this->currentVersion = $currentVersion;
|
||||
$this->gitHubRepository = $gitHubRepository;
|
||||
|
||||
parent::__construct(self::SELF_UPDATE_COMMAND_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$app = $this->applicationName;
|
||||
|
||||
$this
|
||||
->setAliases(array('update'))
|
||||
->setDescription("Updates $app to the latest version.")
|
||||
->setHelp(
|
||||
<<<EOT
|
||||
The <info>self-update</info> command checks github for newer
|
||||
versions of $app and if found, installs the latest.
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
protected function getLatestReleaseFromGithub()
|
||||
{
|
||||
$opts = [
|
||||
'http' => [
|
||||
'method' => 'GET',
|
||||
'header' => [
|
||||
'User-Agent: ' . $this->applicationName . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$context = stream_context_create($opts);
|
||||
|
||||
$releases = file_get_contents('https://api.github.com/repos/' . $this->gitHubRepository . '/releases', false, $context);
|
||||
$releases = json_decode($releases);
|
||||
|
||||
if (! isset($releases[0])) {
|
||||
throw new \Exception('API error - no release found at GitHub repository ' . $this->gitHubRepository);
|
||||
}
|
||||
|
||||
$version = $releases[0]->tag_name;
|
||||
$url = $releases[0]->assets[0]->browser_download_url;
|
||||
|
||||
return [ $version, $url ];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (empty(\Phar::running())) {
|
||||
throw new \Exception(self::SELF_UPDATE_COMMAND_NAME . ' only works when running the phar version of ' . $this->applicationName . '.');
|
||||
}
|
||||
|
||||
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
|
||||
$programName = basename($localFilename);
|
||||
$tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar') . '-temp.phar';
|
||||
|
||||
// check for permissions in local filesystem before start connection process
|
||||
if (! is_writable($tempDirectory = dirname($tempFilename))) {
|
||||
throw new \Exception(
|
||||
$programName . ' update failed: the "' . $tempDirectory .
|
||||
'" directory used to download the temp file could not be written'
|
||||
);
|
||||
}
|
||||
|
||||
if (! is_writable($localFilename)) {
|
||||
throw new \Exception(
|
||||
$programName . ' update failed: the "' . $localFilename . '" file could not be written (execute with sudo)'
|
||||
);
|
||||
}
|
||||
|
||||
list( $latest, $downloadUrl ) = $this->getLatestReleaseFromGithub();
|
||||
|
||||
|
||||
if ($this->currentVersion == $latest) {
|
||||
$output->writeln('No update available');
|
||||
return;
|
||||
}
|
||||
|
||||
$fs = new sfFilesystem();
|
||||
|
||||
$output->writeln('Downloading ' . $this->applicationName . ' (' . $this->gitHubRepository . ') ' . $latest);
|
||||
|
||||
$fs->copy($downloadUrl, $tempFilename);
|
||||
|
||||
$output->writeln('Download finished');
|
||||
|
||||
try {
|
||||
\error_reporting(E_ALL); // supress notices
|
||||
|
||||
@chmod($tempFilename, 0777 & ~umask());
|
||||
// test the phar validity
|
||||
$phar = new \Phar($tempFilename);
|
||||
// free the variable to unlock the file
|
||||
unset($phar);
|
||||
@rename($tempFilename, $localFilename);
|
||||
$output->writeln('<info>Successfully updated ' . $programName . '</info>');
|
||||
$this->_exit();
|
||||
} catch (\Exception $e) {
|
||||
@unlink($tempFilename);
|
||||
if (! $e instanceof \UnexpectedValueException && ! $e instanceof \PharException) {
|
||||
throw $e;
|
||||
}
|
||||
$output->writeln('<error>The download is corrupted (' . $e->getMessage() . ').</error>');
|
||||
$output->writeln('<error>Please re-run the self-update command to try again.</error>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop execution
|
||||
*
|
||||
* This is a workaround to prevent warning of dispatcher after replacing
|
||||
* the phar file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _exit()
|
||||
{
|
||||
exit;
|
||||
}
|
||||
}
|
Reference in a new issue