From 7cd81124a93c06ab92c4a024119359cc9e8db031 Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 13 Sep 2021 23:41:55 +0300 Subject: [PATCH] feat(console): update flextype bin script #543 --- bin/flextype | 56 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/bin/flextype b/bin/flextype index 91204032..ff3c15dc 100755 --- a/bin/flextype +++ b/bin/flextype @@ -1,12 +1,58 @@ #!/usr/bin/env php run(); \ No newline at end of file +/** + * Define the PATH (without trailing slash). + */ +define('PATH', [ + 'project' => ROOT_DIR . '/project', + 'tmp' => ROOT_DIR . '/var/tmp', +]); + +/** + * Check PHP Version + */ +version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least PHP %s to run.', $ver, $req)); + +/** + * Ensure vendor libraries exist + */ +! is_file($flextypeAutoload = ROOT_DIR . '/vendor/autoload.php') and exit('Please run: composer install for flextype'); + +/** + * Register The Auto Loader + * + * Composer provides a convenient, automatically generated class loader for + * our application. We just need to utilize it! We'll simply require it + * into the script here so that we don't have to worry about manual + * loading any of our classes later on. It feels nice to relax. + * Register The Auto Loader + */ +$flextypeLoader = require_once $flextypeAutoload; + +/** + * Bootstraps the Flextype + * + * This bootstraps the Flextype and gets it ready for use, then it + * will load up this application so that we can run it and send + * the responses back to the browser and delight our users. + */ + +require_once ROOT_DIR . '/src/flextype/flextype.php'; \ No newline at end of file