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

NAME

Devel::PerlySense::Project - A Project root

SYNOPSIS

DESCRIPTION

A Project describes the root directory of a source tree.

A Project has configuration settings.

PROPERTIES

dirProject

The effective project root dir.

Readonly.

dirProjectExplicitDir

If known, the root dir made explicit by the existence of a project directory and config, else ""

Default: ""

dirProjectImplicitUse

If known, the root dir indicated by a found used module, else "".

Default: ""

dirProjectImplicitDir

If known, the root dir indicated by the presence of "lib" or "t", else "".

Default: ""

oConfig

A Config::Project object with the current Project Config. This gets loaded if there is a config file available when the Project is identified.

Default: An Config::Project::Default object

rhConfig

The actual hashref with config values.

Readonly (that includes the entire data structure).

oPerlySense

Devel::PerlySense object.

nameVcs

The name of the Version Control system for the project.

Readonly. Currently supported:

  git
  svn
  none

In that order, so that if there's a Git repo on top of a SVN repo, git is found.

CLASS METHODS

newFromLocation(file => $file, dir => $dir, oPerlySense => $oPs)

Create new Project given either $file, or $dir.

First, search for an explicit project root directory, then try to find any modules used in $file (if passed), then try to find any "lib" or "t" directory upwards of $file or $dir.

$file takes precedence over $dir if both are specified.

If none if this works out, no Project can be created and undef is returned.

Return the new object, or undef if no project could be found.

newFindExplicit(dir => $dir, oPerlySense => $oPs)

Create new Project if there is an explicit .PerlySenseProject directory in the path above $dir.

Return the new object, or undef if no project could be found.

MEHTODS

rhRunFile(file => $fileSource, [rhConfigType = DEDUCED_FROM_FILE], [ keyConfigCommand = "command" ])

Like rhRunFile0, but with what => "run".

rhDebugFile(file => $fileSource, [rhConfigType = DEDUCED_FROM_FILE], [ keyConfigCommand = "command" ])

Like rhRunFile0, but with what => "debug".

rhRunFile0(file => $fileSource, what => "run" | "debug", [rhConfigType = DEDUCED_FROM_FILE], [ keyConfigCommand = "command" ])

Figure out what type of source file $fileSource is, and how it should be run/debugged.

The settings in the global config->{$what_file} is used to determine the details.

The command to use is taken from config->{$what_file}->{$keyConfigCommand}, if that is specified, otherwise for "command".

Return hash ref with (keys: "dir_$what_from", "command_$what", "type_source_file"), or die on errors (like if no Project could be found).

dir_$what_from is an absolute directory name which should be the cwd when command_$what is executed.

type_source_file is something like "Test", "Module".

rhConfigTypeForFile(file => $fileSource, keyConfig => CONFIG_KEY)

Return the config type hash ref (keys: command, moniker) from the ones available in the config. Match the $fileSource name against each rex in the config.

Die if no configType could be identified.

aDirIncProject(dirRelativeTo => $dirRelativeTo)

Return array with dir objects which are the inc_dir directories in the config, plus the usual inc directories. They are all relative to $dirRelativeTo.

aDirIncAbsolute()

Return array with absolute dir objects which are the inc_dir directories in the config, plus the usual inc directories.

isFileInProject(file => $file)

Return true if $file is within the project root, or in any of the INC directories, else false. Die on errors.

Test logically/structurally, not whether the file actually exists.

flymakeFile(file => $fileSource)

Do a flymake run with $fileSource according to the flymake config and output the result to STDOUT and STDERR.

Return 1 or die on errors (but that will look like the result of a failed flymake run).

rhSubCovered(file => $fileSource)

Do a "covered subs" call with $fileSource.

Die if Devel::CoverX::Covered isn't installed.

Return hash ref with (keys: sub name; values: quality)), or an empty hash ref if no coverage info was found for $fileSource.

Any subs with the same name will have their qualities combined.

raFileTestOther(file => $fileSource, [sub => $sub])

Return array ref with file names of files related to $file and possibly $sub, i.e. the "other" files related $file.

If $file is a source file, return test files, and vice verca.

$sub is only ever active when $fileSource is a source file.

Die if Devel::CoverX::Covered isn't installed.

raFileProjectOther(file => $fileSource, [sub => $sub])

Return array ref with file names of files corresponding to $file.

Die if there is no config file.

aFileSourceCode()

Return array with file names with perl source code in the project.

# TODO: also look inside files without extension and check for perlyness

AUTHOR

Johan Lindstrom, <johanl@cpan.org>

BUGS

Please report any bugs or feature requests to bug-devel-perlysense@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2005 Johan Lindstrom, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.