64 lines
1.7 KiB
Plaintext
Raw Normal View History

2014-07-04 12:15:38 +04:00
#!/usr/bin/env php
2013-07-11 15:47:09 +04:00
<?php
2016-01-11 12:51:59 +07:00
/* (c) Anton Medvedev <anton@medv.io>
2013-07-11 15:47:09 +04:00
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$loaded = false;
2013-07-11 15:47:09 +04:00
2015-06-18 12:41:40 +02:00
foreach ([__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
);
}
2014-07-04 13:39:57 +04:00
// Recipe include path
set_include_path(__DIR__ . '/../' . PATH_SEPARATOR . get_include_path());
// Include function declarations
require_once 'src/functions.php';
2014-12-25 23:29:47 +03:00
// Deployer constants
define('DEPLOYER_BIN', __FILE__);
// Init Deployer
$console = new \Deployer\Console\Application('Deployer', 'master');
$input = new \Symfony\Component\Console\Input\ArgvInput();
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
$deployer = new \Deployer\Deployer($console, $input, $output);
// Require deploy.php script
$options = getopt('f::', ['file::']);
$userSpecifiedFile = null;
if (isset($options['f'])) {
$userSpecifiedFile = $options['f'];
2015-06-18 12:41:40 +02:00
} elseif (isset($options['file'])) {
$userSpecifiedFile = $options['file'];
}
if (empty($userSpecifiedFile)) {
$deployFile = getcwd() . '/deploy.php';
} else {
$deployFile = ($userSpecifiedFile[0] === '/' ? '' : getcwd() . '/') . $userSpecifiedFile;
}
2014-07-04 13:39:57 +04:00
if (is_file($deployFile) && is_readable($deployFile)) {
2014-07-04 13:39:57 +04:00
require $deployFile;
}
// Run Deployer
$deployer->run();