File: DBICSgen.pm

package info (click to toggle)
libdbix-class-helpers-perl 2.013002-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 420 kB
  • sloc: perl: 1,931; sql: 73; makefile: 2
file content (90 lines) | stat: -rw-r--r-- 1,548 bytes parent folder | download
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
package inc::Dist::Zilla::Plugin::DBICSgen;

use strict;
use warnings;

# ABSTRACT: common tests to check syntax of your modules

use Moose;
use Class::MOP;
require lib;

with 'Dist::Zilla::Role::FileGatherer';

has schema => (
   is       => 'ro',
   isa      => 'Str',
   required => 1,
);

has lib => (
   is       => 'rw',
   isa      => 'ArrayRef',
   default  => sub { [qw{lib}] },
);

sub mvp_multivalue_args { qw(lib) }

unlink 't/lib/ddl.sql';

sub gather_files {
   my $self = shift;

   lib->import(@{$self->lib});

   my $schema = $self->schema;
   Class::MOP::load_class($schema);

   $schema->generate_ddl;

   my $file = Dist::Zilla::File::OnDisk->new(name => $schema->ddl_filename);
   $self->add_file($file);
}

no Moose;
__PACKAGE__->meta->make_immutable;
1;

=begin Pod::Coverage

gather_files
mvp_multivalue_args

=end Pod::Coverage


=head1 SYNOPSIS

In your dist.ini:

    [CompileTests]
    skip = Test$

=head1 DESCRIPTION

This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing
the following files:

=over 4

=item * t/00-compile.t - a standard test to check syntax of bundled modules

This test will find all modules and scripts in your dist, and try to
compile them one by one. This means it's a bit slower than loading them
all at once, but it will catch more errors.

=back


This plugin accepts the following options:

=over 4

=item * skip: a regex to skip compile test for modules matching it. The
match is done against the module name (C<Foo::Bar>), not the file path
(F<lib/Foo/Bar.pm>).

=back