forked from snowplow-referer-parser/referer-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync_yaml.sh
executable file
·65 lines (56 loc) · 2.31 KB
/
sync_yaml.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
#!/bin/bash
# Copyright (c) 2012 SnowPlow Analytics Ltd. All rights reserved.
#
# This program is licensed to you under the Apache License Version
# 2.0,
# and you may not use this file except in compliance with the Apache
# License Version 2.0.
# You may obtain a copy of the Apache License Version 2.0 at
# http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the Apache License Version 2.0 is
# distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied.
# See the Apache License Version 2.0 for the specific language
# governing permissions and limitations there under.
# Author:: Alex Dean (mailto:[email protected])
# Copyright:: Copyright (c) 2012 SnowPlow Analytics Ltd
# License:: Apache License Version 2.0
# Sync the main search_engines.yml with the dependent ones in the
# sub-folders
# Source path
YML=referers.yml
JSON=referers.json
# Target paths
RUBY="./ruby/data/${YML}"
JAVA="./java-scala/src/main/resources/${YML}"
PYTHON_YML="./python/referer_parser/data/${YML}"
PYTHON_JSON="./python/referer_parser/data/${JSON}"
NODEJS="./nodejs/data/${YML}"
DOTNET="./dotnet/RefererParser/Resources/${JSON}"
# Sync the file
sync_to(){
echo "#################################### DO NOT EDIT THIS FILE ####################################
# #
# This file will be overwritten the next time ./sync_yaml.sh is run! #
# #
#################################### DO NOT EDIT THIS FILE ####################################
" | cat - ./${YML} > ${1}
}
# Ruby, Java/Scala, node.js
sync_to ${RUBY}
sync_to ${JAVA}
sync_to ${NODEJS}
sync_to ${PYTHON_YML}
# Add others
# Compile json for Python and .NET versions
cd ./python/referer_parser/
./build_json.py
cd -
# Copy json version to Python and .NET versions
cp ${PYTHON_JSON} ${DOTNET}
# Finally commit on current branch
git commit ${PYTHON_YML} ${RUBY} ${JAVA} ${NODEJS} -m "Updated ${YML} in sub-folder following update(s) to master copy"
git commit ${PYTHON_JSON} ${DOTNET} -m "Updated ${JSON} in sub-folder following update(s) to master copy"