PS1/Plugin/Node.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 53.1% 17 / 32 CC 4 SCAR 24.7
CC
4
Cov
48%
node
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« PS1.pm ↑ Summary PS1/Plugin/Env.pm »
1 package App::PS1::Plugin::Node;
2  
3 # Created on: 2011-06-21 09:48:47
4 # Create by: Ivan Wills
5 # $Id$
6 # $Revision$, $HeadURL$, $Date$
7 # $Revision$, $Source$, $Date$
8  
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 1 ▶use English qw/ -no_match_vars /;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our $VERSION = 0.08;
14 1 our @EXPORT_OK = qw//;
15 1 our %EXPORT_TAGS = ();
16  
17 0 ▶sub node {
Subroutine node: not called CC=4 SCAR=30.0
Pod documented
18 0 my ($self, $options) = @_;
19 0 my $version;
20 my $path;
21  
22 0 ▶ if ( $path = $ENV{NVM_BIN} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($path = $ENV{'NVM_BIN'}) { } 0 0 0
elsif ($path = $ENV{'NODE_PATH'}) { } 0 0 0
23 # best guess for nvm
24 0 ($version) = $path =~ m{/([^/]+)/bin};
25 }
26 elsif ( $path = $ENV{NODE_PATH} ) {
27 # best guess for nave
28 0 ($version) = $path =~ /installed.(.*?).lib/;
29 }
30 else {
31 0 return;
32 }
33  
34 0 ▶ return if !$version;
Branch: 1 branch
BranchTrueFalseTotal
unless $version 0 0 0
35  
36 0 return $self->surround( 5 + length $version, $self->colour('branch_label') . 'node ' . $self->colour('branch') . $version );
37 }
38  
39 1 1;
40  
41 __END__
« PS1.pm ↑ Summary PS1/Plugin/Env.pm »