File: DBICSgen.pm

package info (click to toggle)
libdbix-class-helpers-perl 2.036000-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,008 kB
  • sloc: perl: 5,041; sql: 537; makefile: 7
file content (84 lines) | stat: -rw-r--r-- 1,450 bytes parent folder | download | duplicates (4)
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
package Dist::Zilla::Plugin::DBICSgen;

use strict;
use warnings;

# ABSTRACT: common tests to check syntax of your modules

use Moose;
use Module::Runtime 'use_module';
require lib;

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

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

has lib => ( is => 'rw' );

unlink $_ for glob 't/lib/*.sql';

sub gather_files {
   my $self = shift;

   lib->import(split q(,), $self->lib);

   my $schema = $self->schema;
   use_module($schema);

   $schema->generate_ddl;

   $self->add_file( Dist::Zilla::File::OnDisk->new(name => $_))
      for glob 't/lib/*.sql';
}

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