Amon2

 view release on metacpan or  search on metacpan

script/amon2-setup.pl  view on Meta::CPAN

    my $dir = File::Spec->catdir(split /::/, $prefix);

    my @results;
    my %seen;
    foreach my $base(map { File::Spec->catdir($_, $dir) } @INC) {
        next unless -d $base;

        File::Find::find({
                wanted => sub {
                    return unless -r;
                    my $name = File::Spec->abs2rel($_, $base);
                    $name =~ s/\.pm$// or return;

                    $seen{$name}++ and return;

                    push @results, join '::', File::Spec->splitdir($name);
                },
                no_chdir => 1,
            }, $base);
    }

    for my $moniker (sort @results) {
        my $module = eval {
            Plack::Util::load_class($moniker, $prefix);
        };
        # extract short description
        my $content = do {
            open my $fh, "<", $INC{join("/", split "::", $module).".pm"};
            local $/;
            <$fh>;
        };
        my($description) = $content =~ m{
            ^=head1 \s+ NAME
            \s+
            \Q$module\E \s+ - \s+ ([^\n]+)
        }xms;
        if (defined $description) {
            print $moniker, " - ", $description, "\n";
        }
        else {
            print $moniker, "\n";
        }
    }

    exit;
}

__END__

=head1 NAME

amon2-setup.pl - setup script for amon2

=head1 SYNOPSIS

    % amon2-setup.pl MyApp

        --flavor=Basic      basic flavour (default)
        --flavor=Lite       Amon2::Lite flavour (need to install)
        --flavor=Minimum    minimalistic flavour for benchmarking
        --flavor=Standalone CPAN uploadable web application(EXPERIMENTAL)

        --vc=Git         setup the git repository (default)

        --list-flavors (or -l) Shows the list of flavors installed

        --help   Show this help

=head1 DESCRIPTION

This is a setup script for Amon2.

amon2-setup.pl is highly extensible. You can write your own flavor.

=head1 HINTS

You can specify C<< --flavor >> option multiple times. For example, you can
type like following:

    % amon2-setup.pl --flavor=Basic --flavor=Teng MyApp

    % amon2-setup.pl --flavor=Teng,Basic MyApp

Second flavor can overwrite files generated by first flavor.

=head1 AUTHOR

Tokuhiro Matsuno

=cut



( run in 3.220 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )