Skip to content

Instantly share code, notes, and snippets.

@samanthamjohn
Created March 1, 2018 18:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samanthamjohn/b9e32bf8d2e7c09684878aaa79cb8372 to your computer and use it in GitHub Desktop.
Save samanthamjohn/b9e32bf8d2e7c09684878aaa79cb8372 to your computer and use it in GitHub Desktop.
comment = "# frozen_string_literal: true\n"
filemode = "r+"
dirs = Dir[Rails.root.join('spec/**/*.rb').to_s] + Dir[Rails.root.join('lib/**/*.rake').to_s] + Dir[Rails.root.join('lib/**/*.rb').to_s]
dirs.each do |filename|
contents = File.open(filename, "r") do |f|
f.read
end
contents = comment + contents
File.open(filename, "w") do |f|
f.write contents
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment