-
-
Save artsyca/5759418 to your computer and use it in GitHub Desktop.
Revisions
-
artsyca revised this gist
Jun 11, 2013 . 1 changed file with 1 addition and 1 deletion.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 @@ -13,7 +13,7 @@ task :find_unused_images do 'app/assets/images/**/*', 'public/images/**/*' ] #puts "=======================\nDelete unused files below:" directories.each do |path| images = Dir.glob(path) images.each do |image| -
artsyca revised this gist
Jun 11, 2013 . 1 changed file with 26 additions and 17 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,19 +1,28 @@ # It requires ACK - http://betterthangrep.com/ # Modified from https://gist.github.com/rafaelp/4467738 # Please add the following filetypes to your .ackrc # --type-set=haml=.haml # --type-set=sass=.sass # --type-set=scss=.scss # --type-set=erb=.erb # --type-set=coffee=.coffee # Based on: https://github.com/docwhat/homedir-examples/pull/3 task :find_unused_images do # Look in two folders by default. directories = [ 'app/assets/images/**/*', 'public/images/**/*' ] puts "=======================\nDelete unused files below:" directories.each do |path| images = Dir.glob(path) images.each do |image| unless File.directory?(image) result = `ack -1 --ignore-directory=tmp --ignore-directory=log --ruby --html --css --js --sass --scss --coffee --erb --haml #{File.basename(image).shellescape}` if result.empty? print "./" + image.shellescape + "\n" end end #unless File.directory?(image) end #images.each end #directories.each end #task -
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