Skip to content

Instantly share code, notes, and snippets.

@keisei1092
Created February 24, 2017 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keisei1092/6c8a0f89898686206f66d3a30d71acb6 to your computer and use it in GitHub Desktop.
Save keisei1092/6c8a0f89898686206f66d3a30d71acb6 to your computer and use it in GitHub Desktop.
複数ファイルの任意行の次に1行加えるやつ
#! /Users/keisei/.rbenv/shims/ruby
`git grep -lE '(let|var) request'`.split(/\n/).each do |filename|
file = File.open(filename, 'r')
buffer = file.read()
buffer.gsub!(/((let|var) request = URLRequest\(url: urlPath\))/, '\1' + "\n\t\trequest.setValue(Configuration.clientIdentifier, forHTTPHeaderField: \"APP-CLIENT-VERSION\")")
file = File.open(filename, 'w')
file.write(buffer)
file.close()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment