2017-10-19 19:42:54 -04:00
|
|
|
#!/usr/bin/env php
|
2014-01-12 15:42:25 -05:00
|
|
|
<?php
|
2015-03-16 09:23:51 -04:00
|
|
|
error_reporting(E_ALL | E_STRICT);
|
|
|
|
|
2017-10-19 19:42:54 -04:00
|
|
|
$baseDir = dirname(__DIR__);
|
2017-11-13 16:09:59 -05:00
|
|
|
$cwd = getcwd();
|
2017-10-19 19:42:54 -04:00
|
|
|
$templatePath = $baseDir . '/templates';
|
|
|
|
$consoleTemplatePath = $baseDir . '/src/Resume/Templates';
|
|
|
|
|
2018-06-27 20:23:04 -04:00
|
|
|
// When md2resume is used as a dependency with composer, it resides in the
|
|
|
|
// 'vendor/markdown-resume' directory. This means that the 'autoload.php' is
|
|
|
|
// actually much higher in the directory tree than is normally expected.
|
|
|
|
$autoloadPath = (strpos($baseDir, 'vendor')) ? realpath($baseDir . '/../../autoload.php') : $baseDir . '/vendor/autoload.php';
|
2017-11-13 16:09:29 -05:00
|
|
|
|
2015-03-16 09:23:51 -04:00
|
|
|
// If the dependencies aren't installed, we have to bail and offer some help.
|
2017-11-13 15:10:37 -05:00
|
|
|
if (!file_exists($autoloadPath)) {
|
|
|
|
exit("\nThe dependency '$autoloadPath' was not found. Please run `composer install` to install dependencies.\n\n");
|
2015-03-16 09:23:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bootstrap our application with the Composer autoloader
|
2017-11-13 16:09:29 -05:00
|
|
|
$app = include $autoloadPath;
|
2015-03-16 09:23:51 -04:00
|
|
|
|
|
|
|
// Setup the namespace for our own namespace
|
2017-10-19 19:42:54 -04:00
|
|
|
$app->add('Resume', $baseDir . '/src');
|
2015-03-16 09:23:51 -04:00
|
|
|
|
|
|
|
// Instantiate our Console application
|
|
|
|
$console = new Resume\Cli\Resume();
|
|
|
|
|
2017-10-19 19:42:54 -04:00
|
|
|
// Fetch the version
|
|
|
|
chdir($baseDir);
|
2017-11-13 16:29:33 -05:00
|
|
|
$versionCmd = 'git describe --abbrev=0 --tags 2>/dev/null';
|
2017-10-19 19:42:54 -04:00
|
|
|
$version = trim(shell_exec($versionCmd));
|
2017-11-13 16:09:59 -05:00
|
|
|
chdir($cwd);
|
2015-03-16 09:23:51 -04:00
|
|
|
|
2017-10-19 19:42:54 -04:00
|
|
|
// Fetch the project name and description
|
|
|
|
$project = json_decode(file_get_contents(__DIR__ . '/../composer.json'));
|
|
|
|
$project->version = $version;
|
2015-03-16 09:23:51 -04:00
|
|
|
|
|
|
|
// Init the app with these params
|
|
|
|
$console->initialize($templatePath, $consoleTemplatePath, $project);
|
|
|
|
|
|
|
|
// Execute the console app.
|
|
|
|
$console->run();
|
|
|
|
|
|
|
|
/* End of resume.php */
|