mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
Merge pull request #171 from tomzx/refactor/move-self-update-to-application
Move the self-update command configuration in the Application class.
This commit is contained in:
commit
d05dc4b9ff
13
bin/dep
13
bin/dep
@ -44,27 +44,20 @@ $options = getopt('f::', ['file::']);
|
||||
$userSpecifiedFile = null;
|
||||
|
||||
if (isset($options['f'])) {
|
||||
$userSpecifiedFile = $options['f'];
|
||||
$userSpecifiedFile = $options['f'];
|
||||
} else if (isset($options['file'])) {
|
||||
$userSpecifiedFile = $options['file'];
|
||||
$userSpecifiedFile = $options['file'];
|
||||
}
|
||||
|
||||
if (empty($userSpecifiedFile)) {
|
||||
$deployFile = getcwd() . '/deploy.php';
|
||||
} else {
|
||||
$deployFile = ($userSpecifiedFile[0] === '/' ? '' : getcwd() . '/') . $userSpecifiedFile;
|
||||
$deployFile = ($userSpecifiedFile[0] === '/' ? '' : getcwd() . '/') . $userSpecifiedFile;
|
||||
}
|
||||
|
||||
if (is_file($deployFile) && is_readable($deployFile)) {
|
||||
require $deployFile;
|
||||
}
|
||||
|
||||
// Self-update command
|
||||
$selfUpdate = new \KevinGH\Amend\Command('self-update');
|
||||
$selfUpdate->setDescription('Updates deployer.phar to the latest version');
|
||||
$selfUpdate->setManifestUri('http://deployer.org/manifest.json');
|
||||
$console->add($selfUpdate);
|
||||
$console->getHelperSet()->set(new \KevinGH\Amend\Helper());
|
||||
|
||||
// Run Deployer
|
||||
$deployer->run();
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
namespace Deployer\Console;
|
||||
|
||||
use KevinGH\Amend\Command;
|
||||
use KevinGH\Amend\Helper;
|
||||
use Symfony\Component\Console\Application as Console;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
@ -23,4 +25,25 @@ class Application extends Console
|
||||
return $inputDefinition;
|
||||
}
|
||||
|
||||
}
|
||||
protected function getDefaultCommands()
|
||||
{
|
||||
$commands = parent::getDefaultCommands();
|
||||
$commands[] = $this->selfUpdateCommand();
|
||||
return $commands;
|
||||
}
|
||||
|
||||
private function selfUpdateCommand()
|
||||
{
|
||||
$selfUpdate = new Command('self-update');
|
||||
$selfUpdate->setDescription('Updates deployer.phar to the latest version');
|
||||
$selfUpdate->setManifestUri('http://deployer.org/manifest.json');
|
||||
return $selfUpdate;
|
||||
}
|
||||
|
||||
protected function getDefaultHelperSet()
|
||||
{
|
||||
$helperSet = parent::getDefaultHelperSet();
|
||||
$helperSet->set(new Helper());
|
||||
return $helperSet;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user