github.com/olivere/camlistore@v0.0.0-20140121221811-1b7ac2da0199/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  elif [ "$1" = "-w" ]
    11  then
    12  	find . -type f -name '*.go' -exec perl -pi -e 's!"code.google.com/!"camlistore.org/third_party/code.google.com/!' {} \;
    13  	find . -type f -name '*.go' -exec perl -pi -e 's!"launchpad.net/!"camlistore.org/third_party/launchpad.net/!' {} \;
    14  	find . -type f -name '*.go' -exec perl -pi -e 's!"github.com/!"camlistore.org/third_party/github.com/!' {} \;
    15  	find . -type f -name '*.go' -exec perl -pi -e 's!"labix.org/!"camlistore.org/third_party/labix.org/!' {} \;
    16  else
    17  	cat << heredoc
    18  usage: rewrite-imports.sh -l|-w"
    19  	-l: list files where a rewrite is needed"
    20  	-w: actually performs the rewrite"
    21  heredoc
    22  fi