Skip to content

Instantly share code, notes, and snippets.

@stefpe
Created January 24, 2019 13:11
Show Gist options
  • Save stefpe/2b2212c5b3b0828e3d615ebd8a296616 to your computer and use it in GitHub Desktop.
Save stefpe/2b2212c5b3b0828e3d615ebd8a296616 to your computer and use it in GitHub Desktop.
robo as a framework
<?php
const APP_NAME = "MyRunner";
const APP_VERSION = '0.0.1';
// If we're running from phar load the phar autoload file.
$pharPath = \Phar::running(true);
if ($pharPath) {
$autoloaderPath = "$pharPath/vendor/autoload.php";
} else {
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
$autoloaderPath = __DIR__ . '/vendor/autoload.php';
} else {
die("Could not find autoloader. Run 'composer install'.");
}
}
$classLoader = require_once $autoloaderPath;
$commandClasses = [\MyRunner\Commands\RoboFile::class];
$statusCode = (new \Robo\Runner($commandClasses))
->setClassLoader($classLoader)
->execute(
$argv,
APP_NAME,
APP_VERSION,
new \Symfony\Component\Console\Output\ConsoleOutput()
);
exit($statusCode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment