Allow to start Deployer console app if there are no deploy.php file.

This commit is contained in:
Elfet 2014-07-07 17:44:06 +04:00
parent c92a022053
commit 6a673a7bd2

36
bin/dep
View File

@ -27,28 +27,26 @@ if (!$loaded) {
// Recipe include path
set_include_path(__DIR__ . '/../');
// Init Deployer
$deployer = new \Deployer\Deployer(
new \Symfony\Component\Console\Application('Deployer', '__VERSION__'),
new \Symfony\Component\Console\Input\ArgvInput(),
new \Symfony\Component\Console\Output\ConsoleOutput()
);
// Require current deploy.php script
$deployFile = getcwd() . '/deploy.php';
if (is_file($deployFile) && is_readable($deployFile)) {
// Init Deployer
$deployer = new \Deployer\Deployer(
new \Symfony\Component\Console\Application('Deployer', '__VERSION__'),
new \Symfony\Component\Console\Input\ArgvInput(),
new \Symfony\Component\Console\Output\ConsoleOutput()
);
// Require current deploy.php script
require $deployFile;
}
// Self-update command
$selfUpdate = new \KevinGH\Amend\Command('self-update');
$selfUpdate->setDescription('Updates deployer.phar to the latest version');
$selfUpdate->setManifestUri('https://raw.github.com/elfet/deployer/master/manifest.json');
$deployer->getConsole()->add($selfUpdate);
$deployer->getHelperSet()->set(new \KevinGH\Amend\Helper());
// Self-update command
$selfUpdate = new \KevinGH\Amend\Command('self-update');
$selfUpdate->setDescription('Updates deployer.phar to the latest version');
$selfUpdate->setManifestUri('https://raw.github.com/elfet/deployer/master/manifest.json');
$deployer->getConsole()->add($selfUpdate);
$deployer->getHelperSet()->set(new \KevinGH\Amend\Helper());
// Run Deployer
$deployer->run();
} else {
echo "deploy.php file does not found.\n";
}
// Run Deployer
$deployer->run();