Commits

Anonymous committed 073d733

Added the docmake.

Comments (0)

Files changed (3)

modules/App-XML-DocBook-Docmake/MANIFEST

 bin/docmake
 Build.PL
 Changes
+lib/App/XML/DocBook/Builder.pm
+lib/App/XML/DocBook/Docmake.pm
 MANIFEST
 META.yml # Will be created by "make dist"
 README
-lib/App/XML/DocBook/Builder.pm
 t/00-load.t
 t/boilerplate.t
 t/pod-coverage.t

modules/App-XML-DocBook-Docmake/bin/docmake

 #!/usr/bin/perl
 
-use lib "$ENV{HOME}/apps/docbook-builder/lib/perl5/site_perl/5.8.8/";
-
 use strict;
 use warnings;
 
-use Getopt::Long;
+use App::XML::DocBook::Docmake;
 
-use App::XML::DocBook::Builder;
+my $docmake = App::XML::DocBook::Docmake->new();
 
-my $app = App::XML::DocBook::Builder->new();
+exit($docmake->run({argv => [@ARGV]}));
 
-my $command = shift(@ARGV);
-
-if ($command eq "setup")
-{
-    my $base;
-    GetOptions(
-        'base=s' => \$base,
-    );
-    if (!defined ($base))
-    {
-        die "Usage: docmake setup --base=\$my_doc_base";
-    }
-    $app->initialize_makefiles({doc_base => $base});
-}
-else
-{
-    die "Unknown command!";
-}
-

modules/App-XML-DocBook-Docmake/lib/App/XML/DocBook/Docmake.pm

+package App::XML::DocBook::Docmake;
+
+use Getopt::Long qw(GetOptionsFromArray);
+
+use base 'Class::Accessor';
+
+=head1 NAME
+
+App::XML::DocBook::Docmake - translate DocBook/XML to other formats
+
+=head1 VERSION
+
+Version 0.01
+
+=cut
+
+__PACKAGE__->mk_accessors(qw(
+    _input_path
+    _mode
+    _output_path
+));
+
+=head1 SYNOPSIS
+
+    use App::XML::DocBook::Docmake;
+
+    my $docmake = App::XML::DocBook::Docmake->new({argv => [@ARGV]});
+
+    $docmake->run()
+
+=head1 FUNCTIONS
+
+=head2 my $obj = App::XML::DocBook::Docmake->new({argv => [@ARGV]})
+
+Instantiates a new object.
+
+=cut
+
+sub new
+{
+    my $class = shift;
+    my $self = {};
+
+    bless $self, $class;
+
+    $self->_init(@_);
+
+    return $self;
+}
+
+sub _init
+{
+    my ($self, $args) = @_;
+
+    my $argv = $args->{'argv'};
+
+    my $output_path;
+
+    my $ret = GetOptionsFromArray($argv,
+        "o=s" => \$output_path,
+    );
+
+    $self->_output_path($output_path);
+
+    my $mode = shift(@$argv);
+
+    if ($mode eq "html")
+    {
+        $self->_mode($mode);
+    }
+    else
+    {
+        die "Unknown mode \"$mode\"";
+    }
+
+    my $input_path = shift(@$argv);
+
+    if (!defined($input_path))
+    {
+        die "Input path not specified on command line";
+    }
+
+    $self->_input_path($input_path);
+
+    return;
+}
+
+=head2 $docmake->run()
+
+Runs the object.
+
+=cut
+
+sub run
+{
+    my $self = shift;
+
+    return system("xsltproc",
+        "-o", $self->_output_path(),
+        "docbook-xsl/html/docbook.xsl",
+        $self->_input_path(),
+    );  
+}
+
+
+=head1 AUTHOR
+
+Shlomi Fish, C<< <shlomif at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-app-docbook-xml-docmake at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App::XML::DocBook::Docmake>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc App::XML::DocBook::Docmake
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/App::XML::DocBook::Docmake>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/App::XML::DocBook::Docmake>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=App::XML::DocBook::Docmake>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/App::XML::DocBook::Docmake>
+
+=back
+
+=head1 ACKNOWLEDGEMENTS
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2008 Shlomi Fish, all rights reserved.
+
+This program is released under the following license: MIT/X11 License.
+( L<http://www.opensource.org/licenses/mit-license.php> ).
+
+=cut
+
+1;
+