# File lib/rubigen/commands.rb, line 382
      def write_manifest(relative_destination)
        files = ([relative_destination] + Dir["#{destination_root}/**/*"])
        files.reject! { |file| File.directory?(file) }
        files.map! { |path| path.sub("#{destination_root}/","") }
        files = files.uniq.sort


        destination         = destination_path(relative_destination)
        destination_exists  = File.exists?(destination)

        # Check for and resolve file collisions.
        if destination_exists
          # Always recreate the Manifest (perhaps we need to give the option... like normal files)
          choice = :force
          logger.force(relative_destination)

        # File doesn't exist so log its unbesmirched creation.
        else
          logger.create relative_destination
        end

        # If we're pretending, back off now.
        return if options[:pretend]

        # Write destination file with optional shebang.  Yield for content
        # if block given so templaters may render the source file.  If a
        # shebang is requested, replace the existing shebang or insert a
        # new one.
        File.open(destination, 'wb') do |dest|
          dest.write files.join("\n")
          dest.write "\n"
        end

        # Optionally add file to subversion
        system("svn add #{destination}") if options[:svn]
      end