Sha256: 4d7cdf9763f89b9d088dca4216cd498a969932539a1a4ba042a8d220ca233214

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

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

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

# = Manifest Task

class Reap::Manifest < Reap::Task

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

  task_desc "Create a MANIFEST file for this package."

  task_available { Reap.projectfile? }

  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


# Rake interface.

if defined?(Rake)

  #require 'reap/rake/adapter'

  module Rake
    ReapManifest = ::Reap::RakeAdapter( ::Reap::Manifest )
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reap-4.5.2 lib/reap/task/manifest.rb