Skip to content

Instantly share code, notes, and snippets.

@bsa7
Last active March 18, 2016 17:50
Show Gist options
  • Save bsa7/0184f2660bc34856df74 to your computer and use it in GitHub Desktop.
Save bsa7/0184f2660bc34856df74 to your computer and use it in GitHub Desktop.
check rails project file extensions
#!/usr/bin/env ruby
extensions = %w[haml erb coffee scss]
check_regexps = %w[html.haml$ html.erb$ js.coffee$ css.scss$].map{|r|Regexp.new(r)}
files = Dir.glob("**/*")
files.each do |filename|
extension = filename[/(?<=\.)[a-z]+$/]
if extensions.include? extension
extension_index = extensions.index extension
check_regexp = check_regexps[extension_index]
unless filename[check_regexp]
puts filename
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment