-
Notifications
You must be signed in to change notification settings - Fork 7
/
prepare_site_yml
executable file
·36 lines (28 loc) · 971 Bytes
/
prepare_site_yml
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
#!/usr/bin/env bash
#
# This script creates a site-dev.yml from an existing site.yml
# You need to run this script from the root of the repo via bin/prepare_site_yml
# once you are starting development. This ensures you have the latest version as base.
source_file="./site.yml"
target_file="./site-dev.yml"
# check that the source exists
if [ ! -f "$source_file" ]; then
echo "$source_file not found. Exiting."
exit
fi
echo "$source_file found."
echo "copying $source_file to $target_file"
cp $source_file $target_file
# - url: https://github.com/owncloud/docs-ocis.git --> - url: ../docs-ocis.git
echo "Replacing component URL paths to local paths"
sed -i 's#- url: https://github.com/owncloud#- url: ..#g' $target_file
# creating three caption groups
# 1 ... - url: ../
# 2 ... docs-ocis
# 3 ... .git
# only taking 1 and 2
# - url: ../docs-ocis.git --> - url: ../docs-ocis
sed -i -r 's#(- url: \.\.\/)(.*)(.git)#\1\2#g' $target_file
# Result
echo "Done"
echo