define (Rake::PackageTask)

         # File lib/rake/packagetask.rb, line 91
     91:     def define
     92:       fail "Version required (or :noversion)" if @version.nil?
     93:       @version = nil if :noversion == @version
     94:
     95:       desc "Build all the packages"
     96:       task :package
     97:
     98:       desc "Force a rebuild of the package files"
     99:       task :repackage => [:clobber_package, :package]
    100:
    101:       desc "Remove package products"
    102:       task :clobber_package do
    103:         rm_r package_dir rescue nil
    104:       end
    105:
    106:       task :clobber => [:clobber_package]
    107:
    108:       [
    109:         [need_tar, tgz_file, "z"],
    110:         [need_tar_gz, tar_gz_file, "z"],
    111:         [need_tar_bz2, tar_bz2_file, "j"]
    112:       ].each do |(need, file, flag)|
    113:         if need
    114:           task :package => ["#{package_dir}/#{file}"]
    115:           file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
    116:             chdir(package_dir) do
    117:               sh %{tar #{flag}cvf #{file} #{package_name}}
    118:             end
    119:           end
    120:         end
    121:       end
    122:
    123:       if need_zip
    124:         task :package => ["#{package_dir}/#{zip_file}"]
    125:         file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
    126:           chdir(package_dir) do
    127:             sh %{zip -r #{zip_file} #{package_name}}
    128:           end
    129:         end
    130:       end
    131:
    132:       directory package_dir
    133:
    134:       file package_dir_path => @package_files do
    135:         mkdir_p package_dir rescue nil
    136:         @package_files.each do |fn|
    137:           f = File.join(package_dir_path, fn)
    138:           fdir = File.dirname(f)
    139:           mkdir_p(fdir) if !File.exist?(fdir)
    140:           if File.directory?(fn)
    141:             mkdir_p(f)
    142:           else
    143:             rm_f f
    144:             safe_ln(fn, f)
    145:           end
    146:         end
    147:       end
    148:       self
    149:     end