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

NAME

RTDevSys::Util - Utility functions for RTDevSys

EARLY VERSION WARNING

This is a very early version of RTDevSys. It is ready for use, and in fact is being used. However there may be some API changes in the future. As well there may be some missing, incomplete, or untested features. At the moment the database commands only support postgres not mysql.

DESCRIPTION

This module provides several utility functions used all over RTDevSys.

SYNOPSIS

    use RTDevSys qw(workflow_path workflow_list plugin_list include_list
                    run_command load_initialdata strip_lead add_inc);

EXPORTED FUNCTIONS

workflow_list()

Returns an arrayref containing the names of all the workflows within the workflow directory. If the optional first parameter is true then prefixed numbwers will be listed as well.

    print "$_\n" for @{ workflow_list() };
    # WorkflowA
    # WorkflowB
    # workflowC

    print "$_\n" for @{ workflow_list( 1 ) };
    # 001-WorkflowA
    # 002-WorkflowB
    # 003-WorkflowC

Note: Workflows are any directory not prefixed by a '.' within the workflows directory. Workflow directories may be prefixed by a number ( ###-Name ), but do not need to be. The number is used for sorting only. When refering to a workflow in code you generally do not use its prefix.

workflow_path()

Takes one argument, name of the workflow in question. Returns the name of the folder the workflow is contained in. Note this does not include the full path, just the workflow directory.

plugin_list()

Returns an arrayref of plugin names. Similar to workflow_list()

include_list()

Returns a list of include directories that should be added to @INC. These are usually the RT installation folder library paths. It also includes the ./lib dir, and ~/RTDevSys/lib/perl5 (for locallib users).

run_command()

Runs the specified command through system(). Before running the command however it sets a local %ENV to match RTDevSys's environment variables. Will die if the command does not exit cleanly.

load_initialdata

Takes an initialdata filename as an argument. Will load the initialdata file using rt-setup-database.

strip_lead()

Strips the ###- from the beginning of a workflow name.

    my $name = strip_lead( '001-Name' );
    print $name;
    # prints: Name
add_inc()

Will add all the paths from include_list() to @INC.

This will take action once.

AUTHORS

Chad Granum <chad@opensourcery.com>

COPYRIGHT

Copyright 2009 OpenSourcery, LLC.

This file is part of RTDevSys

RTDevSys is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

RTDevSys is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with RTDevSys. If not, see <http://www.gnu.org/licenses/>.