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