The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Smolder::DB::Project

DESCRIPTION

Class::DBI based model class for the 'project' table in the database.

METHODS

ACCESSSOR/MUTATORS

Each column in the borough table has a method with the same name that can be used as an accessor and mutator.

The following columns will return objects instead of the value contained in the table:

start_date

This is a DateTime object representing the datetime stored.

OBJECT METHODS

developers

Returns an array of all Smolder::DB::Developer objects associated with this Project (using the project_developer join table.

has_developer

Return true if the given Smolder::DB::Developer object is considered a member of this Project.

    if( ! $project->has_developer($dev) ) {
        return "Unauthorized!";
    }

admins

Returns a list of Smolder::DB::Developer objects who are considered 'admins' for this Project

is_admin

Returns true if the given Smolder::DB::Developer is considered an 'admin' for this Project.

    if( $project->is_admin($developer) {
    ...
    }

clear_admins

Removes the 'admin' flag from any Developers associated with this Project.

set_admins

Given a list of Developer id's, this method will set each Developer to be an admin of the Project.

all_reports

Returns a list of Smolder::DB::SmokeReport objects that are associate with this Project in descending order (by default). You can provide optional 'limit' and 'offset' parameters which will control which reports (and how many) are returned.

You can additionally specify a 'direction' parameter to specify the order in which they are returned.

    # all of them
    my @reports = $project->all_reports();

    # just 5 most recent
    @reports = $project->all_reports(
        limit => 5
    );

    # the next 5
    @reports = $project->all_reports(
        limit   => 5,
        offset  => 5,
    );

    # in ascendig order
    @reports = $project->all_reports(
        direction   => 'ASC',
    );

report_count

The number of reports associated with this Project. Can also provide an optional tag to use as well

report_graph_data

Will return an array of arrays (based on the given fields) that is suitable for feeding to GD::Graph. To limit the date range used to build the data, you can also pass a 'start' and 'stop' DateTime parameter.

    my $data = $project->report_graph_data(
        fields  => [qw(total pass fail)],
        start   => $start,
        stop    => DateTime->today(),
    );

platforms

Returns an arrayref of all the platforms that have been associated with smoke tests uploaded for this project.

architectures

Returns a list of all the architectures that have been associated with smoke tests uploaded for this project.

tags

Returns a list of all of tags that have been added to smoke reports for this project (in the smoke_report_tag table).

    # returns a simple list of scalars
    my @tags = $project->tags();

    # returns a hash of the tag value and count, ie { tag => 'foo', count => 20 }
    my @tags = $project->tags(with_counts => 1);

delete_tag

Deletes a tag in the smoke_report_tag table for Smoke Reports associated with this Project.

    $project->delete_tag("Something Old");

change_tag

This method will change a tag of project's smoke reports into some other tag

    $project->change_tag('Something', 'Something Else');

graph_start_datetime

Returns a DateTime object that represents the real date for the value stored in the 'graph_start' column. For example, if the current date were March 17, 2006 and the project was started on Feb 20th, 2006 then the following values would become the following dates:

    project => Feb 20th, 2006
    year    => Jan 1st,  2006
    month   => Mar 1st,  2006
    week    => Mar 13th, 2006
    day     => Mar 17th, 2006

purge_old_reports

This method will check to see if the ProjectFullReportsMax configuration limit has been reached for this project and delete the tap archive files associated with those reports, also marking the reports as purged.

most_recent_report

Returns the most recent Smolder::DB::SmokeReport object that was added.

CLASS METHODS

all_names

Returns an array containing all the names of all existing projects. Can receive an extra arg that is the id of a project who's name should not be returned.