Skip to content

Instantly share code, notes, and snippets.

@baldur
Created July 10, 2014 18:39
Show Gist options
  • Save baldur/3ce36a1d5d066b97899b to your computer and use it in GitHub Desktop.
Save baldur/3ce36a1d5d066b97899b to your computer and use it in GitHub Desktop.
require 'find'
Find.find('.') do |path|
basename = File.basename(path)
dirname = File.dirname(path)
if dirname =~ /^\.\/src|^\.\/res/
if basename =~ /.java$/ || basename =~ /.xml$/
content = File.read(path)
if content =~ /\n\n$/
File.write(path, content.gsub(/\n\n$/, "\n"))
puts dirname
puts basename
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment