Skip to content

Commit

Permalink
add SPRINKLES_DIR path constant
Browse files Browse the repository at this point in the history
  • Loading branch information
alexweissman committed Jun 20, 2017
1 parent e2ea66d commit 300efb4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
22 changes: 14 additions & 8 deletions app/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace UserFrosting;

// Some standard defines
define('UserFrosting\VERSION', '4.1.0-alpha');
define('UserFrosting\VERSION', '4.1.1-alpha');
define('UserFrosting\DS', '/');
define('UserFrosting\PHP_MIN_VERSION', '5.6');
define('UserFrosting\DEBUG_CONFIG', false);
Expand All @@ -18,21 +18,27 @@
// The directory containing APP_DIR. Usually, this will contain the entire website.
define('UserFrosting\ROOT_DIR', realpath(__DIR__ . '/..'));

// Composer's vendor directory
define('UserFrosting\VENDOR_DIR', APP_DIR . '/vendor');

define('UserFrosting\APP_DIR_NAME', basename(__DIR__));
define('UserFrosting\ASSET_DIR_NAME', 'assets');
define('UserFrosting\BUILD_DIR_NAME', 'build');
define('UserFrosting\CACHE_DIR_NAME', 'cache');
define('UserFrosting\EXTRA_DIR_NAME', 'extra');
define('UserFrosting\SESSION_DIR_NAME', 'sessions');
define('UserFrosting\SPRINKLES_DIR_NAME', 'sprinkles');
define('UserFrosting\LOG_DIR_NAME', 'logs');
define('UserFrosting\VENDOR_DIR_NAME', 'vendor');

// Full path to Composer's vendor directory
define('UserFrosting\VENDOR_DIR', APP_DIR . DS . VENDOR_DIR_NAME);

// Full path to Sprinkles directory
define('UserFrosting\SPRINKLES_DIR', APP_DIR . DS . SPRINKLES_DIR_NAME);

// Names of directories within Sprinkles
define('UserFrosting\ASSET_DIR_NAME', 'assets');
define('UserFrosting\EXTRA_DIR_NAME', 'extra');
define('UserFrosting\CONFIG_DIR_NAME', 'config');
define('UserFrosting\LOCALE_DIR_NAME', 'locale');
define('UserFrosting\LOG_DIR_NAME', 'logs');
define('UserFrosting\ROUTE_DIR_NAME', 'routes');
define('UserFrosting\SCHEMA_DIR_NAME', 'schema');
define('UserFrosting\SRC_DIR_NAME', 'src');
define('UserFrosting\SPRINKLES_DIR_NAME', 'sprinkles');
define('UserFrosting\TEMPLATE_DIR_NAME', 'templates');
define('UserFrosting\FACTORY_DIR_NAME', 'factories');
5 changes: 2 additions & 3 deletions app/sprinkles/core/src/ServicesProvider/ServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function register(ContainerInterface $container)
* Assets are Javascript, CSS, image, and other files used by your site.
*/
$container['assetLoader'] = function ($c) {
$basePath = \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\SPRINKLES_DIR_NAME;
$basePath = \UserFrosting\SPRINKLES_DIR;
$pattern = "/^[A-Za-z0-9_\-]+\/assets\//";

$al = new AssetLoader($basePath, $pattern);
Expand Down Expand Up @@ -612,8 +612,7 @@ public function register(ContainerInterface $container)

// Add Sprinkles' templates namespaces
foreach ($sprinkles as $sprinkle) {
$path = \UserFrosting\APP_DIR . \UserFrosting\DS .
\UserFrosting\SPRINKLES_DIR_NAME . \UserFrosting\DS .
$path = \UserFrosting\SPRINKLES_DIR . \UserFrosting\DS .
$sprinkle . \UserFrosting\DS .
\UserFrosting\TEMPLATE_DIR_NAME . \UserFrosting\DS;

Expand Down
4 changes: 2 additions & 2 deletions app/sprinkles/core/src/Util/CheckEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function checkPermissions()
if ($this->isProduction()) {
// Should be write-protected in production!
$shouldBeWriteable = array_merge($shouldBeWriteable, [
\UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\SPRINKLES_DIR_NAME => false,
\UserFrosting\SPRINKLES_DIR => false,
\UserFrosting\VENDOR_DIR => false
]);
}
Expand Down Expand Up @@ -320,7 +320,7 @@ public function checkPhp()
} else {
$this->resultsSuccess['phpVersion'] = [
"title" => "<i class='fa fa-code fa-fw'></i> PHP version checks out!",
"message" => "You're using PHP " . \UserFrosting\PHP_MIN_VERSION . ". Great!",
"message" => "You're using PHP " . \UserFrosting\PHP_MIN_VERSION . "or higher. Great!",
"success" => true
];
}
Expand Down
4 changes: 1 addition & 3 deletions app/system/Bakery/Bakery.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ protected function getBakeryCommands()
*/
protected function commandDirectoryPath($sprinkleName)
{
return \UserFrosting\APP_DIR .
\UserFrosting\DS .
\UserFrosting\SPRINKLES_DIR_NAME .
return \UserFrosting\SPRINKLES_DIR .
\UserFrosting\DS .
$sprinkleName .
\UserFrosting\DS .
Expand Down
4 changes: 2 additions & 2 deletions app/system/Bakery/Command/BuildAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->io->title("UserFrosting's Assets Builder");

// Set $path
$this->buildPath = $this->projectRoot . "/build";
$this->buildPath = $this->projectRoot . \UserFrosting\DS . \UserFrosting\BUILD_DIR_NAME;

// Delete cached data is requested
if ($input->getOption('force')) {
Expand Down Expand Up @@ -128,7 +128,7 @@ protected function checkAssets()
$this->io->section("Testing assets installation");

// Get path and vendor files
$vendorPath = \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\SPRINKLES_DIR_NAME . "/core/assets/vendor/*";
$vendorPath = \UserFrosting\SPRINKLES_DIR . "/core/assets/vendor/*";
$coreVendorFiles = glob($vendorPath);

if (!$coreVendorFiles){
Expand Down
4 changes: 1 addition & 3 deletions app/system/Bakery/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,7 @@ protected function setupVersionTable()
*/
protected function migrationDirectoryPath($sprinkleName)
{
$path = \UserFrosting\APP_DIR .
\UserFrosting\DS .
\UserFrosting\SPRINKLES_DIR_NAME .
$path = \UserFrosting\SPRINKLES_DIR .
\UserFrosting\DS .
$sprinkleName .
\UserFrosting\DS .
Expand Down

0 comments on commit 300efb4

Please sign in to comment.