forked from NativeScript/docs-v7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject-code-snippets.sh
executable file
·38 lines (28 loc) · 1.02 KB
/
inject-code-snippets.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
#!/bin/bash
set -e
branch=${branch:-master}
repoTmp="remote_repos/"
angularRepo="nativescript-angular"
angularDir="$repoTmp/$angularRepo/tests"
angularRepoUrl="https://github.com/NativeScript/$angularRepo.git"
nativescriptRepo="NativeScript"
nativescriptDir="$repoTmp/$nativescriptRepo"
nativescriptRepoUrl="https://github.com/NativeScript/$nativescriptRepo.git"
# cleanup
echo "---- Clean-up remote repos"
rm -rf "$repoTmp"
mkdir "$repoTmp"
# Enure mdinject
npm install
injectSnippets() {
snippetEnv=$1
snippetDirVar="${snippetEnv}Dir"
snippetUrlVar="${snippetEnv}RepoUrl"
snippetDir=${!snippetDirVar}
snippetRepoUrl=${!snippetUrlVar}
echo "---- Injecting '$snippetEnv' code snippets from branch $branch"
(cd "$repoTmp" && git clone --depth 1 --branch "$branch" "$snippetRepoUrl")
npm run mdinject -- --root="$snippetDir" --docsroot=Content --sourceext=".js|.ts|.xml|.html|.css" --snippettitles="JavaScript|TypeScript|XML|HTML|CSS"
echo "---- Injecting snippets DONE"
}
injectSnippets "$JEKYLL_ENV"