forked from kudrykv/latex-yearly-planner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·96 lines (75 loc) · 4.61 KB
/
release.sh
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
set -eo pipefail
CURRENT_YEAR=$(date +"%Y")
NEXT_YEAR=$((CURRENT_YEAR+1))
_configurations=(
1 "cfg/base.yaml,cfg/template_breadcrumb.yaml,cfg/sn_a5x.breadcrumb.default.yaml" "sn_a5x.breadcrumb.default"
1 "cfg/base.yaml,cfg/template_breadcrumb.yaml,cfg/sn_a5x.breadcrumb.default.yaml,cfg/sn_a5x.breadcrumb.default.dailycal.yaml" "sn_a5x.breadcrumb.default.dailycal"
2 "cfg/base.yaml,cfg/template_months_on_side.yaml,cfg/sn_a5x.mos.default.yaml" "sn_a5x.mos.default"
2 "cfg/base.yaml,cfg/template_months_on_side.yaml,cfg/sn_a5x.mos.default.yaml,cfg/sn_a5x.mos.default.dailycal.yaml" "sn_a5x.mos.default.dailycal"
2 "cfg/base.yaml,cfg/template_months_on_side.yaml,cfg/sn_a6x.mos.default.yaml" "sn_a6x.mos.default"
1 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/template_breadcrumb.yaml,cfg/rm2.breadcrumb.default.yaml" "rm2.breadcrumb.default"
1 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/template_breadcrumb.yaml,cfg/rm2.breadcrumb.default.yaml,cfg/rm2.breadcrumb.default.dailycal.yaml" "rm2.breadcrumb.default.dailycal"
2 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/template_months_on_side.yaml,cfg/rm2.mos.default.yaml" "rm2.mos.default"
2 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/template_months_on_side.yaml,cfg/rm2.mos.default.yaml,cfg/rm2.mos.default.dailycal.yaml" "rm2.mos.default.dailycal"
1 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk.base.yaml,cfg/template_breadcrumb.yaml,cfg/rm2.breadcrumb.default.yaml" "rm2_ddvk.breadcrumb.default"
1 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk.base.yaml,cfg/template_breadcrumb.yaml,cfg/rm2.breadcrumb.default.dailycal.yaml" "rm2_ddvk.breadcrumb.default.dailycal"
2 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk.base.yaml,cfg/template_months_on_side.yaml,cfg/rm2.mos.default.yaml" "rm2_ddvk.mos.default"
2 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk.base.yaml,cfg/template_months_on_side.yaml,cfg/rm2.mos.default.dailycal.yaml" "rm2_ddvk.mos.default.dailycal"
1 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk_lh.base.yaml,cfg/template_breadcrumb.yaml,cfg/rm2.breadcrumb.default.yaml" "rm2_ddvk_lh.breadcrumb.default"
1 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk_lh.base.yaml,cfg/template_breadcrumb.yaml,cfg/rm2.breadcrumb.default.dailycal.yaml" "rm2_ddvk_lh.breadcrumb.default.dailycal"
2 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk_lh.base.yaml,cfg/template_months_on_side.yaml,cfg/rm2.mos.default.yaml" "rm2_ddvk_lh.mos.default"
2 "cfg/base.yaml,cfg/rm2.base.yaml,cfg/rm2_ddvk_lh.base.yaml,cfg/template_months_on_side.yaml,cfg/rm2.mos.default.dailycal.yaml" "rm2_ddvk_lh.mos.default.dailycal"
1 "cfg/base.yaml,cfg/template_breadcrumb.yaml,cfg/kscribe.breadcrumb.default.yaml,cfg/kscribe.breadcrumb.default.yaml" "kscribe.breadcrumb.default"
1 "cfg/base.yaml,cfg/template_breadcrumb.yaml,cfg/kscribe.breadcrumb.default.yaml,cfg/kscribe.breadcrumb.default.dailycal.yaml" "kscribe.breadcrumb.default.dailycal"
)
_configurations_len=${#_configurations[@]}
function createPDFs() {
for _year in $CURRENT_YEAR $NEXT_YEAR; do
for _idx in $(seq 0 3 $((_configurations_len-1))); do
_passes=${_configurations[_idx]}
_cfg=${_configurations[_idx+1]}
_name=${_configurations[_idx+2]}
PLANNER_YEAR="${_year}" PASSES="${_passes}" CFG="${_cfg}" NAME="${_name}.${_year}" ./single.sh
done
done
}
function mvDefaultTo() {
for filename in ./*pdf; do
_newname=$(echo "$filename" | perl -pe "s/default/$1/g")
mv "$filename" "$_newname"
done
}
function _mkLine() {
sed -i 's/dotted: true/dotted: false/' cfg/base.yaml
}
function _mkSun() {
sed -i 's/weekstart: 1/weekstart: 0/' cfg/base.yaml
}
function _mkAMPM() {
sed -i 's/ampmtime: false/ampmtime: true/' cfg/base.yaml
}
function _restore() {
git restore cfg/base.yaml
}
_combinations=(
"" "dotted.default"
"_mkLine" "lined.default"
"_mkSun" "dotted.default.sun"
"_mkLine _mkSun" "lined.default.sun"
"_mkAMPM" "dotted.default.ampm"
"_mkAMPM _mkLine" "lined.default.ampm"
"_mkAMPM _mkSun" "dotted.default.ampm.sun"
"_mkLine _mkAMPM _mkSun" "lined.default.ampm.sun"
)
_combinations_len=${#_combinations[@]}
for _idx in $(seq 0 2 $((_combinations_len-1))); do
_cmds=${_combinations[_idx]}
_mvTo=${_combinations[_idx+1]}
for _cmd in ${_cmds}; do
${_cmd}
done
createPDFs
mvDefaultTo "${_mvTo}"
mv ./*pdf pile
_restore
done