Skip to content

Instantly share code, notes, and snippets.

@gogiel
Created December 10, 2014 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gogiel/b8c8f1d55e6c783d0113 to your computer and use it in GitHub Desktop.
Save gogiel/b8c8f1d55e6c783d0113 to your computer and use it in GitHub Desktop.
# Requires `brew install ag`
dirname = ARGV[0]
records = Dir.glob(File.join(dirname, "**/*"))
possible_extensions = %w(jpeg jpg svg gif png css scss js coffee htc ejs jst).map{|ext| ".#{ext}"}
names = records.
reject{|path| File.directory?(path) }.
reject{|path| path =~ /@2x/}.
map do |path|
name = File.basename path
while true
ext = File.extname(name)
if possible_extensions.include? ext
name = File.basename name, ext
else
break
end
end
[name, path]
end
names.each do |data|
name, path = data
`ag '#{name}' --ignore '*.svg' > /dev/null`
if $? != 0
puts path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment