-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmake_conduct.R
77 lines (62 loc) · 2.34 KB
/
make_conduct.R
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
## make_conduct.r
## this script will stitch or 'knit' together all the individual .md files and push online to ohi-science.org.
## also required if you get the pdflatex error: www.tug.org/mactex
## setup ----
source('~/github/ohimanual/make_functions.r') # rendering functions for OHI
title_header = 'The Ocean Health Index Conduct Phase'
subtitle_header = 'Assessment Manual'
wd = '~/github/ohimanual/3_conduct_manual'
setwd(wd)
## .md files to be included in this order: ----
in_md = c(
# 'overall_guide.md',
'intro_assessment.md',
'intro_to_repos.md',
'assemble_inputs.md',
'formatting_data.md',
'defining_spatial.md',
'intro_goalbygoal.md',
'file_system.md',
'use_tbx.md', # TODO: review and update
'use_tbx_to_modify_data_layers.md',
'use_tbx_to_modify_goal_models.md',
'use_tbx_to_modify_pressures_resilience.md',
'use_tbx_to_remove_goal_models.md',
'use_tbx_to_remove_sub_goals.md',
'use_tbx_calculate_overall_index.md',
'toolbox_troubleshooting.md',
'tbx_software_intro.md',
'install_tbx.md',
'appendix2_intro.md',
'practical_FP.md',
'practical_AO.md',
'practical_NP.md',
'practical_CS.md',
'practical_CP.md',
'practical_SP.md',
'practical_LE.md',
'practical_TR.md',
'practical_CW.md',
'practical_BD.md',
# 'pressures_resilience.md',
# 'file_prep_instructions.md',
# 'model_descript_instructions.md',
# 'record_sheet.md',
'R_tutes_all.md',
'frequently_asked_questions.md')
## final .md filename
out_md = 'ohi-manual.md'
## concatenate md ----
cat_md(in_md, out_md)
pfx = tools::file_path_sans_ext(out_md)
## render and save html, pdf ----
ohi_html(out_md)
#ohi_pdf(out_md)
## push to ohi-science.org website ----
push_to_web(out_md)
## copy goal-by-goal files to ohi-science.github.io ----
## checkout and pull master branch: ohi-science.github.io
system('cd ~/github/ohi-science.github.io; git checkout master; git pull')
## identify and copy ten current goal files
goal_files = list.files(wd, '^practical_[A-Z][A-Z].md')
file.copy(file.path(wd, goal_files), '~/github/ohi-science.github.io/_includes/themes/OHI/goals', overwrite = T)