Sha256: 91e4ef100585d4ecf543087d0e6f18cca2416dc1ed16d346e1950f686a54cfe3

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'reap/task'
require 'digest/md5'

#  __  __           _  __        _     _____        _
# |  \/  |__ _ _ _ (_)/ _|___ __| |_  |_   _|_ _ __| |__
# | |\/| / _` | ' \| |  _/ -_|_-<  _|   | |/ _` (_-< / /
# |_|  |_\__,_|_||_|_|_| \___/__/\__|   |_|\__,_/__/_\_\
#

# = Manifest Task

class Reap::Manifest < Reap::Task

  MUST_EXCLUDE = [ 'InstalledFiles', '**/CVS/**/*', '**/*~', 'dist', 'pkg' ]

  #section_required true

  task_desc "Create a MANIFEST file for this package."

  task_help %{

    reap manifest

    Creates a manifest file for the package.

      include       user name to use
      exclude       group name to use

  }

  alias_method :man, :task

  def run

    man.include      ||= ['**/*']

    man.exclude      ||= []
    man.exclude      |= MUST_EXCLUDE

    package_files = FileList.new
    package_files.include(*man.include)
    package_files.exclude(*man.exclude) if man.exclude and not man.exclude.empty?

    File.open('MANIFEST', 'w+') do |f|
      package_files.each do |pf|
        f << "#{salt(pf)} #{pf}\n" if File.file?(pf)
      end
    end

  end

  # support functions
  def salt( file )
    Digest::MD5.new( File.read( file ) ).hexdigest
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reap-4.4.0 lib/reap/task/manifest.rb
reap-4.4.1 lib/reap/task/manifest.rb