-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
122 lines (98 loc) · 2.89 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
.PHONY: dummy
SQLITE_DB_NAME := toils.sqlite
PROJECT_NAME := toils
LOCAL_PORT := 8086
seed-user: dummy
rm -f $(SQLITE_DB_NAME)
touch $(SQLITE_DB_NAME)
php artisan migrate
php artisan db:seed --class=UserFakeSeeder
seed-full: dummy
rm -f $(SQLITE_DB_NAME)
touch $(SQLITE_DB_NAME)
php artisan migrate
php artisan db:seed --class=FullFakeSeeder
lint: dummy
phpmd app text phpmd.xml
phpcs -s app
php artisan code:analyse
# Install NPM packages quietly.
setup-js: export NPM_CONFIG_PROGRESS=false
setup-js: export NO_UPDATE_NOTIFIER=1
setup-js:
npm install
# Install Composer packages quietly based on composer.lock
setup-php:
composer --no-interaction --no-ansi --no-suggest install
# Install all packages quietly.
setup: setup-php setup-js .env
# Check for out-of-date npm packages
outdated-js: export NO_UPDATE_NOTIFIER=1
outdated-js:
npm outdated || true
# Check for out-of-date composer packages
outdated-php:
composer show --outdated --direct
# Check for all out-of-date packages
outdated: outdated-php outdated-js
# Install newly updated npm packages.
update-js: export NO_UPDATE_NOTIFIER=1
update-js:
npm update
# Install newly updated composer packages and update composer.lock
update-php:
composer update
# Update all packages quietly
update: update-php update-js
# Create a package upgrade commit.
#
# "puc" stands for Package Upgrade Commit
puc: dummy
git checkout master
git add package.json package-lock.json composer.json composer.lock
git commit -m "Upgrade npm and composer packages"
workspace:
# 0: Editor
tmux new-session -d -s "$(PROJECT_NAME)" bash
tmux send-keys -t "$(PROJECT_NAME)" "$(EDITOR) ." C-m
# 1: Shell
tmux new-window -a -t "$(PROJECT_NAME)" bash
# 2: Webpack
tmux new-window -a -t "$(PROJECT_NAME)" -n "webpack" "npm run watch"
# 3: Dev server
tmux new-window -a -t "$(PROJECT_NAME)" -n "devserver" "php artisan serve --host 0.0.0.0 --port $(LOCAL_PORT)"
tmux select-window -t "$(PROJECT_NAME)":0
tmux attach-session -t "$(PROJECT_NAME)"
# Launch a single-use container to run the site.
#
# A webserver on the container host should define a vhost for the site
# and proxy requests into the container.
server: .env
podman run \
--rm \
--name=$(PROJECT_NAME) \
--publish=127.0.0.1:$(LOCAL_PORT):80 \
--volume="$(PWD):/srv/www" \
localhost/nginx-php
# Build a production image for the application
image: dummy
./mkimage.sh
imagetest: dummy
@-podman rm toils
podman run \
--rm \
--name=$(PROJECT_NAME) \
--publish=127.0.0.1:$(LOCAL_PORT):80 \
--volume="$(PWD)/storage:/srv/www/storage" \
--conmon /usr/lib/podman/bin/conmon \
localhost/$(PROJECT_NAME)
# Set up the application configuration file
#
# Most settings from the example file are usable as-is, but the
# APP_KEY in particular needs special handling.
.env:
cp .env.example .env
php artisan key:generate
# Install the application on the production host via Ansible
install:
ansible-playbook ansible/install.yml