Permalink
Browse files

Add self update capabitilies

  • Loading branch information...
MattKetmo committed Jul 1, 2013
1 parent ad2fc07 commit b3555f4c81f27002893845d96fb69a79f757f47d
Showing with 307 additions and 3 deletions.
  1. +1 −0 bin/cliph
  2. +2 −1 box.json
  3. +2 −1 composer.json
  4. +274 −1 composer.lock
  5. +28 −0 src/Cliph/Command/UpdateCommand.php
@@ -8,4 +8,5 @@ use Symfony\Component\Console\Application;
$application = new Application('Cliph', '@package_version@');
$application->add(new Command\HelloCommand());
$application->add(new Command\UpdateCommand());
$application->run();
@@ -4,7 +4,8 @@
"src"
],
"files": [
"LICENSE"
"LICENSE",
"vendor/herrera-io/phar-update/res/schema.json"
],
"finder": [
{
@@ -3,7 +3,8 @@
"description": "Example of CLI app in PHP",
"license": "MIT",
"require": {
"symfony/console": "~2.3"
"symfony/console": "~2.3",
"herrera-io/phar-update": "~1.0"
},
"autoload": {
"psr-0": {

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,28 @@
<?php
namespace Cliph\Command;
use Herrera\Phar\Update\Manager;
use Herrera\Phar\Update\Manifest;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class UpdateCommand extends Command
{
const MANIFEST_FILE = 'http://mattketmo.github.io/cliph/manifest.json';
protected function configure()
{
$this
->setName('update')
->setDescription('Updates cliph.phar to the latest version')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$manager = new Manager(Manifest::loadFile(self::MANIFEST_FILE));
$manager->update($this->getApplication()->getVersion(), true);
}
}

0 comments on commit b3555f4

Please sign in to comment.