Sha256: d1c0b88f8adafcfc4ee305672b95d184c5fd912bdeff95aafec77eba52b37e16

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

# Cleans up a CVS co of log4r for distribution

require 'ftools'
require 'devconfig'

if ARGV.size != 1
  puts "Usage: prune.rb <projectdir>"
  exit
end

$projhome = (ARGV[0] or ".")
$echo = nil     # change to "echo" if need to debug, otherwise nil

# recursively delete any such directory or file with rm -rf
recursedel = %w{ CVS }
# some dirs aren't checked out with -r, so create them
mkdirs = %w{ tests/logs examples/logs }

def run(cmd)
  unless system cmd
    raise RuntimeError, "unable to finish '#{cmd}'", caller
    exit
  end
end

Dir.chdir $projhome

for dir in recursedel 
  run "find . -name #{dir} -exec #{$echo} rm -rf {} \\; -prune"
end
for dir in $deletedirs
  run "#{$echo} rm -rf #{dir}"
end
for file in $deletefiles
  run "#{$echo} rm -f #{file}"
end
File.makedirs *mkdirs

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
log4r-1.1.0 bin/prune.rb