From b9fb28ca730a0f55c592d97ee190d57e1d2dfa13 Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Sat, 16 Sep 2006 17:14:59 +0000 Subject: [PATCH] attic-me.rb: script to find "orphaned" resources that can be moved out of the main build tree and into the attic. --- sprites/jond/placeholder/.Makefile.swp | 0 tools/attic-me.rb | 33 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) delete mode 100644 sprites/jond/placeholder/.Makefile.swp create mode 100755 tools/attic-me.rb diff --git a/sprites/jond/placeholder/.Makefile.swp b/sprites/jond/placeholder/.Makefile.swp deleted file mode 100644 index e69de29b..00000000 diff --git a/tools/attic-me.rb b/tools/attic-me.rb new file mode 100755 index 00000000..022600a5 --- /dev/null +++ b/tools/attic-me.rb @@ -0,0 +1,33 @@ +#!/usr/bin/ruby +# attic-me.rb: find resources not symlinked to for moving to attic +# (c) 2006 Jon Dowland , see "COPYING" file +# vim: set ts=2: +require "find" + +class Regexp # mass match with [].include? + def ==(str); self.match(str); end +end + +class AtticMe < File + @@ignore = [ + /\.$/, /\.svn/, /\.txt$/i, /\.bmp$/i, + "Makefile", /aoddoom_skeletons/, + ] + + def AtticMe.main + [ "flats", "graphics", "levels", + "musics", "patches", "sounds", + "textures", "lumps", "sprites", + ].each do |dir| + files = [] + linked_to = [] + Find.find(dir) { |f| + Find.prune if @@ignore.include?(basename(f)) + files << expand_path(f) if file?(f) and not symlink?(f) + linked_to << expand_path(dir+Separator+readlink(f)) if symlink?(f) + } + puts (files - linked_to).join("\n") + end + end +end +AtticMe.main