forked from ChromeDevTools/debugger-protocol-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-protocol-json.sh
executable file
·35 lines (27 loc) · 1.06 KB
/
update-protocol-json.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
#!/bin/bash
standalone_path="$HOME/code/devtools-standalone/protocol.json"
chromium_path="$HOME/chromium/src/third_party/WebKit/Source/devtools/protocol.json"
repo_path="dunno"
local_script_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
local_protocol_path="_data/protocol.json"
if [ -s $standalone_path ]; then
repo_path=$standalone_path
elif [ -s $chromium_path ]; then
repo_path=$chromium_path
else
echo "error: couldn't find local checkout" >&2; exit 1
fi
# copy the protocol.json over
cp -r "$repo_path" "$local_protocol_path"
cd $local_script_path
node create-domain-files.js
node create-search-index.js
# get the latest change
cd $(dirname "$repo_path")
commit_line=$(git log --no-color HEAD~1..HEAD | grep -E -o "^commit.*")
date_line=$(git log --no-color HEAD~1..HEAD | grep -E -o "^Date.*")
commit_hash=$(echo $commit_line | grep -E -o "\b[0-9a-f]{20,40}\b")
# copy it into the HTML file
cd $local_script_path
cat index.html | sed -e "s/^Date.*/$date_line/" | sed -E "s/\b[0-9a-f]{20,40}\b/$commit_hash/" > index.html.new
mv index.html.new index.html