riak-haskell-client / protobuf / proto.sh


root="$(hg root)"

if [[ -z "$root" ]]; then
    echo "error: don't know where we are!" 1>&2
    exit 1

cd "$root/protobuf"

hprotoc="$(which hprotoc)"

if [[ -z "$hprotoc" ]]; then
    echo "error: can't continue without hprotoc" 1>&2
    echo "to fix:" 1>&2
    echo 1>&2
    echo "cabal install hprotoc" 1>&2
    exit 1

sed -e 's/Rpb//g' -e 's/Req\>/Request/g' -e 's/Resp\>/Response/g' \
    -e 's/MapRedR/MapReduceR/g' -e 's/DelR/DeleteR/' -e 's/ClientId/ClientID/' \
    -e 's/GetServerInfoResponse/ServerInfo/g' \
    -e 's/MapReduceResponse/MapReduce/g' \
    src/riakclient.proto src/riakextra.proto > src/Protocol.proto

(cd src && hprotoc -p Network.Riak Protocol.proto)
for i in $(find src/Network/Riak/Protocol -name '*.hs';
           echo src/Network/Riak/Protocol.hs); do
    cp /dev/null $i.$$
    echo '{-# OPTIONS_GHC -fno-warn-unused-imports #-}' >> $i.$$
    cat $i >> $i.$$
    mv $i.$$ $i

rm src/Protocol.proto
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.