From 2c13ffc120025f4947ffe5d48e03e389a671a1b0 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 27 Aug 2016 10:47:21 +0100 Subject: [PATCH] Updated travis config to prevent failing Currently failing due to cached vendor config --- .travis.yml | 3 ++- app/helpers.php | 48 +++++++++++++++++++++++------------------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index bea8d1795..b9717fdff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ php: cache: directories: - - vendor - node_modules - $HOME/.composer/cache @@ -29,6 +28,8 @@ before_script: - composer install --prefer-dist --no-interaction - npm install - ./node_modules/.bin/gulp + - php artisan clear-compiled -n + - php artisan optimize -n - php artisan migrate --force -n --database=mysql_testing - php artisan db:seed --force -n --class=DummyContentSeeder --database=mysql_testing diff --git a/app/helpers.php b/app/helpers.php index e4f9b1b10..d28b1956f 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -2,33 +2,31 @@ use BookStack\Ownable; -if (!function_exists('versioned_asset')) { - /** - * Get the path to a versioned file. - * - * @param string $file - * @return string - * - * @throws \InvalidArgumentException - */ - function versioned_asset($file) - { - static $manifest = null; +/** + * Get the path to a versioned file. + * + * @param string $file + * @return string + * + * @throws \InvalidArgumentException + */ +function versioned_asset($file) +{ + static $manifest = null; - if (is_null($manifest)) { - $manifest = json_decode(file_get_contents(public_path('build/manifest.json')), true); - } - - if (isset($manifest[$file])) { - return baseUrl($manifest[$file]); - } - - if (file_exists(public_path($file))) { - return baseUrl($file); - } - - throw new InvalidArgumentException("File {$file} not defined in asset manifest."); + if (is_null($manifest)) { + $manifest = json_decode(file_get_contents(public_path('build/manifest.json')), true); } + + if (isset($manifest[$file])) { + return baseUrl($manifest[$file]); + } + + if (file_exists(public_path($file))) { + return baseUrl($file); + } + + throw new InvalidArgumentException("File {$file} not defined in asset manifest."); } /**