PK ]GM}o o .travis.ymlnu W+A language: php
php:
- 5.3
- 5.4
before_script:
- composer self-update
- composer install --devPK ]GM\Gn n
composer.locknu W+A {
"hash": "6f0fb6b47f91606ef534b4beaf04ab04",
"packages": [
{
"name": "herrera-io/json",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/herrera-io/php-json.git",
"reference": "1.0.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/herrera-io/php-json/zipball/1.0.0",
"reference": "1.0.0",
"shasum": ""
},
"require": {
"justinrainbow/json-schema": ">=1.0,<2.0-dev",
"php": ">=5.3.3",
"seld/jsonlint": ">=1.0,<2.0-dev"
},
"require-dev": {
"herrera-io/phpunit-test-case": "1.*",
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"files": [
"src/lib/json_version.php"
],
"psr-0": {
"Herrera\\Json": "src/lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Herrera",
"email": "kevin@herrera.io",
"homepage": "http://kevin.herrera.io"
}
],
"description": "A library for simplifying JSON linting and validation.",
"homepage": "http://herrera-io.github.com/php-json",
"keywords": [
"json",
"lint",
"schema",
"validate"
],
"time": "2013-03-08 23:31:40"
},
{
"name": "herrera-io/phar-update",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/herrera-io/php-phar-update.git",
"reference": "1.0.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/herrera-io/php-phar-update/zipball/1.0.0",
"reference": "1.0.0",
"shasum": ""
},
"require": {
"herrera-io/json": "1.*",
"kherge/version": "1.*",
"php": ">=5.3.3"
},
"require-dev": {
"herrera-io/phpunit-test-case": "1.*",
"mikey179/vfsstream": "1.1.0",
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"files": [
"src/lib/constants.php"
],
"psr-0": {
"Herrera\\Phar\\Update": "src/lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Herrera",
"email": "kevin@herrera.io",
"homepage": "http://kevin.herrera.io"
}
],
"description": "A library for self-updating Phars.",
"homepage": "http://herrera-io.github.com/php-phar-update",
"keywords": [
"phar",
"update"
],
"time": "2013-03-13 21:57:48"
},
{
"name": "justinrainbow/json-schema",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
"reference": "1.3.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/1.3.0",
"reference": "1.3.0",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"bin": [
"bin/validate-json"
],
"type": "library",
"autoload": {
"psr-0": {
"JsonSchema": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch",
"homepage": "http://wiedler.ch/igor/"
},
{
"name": "Bruno Prieto Reis",
"email": "bruno.p.reis@gmail.com"
},
{
"name": "Justin Rainbow",
"email": "justin.rainbow@gmail.com"
},
{
"name": "Robert Schönthal",
"email": "seroscho@googlemail.com",
"homepage": "http://digitalkaoz.net"
}
],
"description": "A library to validate a json schema.",
"homepage": "https://github.com/justinrainbow/json-schema",
"keywords": [
"json",
"schema"
],
"time": "2013-02-18 05:00:27"
},
{
"name": "kherge/version",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/kherge/Version.git",
"reference": "1.0.1"
},
"dist": {
"type": "zip",
"url": "https://github.com/kherge/Version/zipball/1.0.1",
"reference": "1.0.1",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-0": {
"KevinGH\\Version": "src/lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Herrera",
"email": "me@kevingh.com",
"homepage": "http://www.kevingh.com/"
}
],
"description": "A parsing and comparison library for semantic versioning.",
"homepage": "http://github.com/kherge/Version",
"time": "2012-08-16 10:13:03"
},
{
"name": "seld/jsonlint",
"version": "1.1.1",
"source": {
"type": "git",
"url": "http://github.com/Seldaek/jsonlint",
"reference": "1.1.1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/1.1.1",
"reference": "1.1.1",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"bin": [
"bin/jsonlint"
],
"type": "library",
"autoload": {
"psr-0": {
"Seld\\JsonLint": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be",
"role": "Developer"
}
],
"description": "JSON Linter",
"keywords": [
"json",
"linter",
"parser",
"validator"
],
"time": "2013-02-11 23:03:12"
},
{
"name": "symfony/console",
"version": "v2.2.0",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "v2.2.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.0",
"reference": "v2.2.0",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Console\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "http://symfony.com",
"time": "2013-03-01 06:43:14"
}
],
"packages-dev": [
{
"name": "herrera-io/box",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/herrera-io/php-box.git",
"reference": "1.0.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/herrera-io/php-box/zipball/1.0.0",
"reference": "1.0.0",
"shasum": ""
},
"require": {
"ext-phar": "*",
"herrera-io/file-system-functions": "1.*",
"php": ">=5.3.3"
},
"require-dev": {
"herrera-io/phpunit-test-case": "1.*",
"mikey179/vfsstream": "1.1.0",
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-0": {
"Herrera\\Box": "src/lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Herrera",
"email": "kevin@herrera.io",
"homepage": "http://kevin.herrera.io"
}
],
"description": "A library for simplifying the PHAR build process.",
"homepage": "http://herrera-io.github.com/php-box",
"keywords": [
"phar"
],
"time": "2013-03-08 19:30:55"
},
{
"name": "herrera-io/file-system-functions",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/herrera-io/php-fs-functions.git",
"reference": "1.0.0"
},
"dist": {
"type": "zip",
"url": "https://github.com/herrera-io/php-fs-functions/archive/1.0.0.zip",
"reference": "1.0.0",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"files": [
"src/lib/fs_functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Herrera",
"email": "kevin@herrera.io",
"homepage": "http://kevin.herrera.io"
}
],
"description": "A collection of file system related functions.",
"homepage": "https://code.herrera.io/php-fs-functions",
"keywords": [
"file",
"functions"
],
"time": "2013-01-20 21:22:52"
},
{
"name": "herrera-io/phpunit-test-case",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/herrera-io/php-phpunit-testcase.git",
"reference": "1.1.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/herrera-io/php-phpunit-testcase/zipball/1.1.0",
"reference": "1.1.0",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
"suggest": {
"phpunit": "For the latest version of PHPUnit 3.7."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-0": {
"Herrera\\PHPUnit": "src/lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Herrera",
"email": "kevin@herrera.io",
"homepage": "http://kevin.herrera.io"
}
],
"description": "A PHPUnit test case class with additional functionality.",
"homepage": "http://herrera-io.github.com/php-phpunit-testcase",
"keywords": [
"phpunit",
"test"
],
"time": "2013-02-20 17:52:43"
},
{
"name": "phpunit/php-code-coverage",
"version": "1.2.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "1.2.9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.9",
"reference": "1.2.9",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.0@stable",
"phpunit/php-text-template": ">=1.1.1@stable",
"phpunit/php-token-stream": ">=1.1.3@stable"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2013-02-26 18:55:56"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.3",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "1.3.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-file-iterator/zipball/1.3.3",
"reference": "1.3.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"File/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2012-10-11 04:44:38"
},
{
"name": "phpunit/php-text-template",
"version": "1.1.4",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-text-template.git",
"reference": "1.1.4"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-text-template/zipball/1.1.4",
"reference": "1.1.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"Text/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2012-10-31 11:15:28"
},
{
"name": "phpunit/php-timer",
"version": "1.0.4",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-timer.git",
"reference": "1.0.4"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-timer/zipball/1.0.4",
"reference": "1.0.4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "http://www.phpunit.de/",
"keywords": [
"timer"
],
"time": "2012-10-11 04:45:58"
},
{
"name": "phpunit/php-token-stream",
"version": "1.1.5",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/php-token-stream.git",
"reference": "1.1.5"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/php-token-stream/zipball/1.1.5",
"reference": "1.1.5",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"tokenizer"
],
"time": "2012-10-11 04:47:14"
},
{
"name": "phpunit/phpunit",
"version": "3.7.18",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3.7.18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.18",
"reference": "3.7.18",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": ">=1.2.1,<1.3.0",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
"phpunit/php-timer": ">=1.0.2,<1.1.0",
"phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0",
"symfony/yaml": ">=2.2.0"
},
"require-dev": {
"pear-pear/pear": "1.9.4"
},
"suggest": {
"ext-json": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*",
"phpunit/php-invoker": ">=1.1.0,<1.2.0"
},
"bin": [
"composer/bin/phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.7.x-dev"
}
},
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2013-03-07 21:45:39"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "1.2.3",
"source": {
"type": "git",
"url": "git://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "1.2.3"
},
"dist": {
"type": "zip",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects/archive/1.2.3.zip",
"reference": "1.2.3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-text-template": ">=1.1.1@stable"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2013-01-13 10:24:48"
},
{
"name": "symfony/yaml",
"version": "v2.2.0",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "v2.2.0-RC3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.0-RC3",
"reference": "v2.2.0-RC3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2013-01-27 16:49:19"
}
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": [
],
"platform": {
"php": ">=5.3.3"
},
"platform-dev": [
]
}
PK ]GMZΜ README.mdnu W+A Amend
=====
[![Build Status](https://secure.travis-ci.org/kherge/Amend.png?branch=master)](http://travis-ci.org/kherge/Amend)
Integrates [Phar Update](https://github.com/herrera-io/php-phar-update) to [Symfony Console](https://github.com/symfony/Console).
Summary
-------
Uses the Phar Update library to:
1. check for newer versions of the Phar
1. download the Phar
- verify download by SHA1 checksum, and public key if available
1. replace running Phar with downloaded update
Installation
------------
Add it to your list of Composer dependencies:
```sh
$ composer require kherge/amend=3.*
```
Usage
-----
```php
setManifestUri('http://box-project.org/manifest.json');
$app = new Application();
$app->getHelperSet()->set(new Helper());
$app->add($command);
```PK ]GMFpE E
.gitignorenu W+A .*
!.gitignore
!.travis.yml
composer.lock
bin/
coverage/
src/vendors/PK ]GMcl src/lib/KevinGH/Amend/Helper.phpnu W+A
*/
class Helper extends Base
{
/**
* The update manager.
*
* @var Manager
*/
private $manager;
/**
* Returns the update manager.
*
* @param string $uri The manifest file URI.
*
* @return Manager The update manager.
*/
public function getManager($uri)
{
return new Manager(Manifest::loadFile($uri));
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'amend';
}
}PK ]GMcp ! src/lib/KevinGH/Amend/Command.phpnu W+A
*/
class Command extends Base
{
/**
* Disable the ability to upgrade?
*
* @var boolean
*/
private $disableUpgrade = true;
/**
* The manifest file URI.
*
* @var string
*/
private $manifestUri;
/**
* {@inheritDoc}
*
* @param string $name The command name.
* @param boolean $disable Disable upgrading?
*/
public function __construct($name, $disable = false)
{
$this->disableUpgrade = $disable;
parent::__construct($name);
}
/**
* Sets the manifest URI.
*
* @param string $uri The URI.
*/
public function setManifestUri($uri)
{
$this->manifestUri = $uri;
}
/**
* @override
*/
protected function configure()
{
$this->setDescription('Updates the application.');
$this->addOption(
'redo',
'r',
InputOption::VALUE_NONE,
'Redownload update if already using current version.'
);
if (false === $this->disableUpgrade) {
$this->addOption(
'upgrade',
'u',
InputOption::VALUE_NONE,
'Upgrade to next major release, if available.'
);
}
}
/**
* @override
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (null === $this->manifestUri) {
throw new LogicException(
'No manifest URI has been configured.'
);
}
$output->writeln('Looking for updates...');
/** @var $amend Helper */
$amend = $this->getHelper('amend');
$manager = $amend->getManager($this->manifestUri);
if ($manager->update(
$this->getApplication()->getVersion(),
$this->disableUpgrade
)){
$output->writeln('Update successful!');
} else {
$output->writeln('Already up-to-date.');
}
}
}PK ]GMu,L L , src/tests/KevinGH/Amend/Tests/HelperTest.phpnu W+A createFile();
file_put_contents($file, '[]');
$this->assertInstanceOf(
'Herrera\\Phar\\Update\\Manager',
$this->helper->getManager($file)
);
}
public function testGetName()
{
$this->assertEquals('amend', $this->helper->getName());
}
protected function setUp()
{
$this->helper = new Helper();
}
}PK ]GMvX - src/tests/KevinGH/Amend/Tests/CommandTest.phpnu W+A command->setManifestUri('http://example.com/test.json');
$this->assertEquals(
'http://example.com/test.json',
$this->getPropertyValue($this->command, 'manifestUri')
);
}
public function testConfigure()
{
$definition = $this->command->getDefinition();
$this->assertTrue($definition->hasOption('redo'));
$this->assertTrue($definition->hasOption('upgrade'));
}
public function testConfigureDisabled()
{
$command = new Command('upgrade', true);
$definition = $command->getDefinition();
$this->assertTrue($definition->hasOption('redo'));
$this->assertFalse($definition->hasOption('upgrade'));
}
public function testExecuteNoManifest()
{
$app = new Application('Test', '1.0.0');
$app->getHelperSet()->set(new Helper());
$app->add(new Command('upgrade'));
$tester = new CommandTester($app->get('upgrade'));
$this->setExpectedException(
'LogicException',
'No manifest URI has been configured.'
);
$tester->execute(array('command' => 'upgrade'));
}
public function testExecute()
{
$_SERVER['argv'][0] = $this->createPhar('a.phar', 'alpha');
$b = $this->createPhar('b.phar', 'beta');
$manifest = $this->createFile();
file_put_contents($manifest, json_encode(array(
array(
'name' => 'a.phar',
'sha1' => sha1_file($b),
'url' => $b,
'version' => '1.2.0'
),
array(
'name' => 'a.phar',
'sha1' => 'abcdef0123abcdef0123abcdef0123abcdef0123',
'url' => 'file:///does/not/exist',
'version' => '2.0.0'
)
)));
$command = new Command('upgrade', true);
$command->setManifestUri($manifest);
$app = new Application('Test', '1.0.0');
$app->getHelperSet()->set(new Helper());
$app->add($command);
$tester = new CommandTester($app->get('upgrade'));
$tester->execute(array('command' => 'upgrade'));
$this->assertRegExp(
'/Update successful!/',
$tester->getDisplay()
);
$this->assertEquals(
'beta',
exec('php ' . escapeshellarg($_SERVER['argv'][0]))
);
}
public function testExecuteCurrent()
{
$manifest = $this->createFile();
file_put_contents($manifest, '[]');
$command = new Command('upgrade', true);
$command->setManifestUri($manifest);
$app = new Application('Test', '1.0.0');
$app->getHelperSet()->set(new Helper());
$app->add($command);
$tester = new CommandTester($app->get('upgrade'));
$tester->execute(array('command' => 'upgrade'));
$this->assertRegExp(
'/Already up-to-date\./',
$tester->getDisplay()
);
}
protected function createPhar($name, $echo)
{
unlink($file = $this->createFile($name));
$box = Box::create($file);
$box->addFromString(
'index.php',
'command = new Command('upgrade');
}
}PK ]GME^ ^ src/tests/load.phpnu W+A add(null, __DIR__);
PK ]GMr2% phpunit.xml.distnu W+A
src/lib/
src/tests/
PK ]GMţ! ! LICENSEnu W+A Copyright (c) 2013 Kevin Herrera
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.PK ]GMa4
composer.jsonnu W+A {
"name": "kherge/amend",
"description": "Integrates Phar Update to Symfony Console.",
"keywords": ["phar", "update", "console"],
"homepage": "http://kherge.github.com/Amend",
"license": "MIT",
"authors": [
{
"name": "Kevin Herrera",
"email": "kevin@herrera.io",
"homepage": "http://kevin.herrera.io"
}
],
"support": {
"issues": "https://github.com/kherge/Amend/issues"
},
"require": {
"php": ">=5.3.3",
"herrera-io/phar-update": "~1.0",
"symfony/console": "~2.1"
},
"require-dev": {
"herrera-io/box": "~1.0",
"herrera-io/phpunit-test-case": "1.*",
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"psr-0": {
"KevinGH\\Amend": "src/lib"
}
},
"config": {
"bin-dir": "bin",
"vendor-dir": "src/vendors"
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}PK ]GM}o o .travis.ymlnu W+A PK ]GM\Gn n
composer.locknu W+A PK ]GMZΜ o README.mdnu W+A PK ]GMFpE E
s .gitignorenu W+A PK ]GMcl *t src/lib/KevinGH/Amend/Helper.phpnu W+A PK ]GMcp ! [w src/lib/KevinGH/Amend/Command.phpnu W+A PK ]GMu,L L , 9 src/tests/KevinGH/Amend/Tests/HelperTest.phpnu W+A PK ]GMvX - src/tests/KevinGH/Amend/Tests/CommandTest.phpnu W+A PK ]GME^ ^ src/tests/load.phpnu W+A PK ]GMr2% phpunit.xml.distnu W+A PK ]GMţ! ! e LICENSEnu W+A PK ]GMa4
composer.jsonnu W+A PK