-
Notifications
You must be signed in to change notification settings - Fork 2
/
activate
141 lines (116 loc) · 6.62 KB
/
activate
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
#!/usr/bin/env bash
# ###############################################################
# PATHS
# ###############################################################
# Set home.
export CMIP6_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Ensure target scripts are executable.
chmod a+x "$CMIP6_HOME"/sh/*/*.sh
# Set archives.
if [ -d "$CMIP6_HOME/repos/archives/esdoc-archive" ]; then
source "$CMIP6_HOME/repos/archives/esdoc-archive/sh/activate"
fi
if [ -d "$CMIP6_HOME/repos/archives/pyessv-archive" ]; then
export PYESSV_ARCHIVE_HOME="$CMIP6_HOME/repos/archives/pyessv-archive"
fi
# Set python path.
export PYTHONPATH=$CMIP6_HOME:$PYTHONPATH
# ###############################################################
# UTILS
# ###############################################################
source "$CMIP6_HOME"/sh/utils/main.sh
# ###############################################################
# COMMANDS
# ###############################################################
# Command executor.
function exec_cmd()
{
local CMD_TYPE=${1}
local CMD_SCRIPT=${2}
local CMD_TARGET="$CMIP6_HOME"/sh/"$CMD_SCRIPT"
cmip6_venv_activate
log_banner
log "$CMD_TYPE :: BEGINS"
log_banner
if [ "$3" ] && [ "$4" ] && [ "$5" ]; then
source "$CMD_TARGET" "$3" "$4" "$5"
elif [ "$3" ] && [ "$4" ]; then
source "$CMD_TARGET" "$3" "$4" ""
elif [ "$3" ]; then
source "$CMD_TARGET" "$3" "" ""
else
source "$CMD_TARGET" ""
fi
log_banner
log "$CMD_TYPE :: ENDS"
log_banner
cmip6_venv_deactivate
}
# --------------------------------------------------------------------
# ALIASES
# --------------------------------------------------------------------
# ... setup
alias cmip6-setup='exec_cmd setup utils/setup.sh'
# ... citations
alias cmip6-citations-init-xls='exec_cmd citations-init-xls citations/init_xls.sh $1'
alias cmip6-citations-generate-json='exec_cmd citations-generate-json citations/generate_json.sh $1'
# ... experiments
alias cmip6-experiments-archive-cim-documents='exec_cmd experiments-archive-cim-documents experiments/archive_cim_documents.sh'
alias cmip6-experiments-write-cim-documents='exec_cmd experiments-write-cim-documents experiments/write_cim_documents.sh'
alias cmip6-experiments-write-config='exec_cmd experiments-write-config experiments/write_config.sh'
alias cmip6-experiments-write-d3='exec_cmd experiments-write-d3 experiments/write_d3.sh'
_reset_experiments()
{
cmip6-experiments-write-cim-documents
cmip6-experiments-write-config
cmip6-experiments-write-d3
cmip6-experiments-archive-cim-documents
}
alias cmip6-experiments-reset=_reset_experiments
# ... institutes
alias cmip6-institutes-list='exec_cmd institutes-list institutes/list.sh'
alias cmip6-institutes-repos-clean='exec_cmd institutes-github-repos-clean institutes/github_repos_clean.sh'
alias cmip6-institutes-repos-pull='exec_cmd institutes-github-repos-pull institutes/github_repos_pull.sh'
alias cmip6-institutes-repos-push='exec_cmd institutes-github-repos-push institutes/github_repos_push.sh'
alias cmip6-institutes-repos-status='exec_cmd institutes-github-repos-clone institutes/github_repos_status.sh'
alias cmip6-institutes-repos-sync='exec_cmd institutes-github-repos-sync institutes/github_repos_sync.sh'
alias cmip6-institutes-repos-verify='exec_cmd institutes-github-repos-verify institutes/github_repos_verify.sh $1'
alias cmip6-institutes-teams-sync='exec_cmd institutes-github-teams-sync institutes/github_teams_sync.sh'
# ... models
alias cmip6-models-archive-cim-documents='exec_cmd models-archive-cim-documents models/archive_cim_documents.sh'
alias cmip6-models-archive-cim-documents-of-mohc='exec_cmd models-archive-cim-documents-of-mohc models/archive_cim_documents_of_mohc.sh'
alias cmip6-models-generate-cim='exec_cmd models-generate-cim models/generate_cim.sh'
alias cmip6-models-generate-comparator-json='exec_cmd models-generate-comparator-json models/generate_comparator_json.sh'
alias cmip6-models-generate-json='exec_cmd models-generate-json models/generate_json.sh'
alias cmip6-models-generate-pdf='exec_cmd models-generate-pdf models/generate_pdf.sh'
alias cmip6-models-generate-xls='exec_cmd models-generate-xls models/generate_xls.sh'
alias cmip6-models-init-cmip5-docs='exec_cmd models-init-cmip5-docs models/init_cmip5_docs.sh'
alias cmip6-models-init-json-from-cmip5='exec_cmd models-json-from-cmip5 models/init_json_from_cmip5.sh'
alias cmip6-models-init-settings='exec_cmd models-init-settings models/init_settings.sh'
alias cmip6-models-init-coupling-xls='exec_cmd models-init-coupling-xls models/init_coupling_xls.sh'
alias cmip6-models-reset-cim='exec_cmd models-reset-cim models/reset_cim.sh'
alias cmip6-models-reset-json='exec_cmd models-reset-json models/reset_json.sh'
# ... parties
alias cmip6-parties-init-xls='exec_cmd parties-init-xls parties/init_xls.sh $1'
alias cmip6-parties-generate-json='exec_cmd parties-generate-json parties/generate_json.sh $1'
# ... specializations
alias cmip6-specializations-generate='exec_cmd specializations-generate specializations/generate.sh'
alias cmip6-specializations-repos-pull='exec_cmd specializations-pull specializations/github_repos_pull.sh'
alias cmip6-specializations-repos-push='exec_cmd specializations-push specializations/github_repos_push.sh'
alias cmip6-specializations-repos-status='exec_cmd specializations-status specializations/github_repos_status.sh'
alias cmip6-specializations-sync-cim-profile='exec_cmd specializations-sync-cim-profile specializations/sync_cim_profile.sh'
alias cmip6-specializations-sync-definitions='exec_cmd specializations-sync-definitions specializations/sync_definitions.sh'
alias cmip6-specializations-sync-mappings='exec_cmd specializations-sync-mappings specializations/sync_mappings.sh'
alias cmip6-specializations-sync-templates='exec_cmd specializations-sync-templates specializations/sync_templates.sh'
alias cmip6-specializations-sync-tooling='exec_cmd specializations-sync-tooling specializations/sync_tooling.sh'
alias cmip6-specializations-sync-viewer='exec_cmd specializations-sync-viewer specializations/sync_viewer.sh'
alias cmip6-specializations-validate='exec_cmd specializations-validate specializations/validate.sh'
# ... vocabs
alias cmip6-vocabs-write-bash-vars='exec_cmd vocabs-write-bash-vars vocabs/write_bash_vars.sh'
# ... machines and performances
alias cmip6-machines-init-xls='exec_cmd machines-init-xls machines/init_machines_xls.sh $1'
alias cmip6-machines-generate-cim='exec_cmd machines-generate-cim machines/ $1'
alias cmip6-performance-init-xls='exec_cmd performance-init-xls machines/init_performances_xls.sh $1'
# ... archives & libs
alias cmip6-archives-repos-pull='exec_cmd archives-pull utils/pull_archives.sh'
alias cmip6-libs-repos-pull='exec_cmd archives-pull utils/pull_libs.sh'