Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
複数ファイルの任意行の次に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