Skip to content

Commit cae9d15

Browse files
Resolved merge conflict.
2 parents 66c012e + 0e29f17 commit cae9d15

10 files changed

Lines changed: 53 additions & 42 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313

1414
### Changed
1515
- Sprinkle list in the bakery `debug` command to uses the new `sprinkle:list` table
16+
- `routerCacheFile` config now only contains filename. Locator is used to find the full path
1617

1718
### Fix
1819
- Fix for `Test` Bakery command
@@ -29,6 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2930
- Added `JsonException` if `sprinkles.json` doesn't contain valid json.
3031
- Added specific tests for sprinkleManager with 100% test coverage
3132
- Ignore existing `package-lock.json` which caused incorrect dependencies to be installed when upgrading from older versions of UserFrosting.
33+
- Vendor assets not found in production mode
3234

3335
## 4.2.0-beta.1
3436

app/defines.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace UserFrosting;
1111

1212
// Some standard defines
13-
define('UserFrosting\VERSION', '4.2.0-beta.1');
13+
define('UserFrosting\VERSION', '4.2.0-beta.2');
1414
define('UserFrosting\DS', '/');
1515
define('UserFrosting\PHP_MIN_VERSION', '5.6');
1616
define('UserFrosting\PHP_RECOMMENDED_VERSION', '7.1');

app/sprinkles/core/config/production.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Use router cache, disable full error details
3636
*/
3737
'settings' => [
38-
'routerCacheFile' => \UserFrosting\ROOT_DIR . '/' . \UserFrosting\APP_DIR_NAME . '/' . \UserFrosting\CACHE_DIR_NAME . '/' . 'routes.cache',
38+
'routerCacheFile' => 'routes.cache',
3939
'displayErrorDetails' => false
4040
],
4141
/*

app/sprinkles/core/src/Bakery/BakeCommand.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
*/
2222
class BakeCommand extends BaseCommand
2323
{
24-
/**
25-
* @var string Path to the build/ directory
26-
*/
27-
protected $buildPath;
28-
2924
/**
3025
* @var string The UserFrosting ASCII art.
3126
*/
@@ -46,7 +41,7 @@ protected function configure()
4641
{
4742
$this->setName('bake')
4843
->setDescription('UserFrosting installation command')
49-
->setHelp('This command combine the <info>debug</info>, <info>migrate</info> and <info>build-assets</info> commands.');
44+
->setHelp('This command combine the <info>setup:db</info>, <info>setup:smtp</info>, <info>debug</info>, <info>migrate</info>, <info>create-admin</info> and <info>build-assets</info> commands.');
5045
}
5146

5247
/**

app/sprinkles/core/src/Bakery/BuildAssets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8282
*/
8383
protected function npmInstall($force)
8484
{
85-
$this->io->section('<info>Installing npm dependencies</info>');
85+
$this->io->section('Installing npm dependencies');
8686
$this->io->writeln('> <comment>npm install</comment>');
8787

8888
// Temporarily change the working directory so we can install npm dependencies
@@ -96,7 +96,7 @@ protected function npmInstall($force)
9696

9797
// Skip if lockfile indicates previous run
9898
if (!$force && file_exists('package.lock') && filemtime('package.json') < filemtime('package.lock') - 1) {
99-
$this->io->writeln('> <comment>Skipping as package-lock.json age indicates dependencies are already installed</comment>');
99+
$this->io->writeln('Skipping as package-lock.json age indicates dependencies are already installed');
100100
chdir($wd);
101101

102102
return;

app/sprinkles/core/src/Bakery/ClearCacheCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
5151
// Clear router cache
5252
$this->io->writeln('<info> > Clearing Router cache file</info>', OutputInterface::VERBOSITY_VERBOSE);
5353
if (!$this->clearRouterCache()) {
54-
$file = $this->ci->config['settings.routerCacheFile'];
54+
$filename = $this->ci->config['settings.routerCacheFile'];
55+
$file = $this->ci->locator->findResource("cache://$filename", true, true);
5556
$this->io->error("Failed to delete Router cache file. Make sure you have write access to the `$file` file.");
5657
exit(1);
5758
}

app/sprinkles/core/src/Core.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public function __construct(ContainerInterface $ci)
3333
{
3434
$this->ci = $ci;
3535

36-
// Register core locator streams
37-
$this->ci->locator->registerStream('migrations', '', \UserFrosting\MIGRATIONS_DIR);
38-
$this->ci->locator->registerStream('seeds', '', \UserFrosting\SEEDS_DIR);
36+
$this->registerStreams();
3937
}
4038

4139
/**
@@ -114,4 +112,29 @@ public function onAddGlobalMiddleware(Event $event)
114112
{
115113
SlimCsrfProvider::registerMiddleware($event->getApp(), $this->ci->request, $this->ci->csrf);
116114
}
115+
116+
/**
117+
* Register Core sprinkle locator streams
118+
*/
119+
protected function registerStreams()
120+
{
121+
/** @var \UserFrosting\UniformResourceLocator\ResourceLocator $locator */
122+
$locator = $this->ci->locator;
123+
124+
// 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);
131+
132+
// Register core locator sprinkle streams
133+
$locator->registerStream('extra', '', \UserFrosting\DS . \UserFrosting\EXTRA_DIR_NAME);
134+
$locator->registerStream('factories', '', \UserFrosting\DS . \UserFrosting\FACTORY_DIR_NAME);
135+
$locator->registerStream('locale', '', \UserFrosting\DS . \UserFrosting\LOCALE_DIR_NAME);
136+
$locator->registerStream('routes', '', \UserFrosting\DS . \UserFrosting\ROUTE_DIR_NAME);
137+
$locator->registerStream('schema', '', \UserFrosting\DS . \UserFrosting\SCHEMA_DIR_NAME);
138+
$locator->registerStream('templates', '', \UserFrosting\DS . \UserFrosting\TEMPLATE_DIR_NAME);
139+
}
117140
}

app/sprinkles/core/src/ServicesProvider/ServicesProvider.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ public function register(ContainerInterface $container)
123123

124124
// Load asset schema
125125
if ($config['assets.use_raw']) {
126+
127+
// Register sprinkle assets stream, plus vendor assets in shared streams
128+
$locator->registerStream('assets', 'vendor', \UserFrosting\BOWER_ASSET_DIR, true);
129+
$locator->registerStream('assets', 'vendor', \UserFrosting\NPM_ASSET_DIR, true);
130+
$locator->registerStream('assets', 'vendor', \UserFrosting\BROWSERIFIED_ASSET_DIR, true);
131+
$locator->registerStream('assets', '', \UserFrosting\DS . \UserFrosting\ASSET_DIR_NAME);
132+
126133
$baseUrl = $config['site.uri.public'] . '/' . $config['assets.raw.path'];
127134

128135
$assets = new Assets($locator, 'assets', $baseUrl);
@@ -144,6 +151,12 @@ public function register(ContainerInterface $container)
144151
$assets->addAssetBundles($bundles);
145152
}
146153
} else {
154+
155+
// Register compiled assets stream in public folder + alias for vendor ones + build stream for CompiledAssetBundles
156+
$c->locator->registerStream('assets', '', \UserFrosting\PUBLIC_DIR_NAME . '/' . \UserFrosting\ASSET_DIR_NAME, true);
157+
$c->locator->registerStream('assets', 'vendor', \UserFrosting\PUBLIC_DIR_NAME . '/' . \UserFrosting\ASSET_DIR_NAME, true);
158+
$c->locator->registerStream('build', '', \UserFrosting\BUILD_DIR_NAME, true);
159+
147160
$baseUrl = $config['site.uri.public'] . '/' . $config['assets.compiled.path'];
148161
$assets = new Assets($locator, 'assets', $baseUrl);
149162

@@ -249,13 +262,6 @@ public function register(ContainerInterface $container)
249262

250263
$config->set('csrf.blacklist', $csrfBlacklist);
251264

252-
// Reset 'assets' scheme in locator to use raw assets if specified in config.
253-
// Must be done here to prevent circular dependency as config is not loaded in system and locator can't be extended here.
254-
if (!$config['assets.use_raw']) {
255-
$c->locator->removeStream('assets');
256-
$c->locator->registerStream('assets', '', \UserFrosting\PUBLIC_DIR_NAME . '/' . \UserFrosting\ASSET_DIR_NAME, true);
257-
}
258-
259265
return $config;
260266
};
261267

@@ -587,7 +593,8 @@ public function register(ContainerInterface $container)
587593
$container['router'] = function ($c) {
588594
$routerCacheFile = false;
589595
if (isset($c->config['settings.routerCacheFile'])) {
590-
$routerCacheFile = $c->config['settings.routerCacheFile'];
596+
$filename = $c->config['settings.routerCacheFile'];
597+
$routerCacheFile = $c->locator->findResource("cache://$filename", true, true);
591598
}
592599

593600
return (new Router())->setCacheFile($routerCacheFile);

app/system/ServicesProvider.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,10 @@ public function register(ContainerInterface $container)
4848
$container['locator'] = function ($c) {
4949
$locator = new ResourceLocator(\UserFrosting\ROOT_DIR);
5050

51-
// Register shared streams
51+
// Register streams
5252
$locator->registerStream('bakery', '', \UserFrosting\BAKERY_SYSTEM_DIR, true);
53-
$locator->registerStream('build', '', \UserFrosting\BUILD_DIR_NAME, true);
54-
$locator->registerStream('log', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\LOG_DIR_NAME, true);
55-
$locator->registerStream('cache', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\CACHE_DIR_NAME, true);
56-
$locator->registerStream('session', '', \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\SESSION_DIR_NAME, true);
57-
$locator->registerStream('assets', 'vendor', \UserFrosting\BOWER_ASSET_DIR, true);
58-
$locator->registerStream('assets', 'vendor', \UserFrosting\NPM_ASSET_DIR, true);
59-
$locator->registerStream('assets', 'vendor', \UserFrosting\BROWSERIFIED_ASSET_DIR, true);
60-
61-
// Register sprinkles streams
62-
$locator->registerStream('assets', '', \UserFrosting\DS . \UserFrosting\ASSET_DIR_NAME);
63-
$locator->registerStream('config', '', \UserFrosting\DS . \UserFrosting\CONFIG_DIR_NAME);
64-
$locator->registerStream('extra', '', \UserFrosting\DS . \UserFrosting\EXTRA_DIR_NAME);
65-
$locator->registerStream('factories', '', \UserFrosting\DS . \UserFrosting\FACTORY_DIR_NAME);
66-
$locator->registerStream('locale', '', \UserFrosting\DS . \UserFrosting\LOCALE_DIR_NAME);
67-
$locator->registerStream('routes', '', \UserFrosting\DS . \UserFrosting\ROUTE_DIR_NAME);
68-
$locator->registerStream('schema', '', \UserFrosting\DS . \UserFrosting\SCHEMA_DIR_NAME);
69-
$locator->registerStream('sprinkles', '', '');
70-
$locator->registerStream('templates', '', \UserFrosting\DS . \UserFrosting\TEMPLATE_DIR_NAME);
7153
$locator->registerStream('bakery', '', \UserFrosting\BAKERY_DIR);
54+
$locator->registerStream('sprinkles', '', '');
7255

7356
return $locator;
7457
};

app/system/Sprinkle/SprinkleManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SprinkleManager
3636
/**
3737
* @var string The full absolute base path to the sprinkles directory.
3838
*/
39-
protected $sprinklesPath = \UserFrosting\APP_DIR_NAME . \UserFrosting\DS . \UserFrosting\SPRINKLES_DIR_NAME . \UserFrosting\DS;
39+
protected $sprinklesPath = \UserFrosting\SPRINKLES_DIR . \UserFrosting\DS;
4040

4141
/**
4242
* Create a new SprinkleManager object.

0 commit comments

Comments
 (0)