Sha256: 63d1aa292d5903efd6ed2f5899963f71675a3487dea34322cd77f00a541e2a57

Contents?: true

Size: 883 Bytes

Versions: 27

Compression:

Stored size: 883 Bytes

Contents

#!/usr/bin/env ruby

count = 0
used = []
unused = []

Dir["./app/assets/images/**/*"].each do |path|
  puts "Checking #{path}..."
  filename = path.split("/").last
  if filename =~ /(.*)\.(jpg|png|gif)$/
    puts "grep #{filename} ./servers/* -R"
    result = `grep #{filename} ./servers/* -R`
    print result
    if result.length < 1 || result =~ /Binary/
      puts "Adding #{path} to queue to remove..."
      unused << path
      # system "git rm #{path}"
    
      count += 1
    else
      used << path
    end
  end
end

puts "Counted #{count} unused files:."
unused.each do |file|
  puts file
end

if count > 0
  puts "Delete these files?"
  response = gets

  if response =~ /y/i
    unused.each do |file|
      system "git rm #{file}"
    end
  else
    puts "Cancelled."
  end

end

puts "The following #{used.size} files were used:"
used.each do |file|
  puts file
end

Version data entries

27 entries across 22 versions & 1 rubygems

Version Path
ymdp-0.1.10 spec/data/script/images
ymdp-0.1.9 spec/data/script/images
ymdp-0.1.8.1 spec/data/script/images
ymdp-0.1.8 spec/data/script/images
ymdp-0.1.7 spec/data/script/images
ymdp-0.1.6 spec/data/script/images
ymdp-0.1.4 spec/data/script/images
ymdp-0.1.4 lib/new_application/script/images
ymdp-0.1.3.2 lib/new_application/script/images
ymdp-0.1.3.2 spec/data/script/images
ymdp-0.1.3.1 spec/data/script/images
ymdp-0.1.3.1 lib/new_application/script/images
ymdp-0.1.3 lib/new_application/script/images
ymdp-0.1.3 spec/data/script/images
ymdp-0.1.1 spec/data/script/images
ymdp-0.1.1 lib/new_application/script/images
ymdp-0.1.0 lib/new_application/script/images
ymdp-0.0.17 lib/new_application/script/images
ymdp-0.0.16 lib/new_application/script/images
ymdp-0.0.15 lib/new_application/script/images