Created
January 24, 2019 13:11
-
-
Save stefpe/2b2212c5b3b0828e3d615ebd8a296616 to your computer and use it in GitHub Desktop.
robo as a framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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