# File lib/reap/package_task.rb, line 89
  def run
    # create package image
    if FileTest.directory?(@dir)
      print "Directory '#{@dir}' already exists. Clobber? [y/N] "
      until inp = $stdin.gets[0,1] ; sleep 1 ; end
      if (inp || 'y').downcase == 'y'
        puts "Removing old directory '#{File.expand_path(@dir)}'..."
        trash_dir = ".trash/#{File.basename(@dir)}"
        FileUtils.mkdir_p(".trash") unless FileTest.directory?(".trash")
        FileUtils.rm_r(trash_dir) if FileTest.exists?(trash_dir)
        FileUtils.mv(@dir, trash_dir)
      else
        puts "Reap package task canceled."
        exit 0
      end
    end
    package_dir_path = "#{@dir}/#{@package_name}"
    package_files = FileList.new
    package_files.include(*@include)
    package_files.exclude(*@exclude) if @exclude and not @exclude.empty?
    FileUtils.mkdir_p @dir #rescue nil
    package_files.each do |fn|
      f = File.join(package_dir_path, fn)
      fdir = File.dirname(f)
      FileUtils.mkdir_p(fdir) if not File.exist?(fdir)
      if File.directory?(fn)
        FileUtils.mkdir_p(f)
      else
        FileUtils.rm_f(f)
        FileUtils.safe_ln(fn, f)
      end
    end

    # create standard package files
    FileUtils.chdir(@dir) do
      # tar bzip2 for unix
      if @bzip2
        puts "\nReap is shelling out work to tar and bzip2..."
        sh %{tar --bzip2 -cvf #{@package_name}.tbz #{@package_name}}
      end
      # tar gzip for unix
      if @gzip
        puts "\nReap is shelling out work to tar and gzip..."
        sh %{tar --gzip -cvf #{@package_name}.tgz #{@package_name}}
      end
      # zip for windows
      if @zip
        puts "\nReap is shelling out work to zip..."
        sh %{zip -r #{@package_name}.zip #{@package_name}}
      end
      puts
    end

    # create gem package
    run_gem if defined?(Gem) and @gem

    return true
  end