-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
178 lines (129 loc) · 4.33 KB
/
Makefile
File metadata and controls
178 lines (129 loc) · 4.33 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
install: web2py pydeps postgresql additional
virt-env:
sudo apt-get install virtualenvwrapper
mkvirtualenv pci --python=`which python3.12`
web2py:
cd .. ; git clone --recurse-submodules \
--depth=3 \
--branch v3.0.11+pci-patches \
https://github.com/pci-dev/web2py
ln -s $(PWD) ../web2py/applications/pci
cp utils/routes.py ../web2py/
pydeps:
pip install -r requirements.txt
postgresql:
sudo apt-get install -y postgresql postgresql-contrib
additional:
sudo apt-get install -y libimage-exiftool-perl
db:
$(psql) -c "CREATE ROLE pci_admin WITH LOGIN PASSWORD 'admin4pci'"
$(psql) -c "CREATE DATABASE main"
$(psql) main -c "CREATE EXTENSION unaccent"
$(psql) main < sql_dumps/pci_evolbiol_test.sql
$(psql) main < sql_dumps/pci_evolbiol_test_data0.sql
$(psql) main < sql_dumps/insert_default_help_texts.sql
$(psql) main < sql_dumps/insert_default_mail_templates.sql
$(psql) main < sql_dumps/t_status_article.sql
db.clean:
$(psql) -c "drop database if exists main"
$(psql) -c "drop role if exists pci_admin"
db.admin:
echo "map_admin $$USER postgres" | sudo tee -a /etc/postgresql/*/main/pg_ident.conf
sudo sed -i '/local *all *postgres *peer/ s/$$/ map=map_admin/' /etc/postgresql/*/main/pg_hba.conf
sudo systemctl restart postgresql
psql = psql -q -U postgres -v "ON_ERROR_STOP=1"
start start.debug:
../web2py/web2py.py --password pci $(log) &
stop:
@PID=`ps ax -o pid,args | grep web2py.py | grep -v grep | awk '{print $$1}'` ;\
[ "$$PID" ] && kill $$PID && echo killed $$PID || echo "not running"
start: conf init
conf: private/appconfig.ini
init: logo
logo: static/images/background.png \
static/images/small-background.png
private/% static/%:
cd $(dir $@) && cp sample.$(notdir $@) $(notdir $@)
start: log = > /dev/null
test.install.selenium: install.selenium install.firefox
install.selenium:
pip install -r tests/requirements.txt
install.chromium:
sudo apt install chromium-chromedriver
install.firefox:
sudo apt install firefox-geckodriver
test.install: test.install.selenium
test.setup: test.db
test.db:
$(psql) main < sql_dumps/insert_test_users.sql
test.db.rr:
$(psql) main -c "delete from mail_templates"
$(psql) main < sql_dumps/insert_default_mail_templates_pci_RR.sql
test.reset: reset set.conf.rr.false
test.reset.rr: reset set.conf.rr.true test.db.rr
reset: stop db.clean db test.setup start
set.conf.rr.%:
rm -f languages/default.py
sed -i '/^registered_reports/ s/=.*/= $*/' private/appconfig.ini
sed -i '/^scheduled_submissions/ s/=.*/= $*/' private/appconfig.ini
test.full test.basic test.medium test.scheduled-track: delete.external.user
test.full: test_full.py
test.basic: test_basic.py
test.medium: test_medium.py
test.scheduled-track: test_scheduled_track.py
test.full test.basic test.medium test.scheduled-track: test.clean
test.create-article:
cd tests ; pytest -k "basic and User_submits"
test.review.registered-user:
cd tests; pytest -v -k "review_article and Reviewer"
test.review.external:
cd tests; pytest -v -k "review_article and External"
test.review.no-upload:
cd tests; RR_SCHEDULED_TRACK=1 \
pytest -v -k "review_article and Reviewer"
test_%:
(cd tests; pytest -xv $@)
delete.external.user:
$(psql) main -c "delete from auth_user where first_name='Titi';"
test.clean:
pkill -9 -ef 'geckodriver[ ]|marionette[ ]' || true
coar.refresh:
touch modules/app_modules/coar_notify.py
reload.web2py:
touch ../../wsgihandler.py
recreate.v_article:
~/all-pci-db.sh | while read db; do \
psql -h mydb1 -p 33648 -U peercom $$db \
< utils/re-create_v_article.sql; \
done
setup.new-pci: dirs = errors/ uploads/ sessions/ databases/ cron/ tmp/
setup.new-pci:
mkdir -p $(dirs)
chgrp www-data $(dirs) private
chmod g+w $(dirs)
chmod g+r private
ln -s default_base.py languages/default.py
api:
cp -f utils/api/sparse-checkout .git/info/
git sparse-checkout init
ln -sf api.py controllers/default.py
mkdir -p models && \
ln -sf ../utils/api/db_plug.py models/
ln -sf utils/api/README.md ./
find . | grep -v .git
api.dismount:
\rm -f controllers/default.py models/db_plug.py
git sparse-checkout disable
check.static:
@git diff --stat `git describe --tag --abbrev=0` \
| grep static/ || echo "no update needed"
build:
docker build -t pci .
dev:
:
: use ^C to quit
:
docker run --rm -it -p 8001:8001 -v `pwd`:/pci pci
log:
@git log --merges --format=%s \
`git describe --tag --abbrev=0`..