-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (39 loc) · 1.69 KB
/
Copy pathMakefile
File metadata and controls
51 lines (39 loc) · 1.69 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
SHELL = /bin/bash
INSECURE = $(shell echo ${PS_HOST} | grep -q '://[0-9.]\+' && echo '--insecure')
export COOKIES ?= .cookies
export CURL ?= curl $(INSECURE) -b $(COOKIES) -c $(COOKIES)
PS_ENV ?= $(shell echo $(PS_HOST) | cut -d'/' -f3)
PS_VERSION = $(shell $(CURL) -s "$(PS_HOST)/admin/systemsettings/serverstats.html" | grep -o 'powerschool-core-\([0-9.]\+\)' | cut -d'-' -f3)
SESSION_STATUS_CODE = $(shell $(CURL) -o /dev/null -s -w "%{http_code}" "$(PS_HOST)/admin/home.html")
STAMP ?= $(shell date '+%Y%m%d%H%M%S')
plugin_version ?= $(shell grep '<plugin' src/plugin.xml | sed 's:.*version="::;s:">::')
plugin_name ?= ok_state_forms
plugin_name_version = $(plugin_name)-v$(plugin_version)
help:
@ echo "$$HELP"
define HELP
For your PowerSchool Custom Pages convenience:
help This Message.
plugin Package the src/ directory as a plugin.
endef
export HELP
default: help
plugin: src/web_root/
@ echo "Plugin version: $(plugin_version)"
@ echo "Plugin name: $(plugin_name)"
@ echo "Plugin name version: $(plugin_name_version)"
@ mkdir -p dist
@ rm -rf dist/src './dist/$(plugin_name_version).zip'
@ mkdir -p dist/src
@ cp -a src/WEB_ROOT dist/src/WEB_ROOT
@ cp -a src/plugin.xml dist/src/plugin.xml
@ if [ -f src/web_root/head.html ]; then \
sed "s/version=/version=$$(git show-ref HEAD --hash)/g" \
< src/web_root/head.html \
> dist/src/web_root/head.html; \
fi
@ echo zip: '$(plugin_name_version).zip'
@ cd ./dist/src && zip -r '$(plugin_name_version).zip' * -x '*/.DS_Store' -x '.DS_Store'
@ mv './dist/src/$(plugin_name_version).zip' './dist/$(plugin_name_version).zip'
@ rm -rf dist/src
@ echo "Plugin created: dist/$(plugin_name_version).zip"