mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
42_npmjs: update nodejsVersion when checking for outdated packages
git-svn-id: https://svn.fhem.de/fhem/trunk@18545 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4927e33805
commit
357c227584
@ -39,7 +39,7 @@ use warnings;
|
|||||||
use POSIX;
|
use POSIX;
|
||||||
|
|
||||||
# our @EXPORT = qw(get_time_suffix);
|
# our @EXPORT = qw(get_time_suffix);
|
||||||
our $VERSION = "0.9.2";
|
our $VERSION = "0.9.3";
|
||||||
|
|
||||||
# wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
|
# wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
|
||||||
use GPUtils qw(GP_Import);
|
use GPUtils qw(GP_Import);
|
||||||
@ -235,7 +235,6 @@ sub Notify($$) {
|
|||||||
|
|
||||||
if ( ReadingsVal( $name, 'nodejsVersion', 'none' ) ne 'none' ) {
|
if ( ReadingsVal( $name, 'nodejsVersion', 'none' ) ne 'none' ) {
|
||||||
ProcessUpdateTimer($hash);
|
ProcessUpdateTimer($hash);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$hash->{".fhem"}{npm}{cmd} = 'getNodeVersion';
|
$hash->{".fhem"}{npm}{cmd} = 'getNodeVersion';
|
||||||
@ -475,13 +474,17 @@ sub ExecuteNpmCommand($) {
|
|||||||
$npm->{npmupdate} =
|
$npm->{npmupdate} =
|
||||||
$cmdPrefix . 'echo n | npm update --unsafe-perm' . $cmdSuffix;
|
$cmdPrefix . 'echo n | npm update --unsafe-perm' . $cmdSuffix;
|
||||||
$npm->{npmoutdated} =
|
$npm->{npmoutdated} =
|
||||||
$cmdPrefix . 'echo n | npm outdated --parseable' . $cmdSuffix;
|
$cmdPrefix
|
||||||
|
. 'echo n | node --version; npm outdated --parseable'
|
||||||
|
. $cmdSuffix;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$npm->{npmupdate} =
|
$npm->{npmupdate} =
|
||||||
$cmdPrefix . 'echo n | sudo npm update -g --unsafe-perm' . $cmdSuffix;
|
$cmdPrefix . 'echo n | sudo npm update -g --unsafe-perm' . $cmdSuffix;
|
||||||
$npm->{npmoutdated} =
|
$npm->{npmoutdated} =
|
||||||
$cmdPrefix . 'echo n | sudo npm outdated -g --parseable' . $cmdSuffix;
|
$cmdPrefix
|
||||||
|
. 'echo n | node --version; sudo npm outdated -g --parseable'
|
||||||
|
. $cmdSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $response;
|
my $response;
|
||||||
@ -545,6 +548,9 @@ sub NpmOutdated($) {
|
|||||||
$update->{new} = $9;
|
$update->{new} = $9;
|
||||||
$updates->{packages}->{$package} = $update;
|
$updates->{packages}->{$package} = $update;
|
||||||
}
|
}
|
||||||
|
elsif ( $line =~ m/^v(\d+\.\d+\.\d+)$/ ) {
|
||||||
|
$updates->{nodejsversion} = $1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$updates->{'state'} = 'done';
|
$updates->{'state'} = 'done';
|
||||||
@ -632,7 +638,7 @@ sub WriteReadings($$) {
|
|||||||
and not defined( $hash->{".fhem"}{npm}{'warnings'} ) );
|
and not defined( $hash->{".fhem"}{npm}{'warnings'} ) );
|
||||||
readingsBulkUpdateIfChanged( $hash, "nodejsVersion",
|
readingsBulkUpdateIfChanged( $hash, "nodejsVersion",
|
||||||
$decode_json->{'nodejsversion'} )
|
$decode_json->{'nodejsversion'} )
|
||||||
if ( $hash->{".fhem"}{npm}{cmd} eq 'getNodeVersion' );
|
if ( defined( $decode_json->{'nodejsversion'} ) );
|
||||||
|
|
||||||
if ( defined( $decode_json->{error} ) ) {
|
if ( defined( $decode_json->{error} ) ) {
|
||||||
readingsBulkUpdate( $hash, 'state',
|
readingsBulkUpdate( $hash, 'state',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user