File Coverage

blib/lib/Pinto/Schema/Result/Prerequisite.pm
Criterion Covered Total %
statement 35 35 100.0
branch n/a
condition 1 2 50.0
subroutine 12 12 100.0
pod 0 2 0.0
total 48 51 94.1


line stmt bran cond sub pod time code
1 54     62   44261 use utf8;
  54         140  
  54         648  
2              
3             package Pinto::Schema::Result::Prerequisite;
4              
5             # Created by DBIx::Class::Schema::Loader
6             # DO NOT MODIFY THE FIRST PART OF THIS FILE
7              
8              
9 54     54   2356 use strict;
  54         142  
  54         1182  
10 54     54   276 use warnings;
  54         108  
  54         1800  
11              
12 54     54   279 use Moose;
  54         116  
  54         420  
13 54     54   338403 use MooseX::NonMoose;
  54         127  
  54         449  
14 54     54   282463 use MooseX::MarkAsMethods autoclean => 1;
  54         142  
  54         498  
15             extends 'DBIx::Class::Core';
16              
17              
18             __PACKAGE__->table("prerequisite");
19              
20              
21             __PACKAGE__->add_columns(
22             "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
23             "phase", { data_type => "text", is_nullable => 0 },
24             "distribution", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
25             "package_name", { data_type => "text", is_nullable => 0 },
26             "package_version", { data_type => "text", is_nullable => 0 },
27             );
28              
29              
30             __PACKAGE__->set_primary_key("id");
31              
32              
33             __PACKAGE__->add_unique_constraint(
34             "distribution_phase_package_name_unique",
35             [ "distribution", "phase", "package_name" ],
36             );
37              
38              
39             __PACKAGE__->belongs_to(
40             "distribution",
41             "Pinto::Schema::Result::Distribution",
42             { id => "distribution" },
43             { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
44             );
45              
46              
47             with 'Pinto::Role::Schema::Result';
48              
49             # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-03-26 11:05:47
50             # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p++Wil511AYW5fZ8Xoe4Jg
51              
52             #------------------------------------------------------------------------------
53              
54             # ABSTRACT: Represents a Distribution -> Package dependency
55              
56             #------------------------------------------------------------------------------
57              
58 54     54   299644 use Pinto::Target::Package;
  54         174  
  54         1946  
59              
60 54     54   473 use overload ( '""' => 'to_string' );
  54         118  
  54         416  
61              
62             #------------------------------------------------------------------------------
63              
64             our $VERSION = '0.13'; # VERSION
65              
66             #------------------------------------------------------------------------------
67             # NOTE: We often convert a Prerequsite to/from a PackageSpec object. They don't
68             # use quite the same names for their attributes, so we shuffle them around here.
69              
70             sub FOREIGNBUILDARGS {
71 68     68 0 271 my ( $class, $args ) = @_;
72              
73 68   50     263 $args ||= {};
74 68         423 $args->{package_name} = delete $args->{name};
75 68         329 $args->{package_version} = delete $args->{version};
76              
77 68         466 return $args;
78             }
79              
80             #------------------------------------------------------------------------------
81              
82             has as_target => (
83             is => 'ro',
84             isa => 'Pinto::Target::Package',
85             init_arg => undef,
86             lazy => 1,
87             handles => [qw(is_core is_perl)],
88             default => sub {
89             Pinto::Target::Package->new(
90             name => $_[0]->package_name,
91             version => $_[0]->package_version
92             );
93             },
94             );
95              
96             #------------------------------------------------------------------------------
97              
98             sub to_string {
99 211     211 0 17018 my ($self) = @_;
100              
101 211         6482 return $self->as_target->to_string;
102             }
103              
104             #------------------------------------------------------------------------------
105              
106             for my $phase ( qw(configure build test runtime develop) ) {
107 54     54   15460 no strict 'refs';
  54         119  
  54         6454  
108 8     8   324 *{__PACKAGE__ . "::is_$phase"} = sub {shift->phase eq $phase};
109             }
110              
111             #------------------------------------------------------------------------------
112              
113             __PACKAGE__->meta->make_immutable;
114              
115             #------------------------------------------------------------------------------
116             1;
117              
118             __END__
119              
120             =pod
121              
122             =encoding UTF-8
123              
124             =for :stopwords Jeffrey Ryan Thalhammer
125              
126             =head1 NAME
127              
128             Pinto::Schema::Result::Prerequisite - Represents a Distribution -> Package dependency
129              
130             =head1 VERSION
131              
132             version 0.13
133              
134             =head1 NAME
135              
136             Pinto::Schema::Result::Prerequisite
137              
138             =head1 TABLE: C<prerequisite>
139              
140             =head1 ACCESSORS
141              
142             =head2 id
143              
144             data_type: 'integer'
145             is_auto_increment: 1
146             is_nullable: 0
147              
148             =head2 phase
149              
150             data_type: 'text'
151             is_nullable: 0
152              
153             =head2 distribution
154              
155             data_type: 'integer'
156             is_foreign_key: 1
157             is_nullable: 0
158              
159             =head2 package_name
160              
161             data_type: 'text'
162             is_nullable: 0
163              
164             =head2 package_version
165              
166             data_type: 'text'
167             is_nullable: 0
168              
169             =head1 PRIMARY KEY
170              
171             =over 4
172              
173             =item * L</id>
174              
175             =back
176              
177             =head1 UNIQUE CONSTRAINTS
178              
179             =head2 C<distribution_phase_package_name_unique>
180              
181             =over 4
182              
183             =item * L</distribution>
184              
185             =item * L</phase>
186              
187             =item * L</package_name>
188              
189             =back
190              
191             =head1 RELATIONS
192              
193             =head2 distribution
194              
195             Type: belongs_to
196              
197             Related object: L<Pinto::Schema::Result::Distribution>
198              
199             =head1 L<Moose> ROLES APPLIED
200              
201             =over 4
202              
203             =item * L<Pinto::Role::Schema::Result>
204              
205             =back
206              
207             =head1 AUTHOR
208              
209             Jeffrey Ryan Thalhammer <jeff@stratopan.com>
210              
211             =head1 COPYRIGHT AND LICENSE
212              
213             This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer.
214              
215             This is free software; you can redistribute it and/or modify it under
216             the same terms as the Perl 5 programming language system itself.
217              
218             =cut