-
-
Save danielricecodes/fcc3b67fd3600e38d56cdbfb0971749f to your computer and use it in GitHub Desktop.
Revisions
-
rafaelp revised this gist
Jan 6, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,5 +14,6 @@ task :find_unused_images do end end end puts "\n\nDelete unused files running the command below:" puts "rm #{images_to_delete.join(" ")}" end -
rafaelp revised this gist
Jan 6, 2013 . 1 changed file with 15 additions and 13 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,18 @@ # It requires ACK - http://betterthangrep.com/ task :find_unused_images do images = Dir.glob('app/assets/images/**/*') images_to_delete = [] images.each do |image| unless File.directory?(image) # print "\nChecking #{image}..." print "." result = `ack -1 -G '(app|public)' --ruby --html --css --js #{File.basename(image)}` if result.empty? images_to_delete << image else end end end puts "rm #{images_to_delete.join(" ")}" end -
rafaelp created this gist
Jan 6, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # It requires ACK - http://betterthangrep.com/ task :find_unused_images do images = Dir.glob('app/assets/images/**/*') images_to_delete = [] images.each do |image| unless File.directory?(image) # print "\nChecking #{image}..." print "." if IO.popen("ack -1 -G '(app|public)' --ruby --html --css --js #{File.basename(image)}").eof? images_to_delete << image end end end puts "rm #{images_to_delete.join(" ")}" end