updated git and svn scripts
[xrzperl.git] / epub_make
blobbe46ec2373894bfa0c3202cbb2a747ec32981d33
1 #!/usr/bin/perl -w
2 ###APPNAME: epubmake
3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Wed Apr 28 00:34:14 2010
5 ###APPVER: 0.1
6 ###APPDESC: epubmake
7 ###APPUSAGE:
8 ###APPEXAMPLE: epubmake
9 ###APPOPTION:
10 use strict;
12 #ENV variable MUST be defined somewhere,
13 #FOR perl to search modules from,
14 #OR nothing will work
15 use lib $ENV{XR_PERL_MODULE_DIR};
17 use MyPlace::Script::Usage qw/help_required help_even_empty/;
18 #exit 0 if(help_required($0,@ARGV));
19 exit 0 if(help_even_empty($0,@ARGV));
21 use Cwd;
23 my $cwd=getcwd();
25 foreach(@ARGV) {
26 if(-d $_) {
27 my $bookname = $_;
28 $bookname =~ s/^.*[\/\\]//;
29 $bookname =~ s/[\/\\]+$//;
30 chdir $_ or die("$!\n");
31 print STDERR "$bookname.epub ... \n";
32 if(-f "$cwd/$bookname.epub") {
33 print STDERR "Delete $bookname.epub first...\n";
34 unlink "$cwd/$bookname.epub";
36 die("$!\n") unless(system("zip","-rXDq","$cwd/$bookname.epub","mimetype",".")==0);
37 # die("$!\n") unless(system("zip","-rXDv","$cwd/$bookname.epub",".")==0);
38 print STDERR "\"$cwd/$bookname.epub\" created.\n";
39 chdir $cwd or die("$!\n");
42 else {
43 print STDERR "Directory:\"$_\" not exist!\n";