Guest User

Untitled

a guest
Oct 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # get a list of files which contain "require" AND "spec_helper" on a single line
  4. # excluding spec/rails_helper.rb (we want "require 'spec_helper'" to exist here)
  5. declare -a files=$(git grep -E "require.*spec_helper" | cut -d ':' -f 1 | grep -v 'spec/rails_helper.rb')
  6.  
  7. # loop through files and replace "spec_helper" with "rails_helper"
  8. for i in $files; do
  9. sed -i '' -e 's/spec_helper/rails_helper/' $i
  10. done
Add Comment
Please, Sign In to add comment