Pinto
view release on metacpan or search on metacpan
lib/Pinto/Schema/Result/Distribution.pm view on Meta::CPAN
use utf8;
package Pinto::Schema::Result::Distribution;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
extends 'DBIx::Class::Core';
__PACKAGE__->table("distribution");
__PACKAGE__->add_columns(
"id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"author", { data_type => "text", is_nullable => 0 },
"archive", { data_type => "text", is_nullable => 0 },
"source", { data_type => "text", is_nullable => 0 },
"mtime", { data_type => "integer", is_nullable => 0 },
"sha256", { data_type => "text", is_nullable => 0 },
"md5", { data_type => "text", is_nullable => 0 },
"metadata", { data_type => "text", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint( "author_archive_unique", [ "author", "archive" ] );
__PACKAGE__->has_many(
"packages",
"Pinto::Schema::Result::Package",
{ "foreign.distribution" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"prerequisites",
"Pinto::Schema::Result::Prerequisite",
{ "foreign.distribution" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"registrations",
"Pinto::Schema::Result::Registration",
{ "foreign.distribution" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
with 'Pinto::Role::Schema::Result';
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-03-26 11:05:47
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vQKIXXk8xddyMmBptwvpUg
#-------------------------------------------------------------------------------
# ABSTRACT: Represents a distribution archive
#-------------------------------------------------------------------------------
use URI;
use CPAN::Meta;
use Path::Class;
use CPAN::DistnameInfo;
use String::Format;
use Pinto::Util qw(itis debug whine throw);
use Pinto::DistributionSpec;
use overload (
'""' => 'to_string',
'cmp' => 'string_compare'
);
#------------------------------------------------------------------------------
our $VERSION = '0.097'; # VERSION
#------------------------------------------------------------------------------
__PACKAGE__->inflate_column(
'metadata' => {
inflate => sub { CPAN::Meta->load_json_string( $_[0] ) },
deflate => sub { $_[0]->as_string( { version => "2" } ) }
}
);
#------------------------------------------------------------------------------
sub FOREIGNBUILDARGS {
my ( $class, $args ) = @_;
$args ||= {};
$args->{source} ||= 'LOCAL';
return $args;
}
#------------------------------------------------------------------------------
sub register {
my ( $self, %args ) = @_;
my $stack = $args{stack};
my $pin = $args{pin};
my $did_register = 0;
( run in 0.575 second using v1.01-cache-2.11-cpan-5837b0d9d2c )