From cbe33ccced13af6c0c3b1e74f32b7a45f925e85d Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Mon, 21 May 2018 13:00:13 -0700 Subject: [PATCH] Add GA tracking modifier --- tools/doc/addga.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 tools/doc/addga.sh diff --git a/tools/doc/addga.sh b/tools/doc/addga.sh new file mode 100755 index 00000000000..0ff55f3fb73 --- /dev/null +++ b/tools/doc/addga.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# Copyright 2018 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -exu -o pipefail + +# This script finds all html files in the current directory, and adds the +# GA tracking snippet to them. + +read -r -d '' SNIPPET << EOF + +EOF + +S="$(echo -n $SNIPPET | tr '\n' ' ')" + +for M in $(find -name \*.html); +do + grep -q "i,s,o,g,r,a,m" "$M" + if [[ $? -ne 0 ]]; then + sed -i "s__${S}_" "$M" + fi +done;