Skip to content

Commit

Permalink
fix: assets not loading due to missing trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
coolcodemy committed Feb 14, 2021
1 parent c3b4196 commit 51cf03d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ You probably didn't like the idea of having `www` folder inside this cloned repo

To change this, you need to update `.env` file and `DEFAULT_WWW_PATH` to a new path, let say your Desktop. Make sure to use absolute path when defining `DEFAULT_WWW_PATH`. Give it a reload (`butler reload`) and check whether your site still registered with Valet, using `butler parked` or `butler links`.


**WARNING!!** When changing `DEFAULT_WWW_PATH`, you must end the path with `/`. E.g: `/var/www/` and not `/var/www`.

### Laravel Queue

**[Need better documentation]**
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fi

if [ ! -f .env ]; then
cp ./stubs/.env .env
sed -i '' "s|REPLACEME|$PWD/www|g" ./.env
sed -i '' "s|REPLACEME|$PWD/www/|g" ./.env
fi

if [ ! -f docker-compose.yaml ]; then
Expand Down
25 changes: 14 additions & 11 deletions valet/cli/drivers/ValetDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function assign($sitePath, $siteName, $uri)
$drivers[] = $customSiteDriver;
}

$drivers = array_merge($drivers, static::driversIn(VALET_HOME_PATH.'/Drivers'));
$drivers = array_merge($drivers, static::driversIn(VALET_HOME_PATH . '/Drivers'));

$drivers[] = 'LaravelValetDriver';

Expand Down Expand Up @@ -90,11 +90,11 @@ public static function assign($sitePath, $siteName, $uri)
*/
public static function customSiteDriver($sitePath)
{
if (! file_exists($sitePath.'/LocalValetDriver.php')) {
if (!file_exists($sitePath . '/LocalValetDriver.php')) {
return;
}

require_once $sitePath.'/LocalValetDriver.php';
require_once $sitePath . '/LocalValetDriver.php';

return 'LocalValetDriver';
}
Expand All @@ -107,15 +107,15 @@ public static function customSiteDriver($sitePath)
*/
public static function driversIn($path)
{
if (! is_dir($path)) {
if (!is_dir($path)) {
return [];
}

$drivers = [];

$dir = new RecursiveDirectoryIterator($path);
$dir = new RecursiveDirectoryIterator($path);
$iterator = new RecursiveIteratorIterator($dir);
$regex = new RegexIterator($iterator, '/^.+ValetDriver\.php$/i', RecursiveRegexIterator::GET_MATCH);
$regex = new RegexIterator($iterator, '/^.+ValetDriver\.php$/i', RecursiveRegexIterator::GET_MATCH);

foreach ($regex as $file) {
require_once $file[0];
Expand Down Expand Up @@ -177,7 +177,7 @@ public function serveStaticFile($staticFilePath, $sitePath, $siteName, $uri)
*/
protected function isActualFile($path)
{
return ! is_dir($path) && file_exists($path);
return !is_dir($path) && file_exists($path);
}

/**
Expand All @@ -191,10 +191,10 @@ protected function isActualFile($path)
public function loadServerEnvironmentVariables($sitePath, $siteName)
{
$varFilePath = $sitePath . '/.valet-env.php';
if (! file_exists($varFilePath)) {
if (!file_exists($varFilePath)) {
$varFilePath = VALET_HOME_PATH . '/.valet-env.php';
}
if (! file_exists($varFilePath)) {
if (!file_exists($varFilePath)) {
return;
}

Expand All @@ -207,9 +207,12 @@ public function loadServerEnvironmentVariables($sitePath, $siteName)
}

foreach ($variablesToSet as $key => $value) {
if (! is_string($key)) continue;
if (!is_string($key)) {
continue;
}

$_SERVER[$key] = $value;
$_ENV[$key] = $value;
$_ENV[$key] = $value;
putenv($key . '=' . $value);
}
}
Expand Down
2 changes: 1 addition & 1 deletion valet/cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
Container::setInstance(new Container);

$version = '0.0.2';
$version = '0.0.3';

$app = new Application('Laravel Valet (Butler)', $version);

Expand Down

0 comments on commit 51cf03d

Please sign in to comment.