Skip to content

Commit 491db09

Browse files
committed
Moved constants from app/defines.php to app/sprinkles/core/defines.php
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
1 parent 0e29f17 commit 491db09

4 files changed

Lines changed: 57 additions & 45 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
### Changed
1515
- Sprinkle list in the bakery `debug` command to uses the new `sprinkle:list` table
1616
- `routerCacheFile` config now only contains filename. Locator is used to find the full path
17+
- Moved some constants from `app/defines.php` to `app/sprinkles/core/defines.php`
1718

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

36+
### Deprecated
37+
- `UserFrosting\APP_DIR_NAME` : Use `UserFrosting\APP_DIR` instead.
38+
3539
## 4.2.0-beta.1
3640

3741
### Changed Requirements

app/defines.php

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,21 @@
2727
// The directory containing APP_DIR. Usually, this will contain the entire website.
2828
define('UserFrosting\ROOT_DIR', realpath(__DIR__ . '/..'));
2929

30-
// Directory names
31-
define('UserFrosting\APP_DIR_NAME', basename(__DIR__));
32-
define('UserFrosting\BUILD_DIR_NAME', 'build');
33-
define('UserFrosting\CACHE_DIR_NAME', 'cache');
34-
define('UserFrosting\DB_DIR_NAME', 'database');
35-
define('UserFrosting\SESSION_DIR_NAME', 'sessions');
30+
// Names of app directories
31+
define('UserFrosting\APP_DIR_NAME', basename(__DIR__)); //@deprecated; Use `UserFrosting\APP_DIR` instead
3632
define('UserFrosting\SPRINKLES_DIR_NAME', 'sprinkles');
3733

34+
// Names of src directories within Sprinkles
35+
define('UserFrosting\SRC_DIR_NAME', 'src');
36+
3837
// Full path to Sprinkles directory
3938
define('UserFrosting\SPRINKLES_DIR', APP_DIR . DS . SPRINKLES_DIR_NAME);
4039

41-
// Sprinkles schema file
40+
// Full path to sprinkles schema file
4241
define('UserFrosting\SPRINKLES_SCHEMA_FILE', APP_DIR . DS . 'sprinkles.json');
4342

44-
define('UserFrosting\LOG_DIR_NAME', 'logs');
45-
define('UserFrosting\VENDOR_DIR_NAME', 'vendor');
46-
47-
// Full path to Composer's vendor directory
48-
define('UserFrosting\VENDOR_DIR', APP_DIR . DS . VENDOR_DIR_NAME);
49-
50-
// Full path to database directory (SQLite only)
51-
define('UserFrosting\DB_DIR', APP_DIR . DS . DB_DIR_NAME);
43+
// Full path to system Bakery commands
44+
define('UserFrosting\BAKERY_SYSTEM_DIR', APP_DIR . DS . 'system' . DS . 'Bakery' . DS . 'Command');
5245

53-
// Names of directories within Sprinkles
54-
define('UserFrosting\ASSET_DIR_NAME', 'assets');
55-
define('UserFrosting\EXTRA_DIR_NAME', 'extra');
56-
define('UserFrosting\CONFIG_DIR_NAME', 'config');
57-
define('UserFrosting\LOCALE_DIR_NAME', 'locale');
58-
define('UserFrosting\ROUTE_DIR_NAME', 'routes');
59-
define('UserFrosting\SCHEMA_DIR_NAME', 'schema');
60-
define('UserFrosting\SRC_DIR_NAME', 'src');
61-
define('UserFrosting\TEMPLATE_DIR_NAME', 'templates');
62-
define('UserFrosting\FACTORY_DIR_NAME', 'factories');
63-
define('UserFrosting\PUBLIC_DIR_NAME', 'public');
64-
65-
// Paths for the different class sources
46+
// Relative path from within sprinkle directory
6647
define('UserFrosting\BAKERY_DIR', SRC_DIR_NAME . DS . 'Bakery');
67-
68-
// Path to system Bakery commands
69-
define('UserFrosting\BAKERY_SYSTEM_DIR', APP_DIR_NAME . DS . 'system' . DS . 'Bakery' . DS . 'Command');
70-
71-
// Full path to frontend vendor asset directories
72-
define('UserFrosting\ASSET_DIR', APP_DIR_NAME . DS . ASSET_DIR_NAME);
73-
define('UserFrosting\NPM_ASSET_DIR', ASSET_DIR . DS . 'node_modules');
74-
define('UserFrosting\BROWSERIFIED_ASSET_DIR', ASSET_DIR . DS . 'browser_modules');
75-
define('UserFrosting\BOWER_ASSET_DIR', ASSET_DIR . DS . 'bower_components');

app/sprinkles/core/defines.php

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,43 @@
99

1010
namespace UserFrosting;
1111

12+
// Names of root directories
13+
define('UserFrosting\BUILD_DIR_NAME', 'build');
14+
define('UserFrosting\PUBLIC_DIR_NAME', 'public');
15+
16+
// Names of app directories
17+
define('UserFrosting\CACHE_DIR_NAME', 'cache');
18+
define('UserFrosting\DB_DIR_NAME', 'database');
19+
define('UserFrosting\LOG_DIR_NAME', 'logs');
20+
define('UserFrosting\SESSION_DIR_NAME', 'sessions');
21+
define('UserFrosting\VENDOR_DIR_NAME', 'vendor');
22+
1223
// Names of directories within Sprinkles
13-
define('UserFrosting\MIGRATIONS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Migrations');
14-
define('UserFrosting\SEEDS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Seeds');
24+
define('UserFrosting\ASSET_DIR_NAME', 'assets');
25+
define('UserFrosting\EXTRA_DIR_NAME', 'extra');
26+
define('UserFrosting\CONFIG_DIR_NAME', 'config');
27+
define('UserFrosting\LOCALE_DIR_NAME', 'locale');
28+
define('UserFrosting\ROUTE_DIR_NAME', 'routes');
29+
define('UserFrosting\SCHEMA_DIR_NAME', 'schema');
30+
define('UserFrosting\TEMPLATE_DIR_NAME', 'templates');
31+
define('UserFrosting\FACTORY_DIR_NAME', 'factories');
32+
33+
// Full path to database directory (SQLite only)
34+
define('UserFrosting\DB_DIR', APP_DIR . DS . DB_DIR_NAME);
35+
36+
// Full path to storage directories
1537
define('UserFrosting\STORAGE_DIR', APP_DIR . DS . 'storage');
1638
define('UserFrosting\STORAGE_PUBLIC_DIR', PUBLIC_DIR_NAME . DS . 'files');
39+
40+
// Full path to Composer's vendor directory
41+
define('UserFrosting\VENDOR_DIR', APP_DIR . DS . VENDOR_DIR_NAME);
42+
43+
// Full path to frontend vendor asset directories
44+
define('UserFrosting\ASSET_DIR', APP_DIR . DS . ASSET_DIR_NAME);
45+
define('UserFrosting\NPM_ASSET_DIR', ASSET_DIR . DS . 'node_modules');
46+
define('UserFrosting\BROWSERIFIED_ASSET_DIR', ASSET_DIR . DS . 'browser_modules');
47+
define('UserFrosting\BOWER_ASSET_DIR', ASSET_DIR . DS . 'bower_components');
48+
49+
// Relative path from within sprinkle directory
50+
define('UserFrosting\MIGRATIONS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Migrations');
51+
define('UserFrosting\SEEDS_DIR', SRC_DIR_NAME . DS . 'Database' . DS . 'Seeds');

app/sprinkles/core/src/Core.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,20 @@ protected function registerStreams()
122122
$locator = $this->ci->locator;
123123

124124
// Register core locator shared streams
125-
$locator->registerStream('cache', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\CACHE_DIR_NAME, true);
126-
$locator->registerStream('config', '', \UserFrosting\DS . \UserFrosting\CONFIG_DIR_NAME);
127-
$locator->registerStream('log', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\LOG_DIR_NAME, true);
128-
$locator->registerStream('migrations', '', \UserFrosting\MIGRATIONS_DIR);
129-
$locator->registerStream('seeds', '', \UserFrosting\SEEDS_DIR);
130-
$locator->registerStream('session', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\SESSION_DIR_NAME, true);
125+
$locator->registerStream('cache', '', \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\CACHE_DIR_NAME, true);
126+
$locator->registerStream('log', '', \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\LOG_DIR_NAME, true);
127+
$locator->registerStream('session', '', \UserFrosting\APP_DIR . \UserFrosting\DS . \UserFrosting\SESSION_DIR_NAME, true);
131128

132129
// Register core locator sprinkle streams
130+
$locator->registerStream('config', '', \UserFrosting\DS . \UserFrosting\CONFIG_DIR_NAME);
133131
$locator->registerStream('extra', '', \UserFrosting\DS . \UserFrosting\EXTRA_DIR_NAME);
134132
$locator->registerStream('factories', '', \UserFrosting\DS . \UserFrosting\FACTORY_DIR_NAME);
135133
$locator->registerStream('locale', '', \UserFrosting\DS . \UserFrosting\LOCALE_DIR_NAME);
136134
$locator->registerStream('routes', '', \UserFrosting\DS . \UserFrosting\ROUTE_DIR_NAME);
137135
$locator->registerStream('schema', '', \UserFrosting\DS . \UserFrosting\SCHEMA_DIR_NAME);
138136
$locator->registerStream('templates', '', \UserFrosting\DS . \UserFrosting\TEMPLATE_DIR_NAME);
137+
$locator->registerStream('seeds', '', \UserFrosting\SEEDS_DIR);
138+
$locator->registerStream('migrations', '', \UserFrosting\MIGRATIONS_DIR);
139+
139140
}
140141
}

0 commit comments

Comments
 (0)