def produce(epubfile, basedir = nil, tmpdir = nil)
      current = Dir.pwd
      basedir ||= current

      new_tmpdir = tmpdir.nil? ? Dir.mktmpdir : tmpdir
      if epubfile !~ %r{\A/}
        epubfile = "#{current}/#{epubfile}"
      end

      # FIXME: error check
      File.unlink(epubfile) if File.exist?(epubfile)

      begin
        @epub.produce(epubfile, basedir, new_tmpdir)
      ensure
        FileUtils.rm_r(new_tmpdir) if tmpdir.nil?
      end
    end
def produce(epubfile, basedir = nil, tmpdir = nil)
      current = Dir.pwd
      basedir ||= current

      new_tmpdir = tmpdir.nil? ? Dir.mktmpdir : tmpdir
      if epubfile !~ %r{\A/}
        epubfile = "#{current}/#{epubfile}"
      end

      # FIXME: error check
      File.unlink(epubfile) if File.exist?(epubfile)

      begin
        @epub.produce(epubfile, basedir, new_tmpdir)
      ensure
        FileUtils.rm_r(new_tmpdir) if tmpdir.nil?
      end
    end
Produce EPUB file +epubfile+.
 +basedir+ points the directory has contents (default: current directory.)
 +tmpdir+ defines temporary directory.