| 1 | # | ||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||
| 3 | # | ||||||||||
| 4 | # vim: set ts=3 sw=3 tw=0: | ||||||||||
| 5 | # vim: set expandtab: | ||||||||||
| 6 | |||||||||||
| 7 | package Rex::JobControl::Mojolicious::Plugin::Project; | ||||||||||
| 8 | 1 | $Rex::JobControl::Mojolicious::Plugin::Project::VERSION = '0.18.0'; | |||||||||
| 9 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use Mojolicious::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Digest::MD5 'md5_hex'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use Rex::JobControl::Helper::Project; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | use base 'Mojolicious::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | sub register { | ||||||||
|
Subroutine
register: called CC=1 SCAR=4.1
Pod
documented
| |||||||||||
| 19 | 1 | my ( $plugin, $app ) = @_; | |||||||||
| 20 | |||||||||||
| 21 | $app->helper( | ||||||||||
| 22 | 0 | ▶ | project => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 23 | 0 | my ( $self, $directory ) = @_; | |||||||||
| 24 | |||||||||||
| 25 | 0 | my $name = $directory; | |||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | if ( $directory !~ m/^[a-f0-9]{32}$/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | # no md5sum, compat. code | ||||||||||
| 30 | 0 | $directory = md5_hex($directory); | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 0 | my $u = Rex::JobControl::Helper::Project->new( | |||||||||
| 34 | directory => $directory, | ||||||||||
| 35 | name => $name, | ||||||||||
| 36 | app => $app | ||||||||||
| 37 | ); | ||||||||||
| 38 | 0 | return $u; | |||||||||
| 39 | } | ||||||||||
| 40 | 1 | ); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 1 | 1; | |||||||||