-
Notifications
You must be signed in to change notification settings - Fork 2
/
dbicx-autodoc
executable file
·127 lines (85 loc) · 2.76 KB
/
dbicx-autodoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/local/bin/perl -w
use strict;
use warnings;
use FindBin qw( $Bin );
use lib "$Bin/lib";
use Getopt::Long;
use Pod::Usage;
use DBICx::AutoDoc;
our $VERSION = '0.03';
Getopt::Long::Configure( "bundling" );
my ( %config );
GetOptions(
'help' => \my $help,
'list' => \my $list,
'template=s' => \my @templates,
'include|I=s' => \my @lib,
'lib|l' => sub { lib->import( 'lib' ) },
'blib|b' => sub { require blib; blib->import },
'connect!' => \$config{ 'connect' },
'schema|S=s' => \$config{ 'schema' },
'dsn=s' => \$config{ 'dsn' },
'user=s' => \$config{ 'user' },
'pass=s' => \$config{ 'pass' },
'output=s' => \$config{ 'output' },
'graphviz_command=s' => \$config{ 'graphviz_command' },
'graphviz-command=s' => \$config{ 'graphviz_command' },
'include_path=s' => \$config{ 'include_path' },
'include-path=s' => \$config{ 'include_path' },
);
lib->import( @lib ) if @lib;
for my $key ( keys %config ) {
if ( ! defined $config{ $key } ) { delete $config{ $key } }
}
for my $x (qw( graphviz_command )) {
if ( $config{ $x } ) {
$config{ $x } = [ split( ' ', $config{ $x } ) ];
}
}
if ( $help ) { pod2usage( 0 ) }
pod2usage( "$0: Need the schema to document!" ) unless $config{ 'schema' };
my $autodoc = DBICx::AutoDoc->new( %config );
if ( $list ) {
for ( $autodoc->list_templates ) { print "$_\n" }
exit;
}
if ( @templates ) {
$autodoc->fill_templates( @templates );
} else {
$autodoc->fill_all_templates;
}
exit 0;
__END__
=head1 NAME
dbicx-autodoc - Document a DBIx::Class::Schema object
=head1 SYNOPSIS
Document the ExampleDB schema into the current directory:
dbicx-autodoc --schema=ExampleDB
Document the ExampleDB schema, but put the output files into /tmp:
dbicx-autodoc --schema=ExampleDB --output=/tmp
See C<perldoc dbicx-autodoc> for more information.
=head1 OPTIONS
See L<DBICx::AutoDoc> for more detailed explanation of some of these options.
=head2 --help
=head2 --list
=head2 --template=<template>
=head2 --include=<path> or -I <path>
=head2 --lib or -l
=head2 --blib or -b
=head2 --connect
=head2 --schema=<class>
=head2 --dsn=<dsn>
=head2 --user=<user>
=head2 --pass=<password>
=head2 --output=<directory>
=head2 --graphviz-command=<command>
=head2 --include-path=<directory>
=head1 SEE ALSO
L<DBICx::AutoDoc|DBICx::AutoDoc>,
L<http://www.jasonkohles.com/projects/DBICx-AutoDoc>.
=head1 AUTHOR
Jason Kohles C<< <[email protected]> >>
=head1 LICENSE
This program is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut