Created
October 20, 2017 18:49
-
-
Save elchingon/c83a37e493cd207e32696a8c5d2e0126 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get a list of files which contain "require" AND "spec_helper" on a single line | |
# excluding spec/rails_helper.rb (we want "require 'spec_helper'" to exist here) | |
declare -a files=$(git grep -E "require.*spec_helper" | cut -d ':' -f 1 | grep -v 'spec/rails_helper.rb') | |
# loop through files and replace "spec_helper" with "rails_helper" | |
for i in $files; do | |
sed -i '' -e 's/spec_helper/rails_helper/' $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment