beginning to maybe kind of prototype moosedoc. still very far from workable. very far
[gitmo/MooseX-AutoDoc.git] / bin / moosedoc
CommitLineData
eb98268f 1#!/usr/bin/perl -w
2
3package MooseDoc;
4use lib 'lib';
5use Moose;
6use MooseX::AutoDoc;
7
8with 'MooseX::SimpleConfig';
9with 'MooseX::Getopt';
10
11has lib => (is => 'rw', isa => 'ArrayRef', predicate => 'has_lib');
12has append => (is => 'rw', isa => 'Bool', required => 1, default => sub { 0 });
13has authors => (is => 'rw', isa => 'HashRef', predicate => 'has_authors');
14has '+configfile' => ( default => '~/.moosedoc' ) if -e '~/.moosedoc';
15
16has _autodoc => (is => 'ro', isa => 'MooseX::AutoDoc', lazy_build => 1);
17
18sub _build__autodoc{
19 my $self = shift;
20 MooseX::AutoDoc->new
21 (
22 $self->has_authors ? (authors => $self->authors) : ()
23 );
24}
25
26sub get_docs_for{
27 my ($self, $package) = @_;
28
29 $self->_autodoc->generate_pod_for( $package );
30}
31
321;
33
34package main;
35
36my $app = MooseDoc->new_with_options();
37push(@INC, @{ $app->lib }) if $app->has_lib;
38push(@INC, './lib') if ! $app->has_lib && -e './lib' && -d './lib';
39
40#{
41# local $, = "\n"; print @INC;
42#}
43my @packages = @{ $app->extra_argv };
44for my $package (@packages){
45
46 my $docs = $app->get_docs_for( $package );
47 #print or append logic goes here.
48 print $docs;
49}