-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
31 additions
and
8,345 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
# Gitignore for Capro Core (not for sites) | ||
# Gitignore for the Capro BUILD repo. | ||
/.vscode | ||
/vendor/ | ||
/cache/ | ||
/config/ | ||
/content/ | ||
/views/ | ||
/static/ | ||
/public/ | ||
/vendor | ||
/build | ||
/public | ||
/config | ||
/static | ||
/views | ||
/.env | ||
/tmp* | ||
.capro-cache* | ||
.php-cs-fixer.cache | ||
desktop.ini | ||
/.env | ||
/demo* | ||
/.box_dump/ |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,6 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
// Start Timer | ||
use xy2z\Capro\Commands\CommandBuild; | ||
use xy2z\Capro\Commands\CommandNewSite; | ||
use xy2z\Capro\Commands\CommandConfig; | ||
use xy2z\Capro\Commands\CommandServe; | ||
use xy2z\Capro\Config; | ||
Phar::loadPhar(__DIR__ . '/capro.phar', 'capro.phar'); | ||
|
||
// Call bootstrap to check if we should use capro shortcut for vendor/bin/capro. | ||
require __DIR__ . '/src/capro_bootstrap.php'; | ||
|
||
// Prepare | ||
// Check if we are in a project dir | ||
if (file_exists(__DIR__ . '/vendor/autoload.php')) { | ||
// Development (when developing/testing this project), | ||
// using `php capro <cmd>` | ||
require __DIR__ . '/vendor/autoload.php'; | ||
define('CAPRO_SITE_ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR); | ||
} | ||
|
||
if (file_exists(__DIR__ . '/../../autoload.php')) { | ||
// For sites that is using this using vendor/bin | ||
// Also for global installed.. | ||
require __DIR__ . '/../../autoload.php'; | ||
define('CAPRO_SITE_ROOT_DIR', __DIR__ . '/../../../'); // go back 3 dirs (/vendor/xy2z/capro/) | ||
} | ||
|
||
if (!defined('CAPRO_SITE_ROOT_DIR')) { | ||
echo 'Error: Composer autoload.php was not found. (try "composer install")' . PHP_EOL; | ||
exit(1); | ||
} | ||
|
||
// This is required to make the classes available in the Blade views. | ||
class_alias('xy2z\Capro\Capro', 'Capro'); | ||
|
||
// Load env (before config) | ||
if (file_exists(CAPRO_SITE_ROOT_DIR . '.env')) { | ||
// Load .env file | ||
$dotenv = Dotenv\Dotenv::createImmutable(CAPRO_SITE_ROOT_DIR); | ||
try { | ||
$dotenv->load(); | ||
} catch (Exception $e) { | ||
// Do nothing | ||
tell_error('Invalid .env file. Error message: ' . $e->getMessage()); | ||
} | ||
} | ||
|
||
// Load config | ||
define('CAPRO_CONFIG_DIR', CAPRO_SITE_ROOT_DIR . 'config'); | ||
if (is_dir(CAPRO_CONFIG_DIR)) { | ||
Config::load_capro_config(); | ||
// } else { | ||
// tell('Notice: Config dir not found: ' . CAPRO_CONFIG_DIR); // verbose. (but never for global composer "capro" commands.) | ||
} | ||
|
||
// Set CONSTANTS from Config (or use defaults) -- after loading config. | ||
// Cant use realpath() here because the directories might not exist yet. | ||
define('CAPRO_PUBLIC_DIR', CAPRO_SITE_ROOT_DIR . Config::get('core.public_dir', 'public')); | ||
define('CAPRO_VIEWS_DIR', CAPRO_SITE_ROOT_DIR . Config::get('core.views_dir', 'views')); | ||
define('CAPRO_VIEWS_CACHE_DIR', CAPRO_SITE_ROOT_DIR . Config::get('core.views_cache_dir', 'views/cache')); | ||
define('CAPRO_STATIC_DIR', CAPRO_SITE_ROOT_DIR . Config::get('core.static_dir', 'static')); | ||
|
||
// Check if command argument is set. | ||
$command = $argv[1] ?? null; | ||
if (isset($command)) { | ||
$command = strtolower($command); | ||
} else { | ||
tell('Need a command.'); | ||
exit; | ||
} | ||
|
||
// Run command. | ||
match ($command) { | ||
'build', 'b' => (new CommandBuild($argv))->run(), | ||
'new' => (new CommandNewSite($argv))->run(), | ||
'config' => (new CommandConfig($argv))->run(), | ||
'serve' => (new CommandServe($argv))->run(), | ||
'where' => tell(__DIR__), | ||
'-v', 'v', '--version', 'version' => tell(CAPRO_VERSION), | ||
default => tell('Unknown command.'), | ||
}; | ||
require 'phar://capro.phar/capro'; |
Binary file not shown.
This file contains 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
Oops, something went wrong.