Skip to content

Instantly share code, notes, and snippets.

@tdooner
Created July 28, 2016 18:22
Show Gist options
  • Save tdooner/00484dcf68aa672913178e788cf67d81 to your computer and use it in GitHub Desktop.
Save tdooner/00484dcf68aa672913178e788cf67d81 to your computer and use it in GitHub Desktop.
#!/bin/bash
before=$1
after=$2
shopt -s globstar # let ** glob work
if [ ! -d app/assets/components/$before ]; then
echo "could not find component directory"
exit 1
fi
git mv app/assets/components/$before app/assets/components/$after
sed -i -e "s/$before/$after/g" {app,spec}/**/*.js?
for FILE in `git diff --name-only`; do
[ ! -f $FILE ] && continue
echo "Rewriting/Alphabetizing imports in $FILE..."
importjs rewrite --overwrite $FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment