Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to smoothly rename a Phoenix Project?

I've cloned a git repo and I need to start a new project based off of it.

How do I rename it, making sure everything is taken care of?

I'm using macOS.

like image 909
Jonathan Soifer Avatar asked Apr 08 '17 11:04

Jonathan Soifer


1 Answers

Based off of nerdyworm's rename.sh, that uses ack I've adapted it to use git grep and run on macOS easily.

OTP NAME: Snake Case (snake_case) name for the Application.

NAME: Regular app name.

$ git grep -l $CURRENT_OTP | xargs sed -i '' -e "s/$CURRENT_OTP/$NEW_OTP/g"
$ git grep -l $CURRENT_NAME | xargs sed -i '' -e "s/$CURRENT_NAME/$NEW_NAME/g"

$ mv lib/$CURRENT_OTP lib/$NEW_OTP
$ mv lib/$CURRENT_OTP.ex lib/$NEW_OTP.ex
like image 75
Jonathan Soifer Avatar answered Sep 20 '22 17:09

Jonathan Soifer