mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-23 08:45:04 +01:00
66 lines
1.7 KiB
PHP
Executable File
66 lines
1.7 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
/* (c) Anton Medvedev <anton@medv.io>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
define("DEPLOYER", 1);
|
|
|
|
$loaded = false;
|
|
|
|
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
|
|
);
|
|
}
|
|
|
|
// Recipe include path
|
|
set_include_path(__DIR__ . '/../' . PATH_SEPARATOR . get_include_path());
|
|
|
|
// Include function declarations
|
|
require_once 'src/functions.php';
|
|
|
|
// 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'];
|
|
} elseif (isset($options['file'])) {
|
|
$userSpecifiedFile = $options['file'];
|
|
}
|
|
|
|
if (empty($userSpecifiedFile)) {
|
|
$deployFile = getcwd() . '/deploy.php';
|
|
} else {
|
|
$deployFile = ($userSpecifiedFile[0] === '/' ? '' : getcwd() . '/') . $userSpecifiedFile;
|
|
}
|
|
|
|
if (is_file($deployFile) && is_readable($deployFile)) {
|
|
require $deployFile;
|
|
}
|
|
|
|
// Run Deployer
|
|
$deployer->run();
|