github.com/slspeek/camlistore_namedsearch@v0.0.0-20140519202248-ed6f70f7721a/third_party/rewrite-imports.sh (about)

     1  #!/bin/sh
     2  
     3  #TODO(mpl): patch github.com/cznic/zappy on the fly to make it pure Go.
     4  if [ "$1" = "-l" ]
     5  then
     6  	find . -type f -name '*.go' -exec grep -E -l '"code.google.com/' {} \;
     7  	find . -type f -name '*.go' -exec grep -E -l '"launchpad.net/' {} \;
     8  	find . -type f -name '*.go' -exec grep -E -l '"github.com/' {} \;
     9  	find . -type f -name '*.go' -exec grep -E -l '"labix.org/' {} \;
    10  	find . -type f -name '*.go' -exec grep -E -l '"bazil.org/' {} \;
    11  elif [ "$1" = "-w" ]
    12  then
    13  	find . -type f -name '*.go' -exec perl -pi -e 's!"code.google.com/!"camlistore.org/third_party/code.google.com/!' {} \;
    14  	find . -type f -name '*.go' -exec perl -pi -e 's!"launchpad.net/!"camlistore.org/third_party/launchpad.net/!' {} \;
    15  	find . -type f -name '*.go' -exec perl -pi -e 's!"github.com/!"camlistore.org/third_party/github.com/!' {} \;
    16  	find . -type f -name '*.go' -exec perl -pi -e 's!"labix.org/!"camlistore.org/third_party/labix.org/!' {} \;
    17  	find . -type f -name '*.go' -exec perl -pi -e 's!"bazil.org/!"camlistore.org/third_party/bazil.org/!' {} \;
    18  else
    19  	cat << heredoc
    20  usage: rewrite-imports.sh -l|-w"
    21  	-l: list files where a rewrite is needed"
    22  	-w: actually performs the rewrite"
    23  heredoc
    24  fi