Last active
September 2, 2019 03:58
-
-
Save bezborodow/3624c0127464691505fb80f9f0c7ba87 to your computer and use it in GitHub Desktop.
Laravel Build Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WWW ?= /var/www | |
WWW_USER ?= apache | |
WWW_GROUP ?= wheel | |
js_assets = public/js/app.js | |
css_assets = public/css/app.css | |
assets = $(js_assets) $(css_assets) | |
css_deps = $(shell find resources/assets/sass/ -name '*.css' -o -name '*.scss') | |
js_deps = $(shell find resources/assets/js/ -name '*.js' -o -name '*.vue') | |
rsync_src = vendor storage config app public resources bootstrap routes artisan composer.* | |
all: clear-local-caches vendor $(assets) | |
./composer dump-autoload | |
clear-local-caches: | |
rm -rf bootstrap/cache/* storage/framework/cache/* storage/framework/views/* | |
vendor: composer composer.json composer.lock | |
./composer install | |
composer: | |
wget -O composer-setup.sig https://composer.github.io/installer.sig | |
wget -O composer-setup.php https://getcomposer.org/installer | |
awk '{print $$0 " composer-setup.php"}' composer-setup.sig | sha384sum --check | |
php composer-setup.php --quiet | |
rm composer-setup.* | |
mv composer.phar composer | |
$(assets): node_modules webpack.mix.js $(js_deps) $(css_deps) | |
npm run production | |
node_modules: package.json | |
npm install | |
test: | |
vendor/phpunit/phpunit/phpunit\ | |
--colors=auto tests/ | |
test-publish: | |
mkdir -p $(WWW)/build/coverage | |
vendor/phpunit/phpunit/phpunit --coverage-html $(WWW)/build/coverage \ | |
--colors=auto tests/ | |
install: rsync $(WWW)/public/storage | |
rsync: | |
mkdir -p $(WWW) | |
rsync --exclude=".*.sw*" -avzq $(rsync_src) $(WWW)/ | |
php $(WWW)/artisan down | |
chmod 0440 $(WWW)/.env | |
find $(WWW) -maxdepth 1 | xargs chown -R root:root | |
chown -R $(WWW_USER):$(WWW_GROUP) $(WWW)/storage $(WWW)/bootstrap/cache $(WWW)/.env $(WWW)/storage | |
chmod g+s $(WWW)/storage $(WWW)/bootstrap/cache | |
chmod -R g+w $(WWW)/storage $(WWW)/bootstrap/cache | |
php $(WWW)/artisan config:cache | |
php $(WWW)/artisan up | |
nohup service httpd reload >/dev/null 2>&1 & | |
$(WWW)/public/storage: | |
php $(WWW)/artisan storage:link | |
ctags: | |
ctags -R --fields=+aimS --languages=php --php-kinds=fc | |
version: | |
php --version | |
which php |
Optional, under install:
nohup supervisorctl restart all >/dev/null 2>&1 &
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
make
-- Update Composer, NPM, and build assets.make test
-- Run unit tests.sudo make install
-- install under/var/www
.or
sudo WWW=/var/www/foo make install
to install under an alternate location.