2014-07-07 09:22:03 +04:00

54 lines
1.6 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
/* (c) Anton Medvedev <anton@elfet.ru>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$loaded = false;
foreach (array(__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php') as $file) {
if (file_exists($file)) {
require $file;
$loaded = true;
break;
}
}
if (!$loaded) {
die(
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
'wget http://getcomposer.org/composer.phar' . PHP_EOL .
'php composer.phar install' . PHP_EOL
);
}
// Recipe include path
set_include_path(__DIR__ . '/../');
$deployFile = getcwd() . '/deploy.php';
if (is_file($deployFile) && is_readable($deployFile)) {
// Init Deployer
$deployer = new \Deployer\Deployer(
new \Symfony\Component\Console\Application('Deployer', '1.0.0'),
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());
// Run Deployer
$deployer->run();
} else {
echo "deploy.php file does not found.\n";
}