2017-03-22 23:53:23 +07:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Deployer;
|
|
|
|
|
2017-03-23 11:34:52 +07:00
|
|
|
use Deployer\Host\Host;
|
2017-03-22 23:53:23 +07:00
|
|
|
use Symfony\Component\Console\Helper\Table;
|
|
|
|
|
|
|
|
desc('Show current paths');
|
|
|
|
task('config:current', function () {
|
|
|
|
$rows = [];
|
2017-06-23 11:36:51 +07:00
|
|
|
$hosts = Deployer::get()->hosts;
|
2017-03-22 23:53:23 +07:00
|
|
|
|
2017-05-14 22:13:22 +07:00
|
|
|
on($hosts, function (Host $host) use (&$rows) {
|
2017-06-23 11:36:51 +07:00
|
|
|
try {
|
|
|
|
$rows[] = [
|
|
|
|
$host->getHostname(),
|
|
|
|
basename($host->getConfig()->get('current_path')),
|
|
|
|
];
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
$rows[] = [
|
|
|
|
$host->getHostname(),
|
|
|
|
'unknown',
|
|
|
|
];
|
|
|
|
}
|
2017-03-23 11:34:52 +07:00
|
|
|
});
|
2017-03-22 23:53:23 +07:00
|
|
|
|
|
|
|
$table = new Table(output());
|
|
|
|
$table
|
|
|
|
->setHeaders(['Host', 'Current',])
|
|
|
|
->setRows($rows);
|
|
|
|
$table->render();
|
|
|
|
})->local();
|