#-- # __ __ _ __ _ # | \/ |__ _ _ _ (_)/ _|___ __| |_ # | |\/| / _` | ' \| | _/ -_|_-< _| # |_| |_\__,_|_||_|_|_| \___/__/\__| # #++ require 'digest/md5' module Reap # = Manifest # # Create a manifest file for the package. Presently it is a very simple # md5 + filename manifest. In the future this will be exanded to build # a varity of manifest formats. # # Task specific settings: # # include Files to include # exclude Files to exclude # class Manifest include TaskUtils MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~' ] #, 'dist', 'pkg' ] attr_accessor :dir, :include, :exclude def initialize( man ) @dir = '.' @include = ['**/*'] @exclude = [] super @exclude |= MUST_EXCLUDE end # Generate manifest file. def generate #( type=nil ) manifest_file = File.join( File.expand_path( @dir ), 'MANIFEST' ) package_files = FileList.new package_files.include(*@include) package_files.exclude(*@exclude) #if @exclude and not @exclude.empty? File.open( manifest_file, 'w+') do |f| package_files.each do |pf| f << "#{salt(pf)} #{pf}\n" if File.file?(pf) end end end alias_method :call, :generate private def salt( file ) Digest::MD5.new( File.read( file ) ).hexdigest end end end #module Reap