| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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__ | ||||||||||||||