Created
January 28, 2016 22:01
-
-
Save ipoval/422456ab6c3c9a245c95 to your computer and use it in GitHub Desktop.
rails_3_to_4_routes_changes.rb
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
nl -ba config/routes/api_v1.rb | grep -v via | grep match | awk '{print $1}' | pbcopy | |
a = [43, 46, 50, 51, 54, 55] | |
File.open('config/routes/api_v1.rb') do |f| | |
lines = f.readlines | |
lines.each_with_index do |line, idx| | |
if a.include?(idx + 1) | |
lines[idx] = line.sub('match', 'get') | |
lines[idx] = lines[idx].rstrip + ' # FIXME: rails4' + "\n" | |
end | |
end | |
puts lines | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment