Last active
March 18, 2016 17:50
-
-
Save bsa7/0184f2660bc34856df74 to your computer and use it in GitHub Desktop.
check rails project file extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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