Changeset 1759

Show
Ignore:
Timestamp:
01/15/06 18:42:46
Author:
miyagawa
Message:

now uses Archive::Any::Create to support tar.gz export

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Kwiki-Export/trunk/Changes

    r1746 r1759  
    11Revision history for Perl extension Kwiki::Export 
     2 
     30.02  2006-01-15T09:41:46Z 
     4        - Now support tar.gz export using Archive::Any::Create 
    25 
    360.01  Fri Jan 13 08:41:33 2006 
  • Kwiki-Export/trunk/META.yml

    r1746 r1759  
    22#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX# 
    33name:         Kwiki-Export 
    4 version:      0.01 
     4version:      0.02 
    55version_from: lib/Kwiki/Export.pm 
    66installdirs:  site 
    77requires: 
     8    Archive::Any::Create:          0 
    89    HTML::WikiConverter:           0.5 
    910    Kwiki:                         0 
  • Kwiki-Export/trunk/Makefile.PL

    r1746 r1759  
    77        Kwiki => 0, 
    88        HTML::WikiConverter => 0.50, 
     9        Archive::Any::Create => 0, 
    910    }, 
    1011); 
  • Kwiki-Export/trunk/lib/Kwiki/Export.pm

    r1746 r1759  
    44use Kwiki; 
    55 
    6 our $VERSION = '0.01'; 
     6our $VERSION = '0.02'; 
    77 
    88const class_id => 'export'; 
     
    1111const config_file => 'export.yaml'; 
    1212 
    13 use Archive::Zip
     13use Archive::Any::Create
    1414use DirHandle; 
    1515use File::Spec; 
     
    5151sub export_all { 
    5252    my $formatter = shift; 
    53     my $name = "kwiki-$formatter.zip"; 
    54     my $zip = Archive::Zip->new; 
    55     $zip->addDirectory("kwiki-$formatter/"); 
     53    my $ext  = $self->hub->config->export_format; 
     54    my $name = "kwiki-$formatter.$ext"; 
     55    my $archive = Archive::Any::Create->new; 
     56    $archive->container("kwiki-$formatter"); 
    5657    for my $page ($self->pages->all) { 
    5758        my $newformat = $self->convert_wiki($page->to_html, $formatter); 
    58         $zip->addString($newformat, "kwiki-$formatter/" . $page->id); 
     59        $archive->add_file($page->id, $newformat); 
    5960    } 
    6061 
    6162    print "Content-Type: application/octet-stream; name=$name\r\n", 
    6263        "Content-Disposition: attachment; filename=$name\r\n\r\n"; 
    63     $zip->writeToFileHandle(\*STDOUT); 
     64    $archive->write_filehandle(\*STDOUT, $ext); 
    6465    return ''; 
    6566} 
     
    131132__config/export.yaml__ 
    132133default_export: Kwiki 
     134export_format: zip 
    133135__template/tt2/export_content.html__ 
    134136<form method="POST">