Skip to content

Commit

Permalink
Moved constants from app/defines.php to app/sprinkles/core/defines.php
Browse files Browse the repository at this point in the history
Those constants are not used by the base system. They should really be 
in the core sprinkle. Less we have in system, and more in core, better 
it is for #830
  • Loading branch information
lcharette committed Jan 27, 2019
1 parent 0e29f17 commit 491db09
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 45 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- Sprinkle list in the bakery `debug` command to uses the new `sprinkle:list` table
- `routerCacheFile` config now only contains filename. Locator is used to find the full path
- Moved some constants from `app/defines.php` to `app/sprinkles/core/defines.php`

### Fix
- Fix for `Test` Bakery command
Expand All @@ -32,6 +33,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Ignore existing `package-lock.json` which caused incorrect dependencies to be installed when upgrading from older versions of UserFrosting.
- Vendor assets not found in production mode

### Deprecated
- `UserFrosting\APP_DIR_NAME` : Use `UserFrosting\APP_DIR` instead.

## 4.2.0-beta.1

### Changed Requirements
Expand Down
46 changes: 9 additions & 37 deletions app/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,21 @@
// The directory containing APP_DIR. Usually, this will contain the entire website.
define('UserFrosting\ROOT_DIR', realpath(__DIR__ . '/..'));

// Directory names
define('UserFrosting\APP_DIR_NAME', basename(__DIR__));
define('UserFrosting\BUILD_DIR_NAME', 'build');
define('UserFrosting\CACHE_DIR_NAME', 'cache');
define('UserFrosting\DB_DIR_NAME', 'database');
define('UserFrosting\SESSION_DIR_NAME', 'sessions');
// Names of app directories
define('UserFrosting\APP_DIR_NAME', basename(__DIR__)); //@deprecated; Use `UserFrosting\APP_DIR` instead
define('UserFrosting\SPRINKLES_DIR_NAME', 'sprinkles');

// Names of src directories within Sprinkles
define('UserFrosting\SRC_DIR_NAME', 'src');

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

// Sprinkles schema file
// Full path to sprinkles schema file
define('UserFrosting\SPRINKLES_SCHEMA_FILE', APP_DIR . DS . 'sprinkles.json');

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 database directory (SQLite only)
define('UserFrosting\DB_DIR', APP_DIR . DS . DB_DIR_NAME);
// Full path to system Bakery commands
define('UserFrosting\BAKERY_SYSTEM_DIR', APP_DIR . DS . 'system' . DS . 'Bakery' . DS . 'Command');

// 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\ROUTE_DIR_NAME', 'routes');
define('UserFrosting\SCHEMA_DIR_NAME', 'schema');
define('UserFrosting\SRC_DIR_NAME', 'src');
define('UserFrosting\TEMPLATE_DIR_NAME', 'templates');
define('UserFrosting\FACTORY_DIR_NAME', 'factories');
define('UserFrosting\PUBLIC_DIR_NAME', 'public');

// Paths for the different class sources
// Relative path from within sprinkle directory
define('UserFrosting\BAKERY_DIR', SRC_DIR_NAME . DS . 'Bakery');

// Path to system Bakery commands
define('UserFrosting\BAKERY_SYSTEM_DIR', APP_DIR_NAME . DS . 'system' . DS . 'Bakery' . DS . 'Command');

// Full path to frontend vendor asset directories
define('UserFrosting\ASSET_DIR', APP_DIR_NAME . DS . ASSET_DIR_NAME);
define('UserFrosting\NPM_ASSET_DIR', ASSET_DIR . DS . 'node_modules');
define('UserFrosting\BROWSERIFIED_ASSET_DIR', ASSET_DIR . DS . 'browser_modules');
define('UserFrosting\BOWER_ASSET_DIR', ASSET_DIR . DS . 'bower_components');
39 changes: 37 additions & 2 deletions app/sprinkles/core/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,43 @@

namespace UserFrosting;

// Names of root directories
define('UserFrosting\BUILD_DIR_NAME', 'build');
define('UserFrosting\PUBLIC_DIR_NAME', 'public');

// Names of app directories
define('UserFrosting\CACHE_DIR_NAME', 'cache');
define('UserFrosting\DB_DIR_NAME', 'database');
define('UserFrosting\LOG_DIR_NAME', 'logs');
define('UserFrosting\SESSION_DIR_NAME', 'sessions');
define('UserFrosting\VENDOR_DIR_NAME', 'vendor');

// Names of directories within Sprinkles
define('UserFrosting\MIGRATIONS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Migrations');
define('UserFrosting\SEEDS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Seeds');
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\ROUTE_DIR_NAME', 'routes');
define('UserFrosting\SCHEMA_DIR_NAME', 'schema');
define('UserFrosting\TEMPLATE_DIR_NAME', 'templates');
define('UserFrosting\FACTORY_DIR_NAME', 'factories');

// Full path to database directory (SQLite only)
define('UserFrosting\DB_DIR', APP_DIR . DS . DB_DIR_NAME);

// Full path to storage directories
define('UserFrosting\STORAGE_DIR', APP_DIR . DS . 'storage');
define('UserFrosting\STORAGE_PUBLIC_DIR', PUBLIC_DIR_NAME . DS . 'files');

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

// Full path to frontend vendor asset directories
define('UserFrosting\ASSET_DIR', APP_DIR . DS . ASSET_DIR_NAME);
define('UserFrosting\NPM_ASSET_DIR', ASSET_DIR . DS . 'node_modules');
define('UserFrosting\BROWSERIFIED_ASSET_DIR', ASSET_DIR . DS . 'browser_modules');
define('UserFrosting\BOWER_ASSET_DIR', ASSET_DIR . DS . 'bower_components');

// Relative path from within sprinkle directory
define('UserFrosting\MIGRATIONS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Migrations');
define('UserFrosting\SEEDS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Seeds');
13 changes: 7 additions & 6 deletions app/sprinkles/core/src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,20 @@ protected function registerStreams()
$locator = $this->ci->locator;

// Register core locator shared streams
$locator->registerStream('cache', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\CACHE_DIR_NAME, true);
$locator->registerStream('config', '', \UserFrosting\DS . \UserFrosting\CONFIG_DIR_NAME);
$locator->registerStream('log', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\LOG_DIR_NAME, true);
$locator->registerStream('migrations', '', \UserFrosting\MIGRATIONS_DIR);
$locator->registerStream('seeds', '', \UserFrosting\SEEDS_DIR);
$locator->registerStream('session', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\SESSION_DIR_NAME, true);
$locator->registerStream('cache', '', \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\CACHE_DIR_NAME, true);
$locator->registerStream('log', '', \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\LOG_DIR_NAME, true);
$locator->registerStream('session', '', \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\SESSION_DIR_NAME, true);

// Register core locator sprinkle streams
$locator->registerStream('config', '', \UserFrosting\DS . \UserFrosting\CONFIG_DIR_NAME);
$locator->registerStream('extra', '', \UserFrosting\DS . \UserFrosting\EXTRA_DIR_NAME);
$locator->registerStream('factories', '', \UserFrosting\DS . \UserFrosting\FACTORY_DIR_NAME);
$locator->registerStream('locale', '', \UserFrosting\DS . \UserFrosting\LOCALE_DIR_NAME);
$locator->registerStream('routes', '', \UserFrosting\DS . \UserFrosting\ROUTE_DIR_NAME);
$locator->registerStream('schema', '', \UserFrosting\DS . \UserFrosting\SCHEMA_DIR_NAME);
$locator->registerStream('templates', '', \UserFrosting\DS . \UserFrosting\TEMPLATE_DIR_NAME);
$locator->registerStream('seeds', '', \UserFrosting\SEEDS_DIR);
$locator->registerStream('migrations', '', \UserFrosting\MIGRATIONS_DIR);

}
}

0 comments on commit 491db09

Please sign in to comment.