extended versions() (php, redis, mongodb)
This commit is contained in:
parent
695ed15560
commit
21921b73e8
@ -100,6 +100,7 @@ Other changes
|
|||||||
|
|
||||||
| Version | Date | Comment |
|
| Version | Date | Comment |
|
||||||
| -------------- | -------------- | -------- |
|
| -------------- | -------------- | -------- |
|
||||||
|
| 3.40.0 | 2018-04-29 | extended `versions()` (php, redis, mongodb) |
|
||||||
| 3.39.0 | 2018-04-29 | added `versions().mysql` and `versions().nginx`, starting `SunOS` support (untested) |
|
| 3.39.0 | 2018-04-29 | added `versions().mysql` and `versions().nginx`, starting `SunOS` support (untested) |
|
||||||
| 3.38.0 | 2018-04-06 | added `battery().acconnected` |
|
| 3.38.0 | 2018-04-06 | added `battery().acconnected` |
|
||||||
| 3.37.12 | 2018-04-05 | another optimization `battery().ischarging` for macOS |
|
| 3.37.12 | 2018-04-05 | another optimization `battery().ischarging` for macOS |
|
||||||
|
|||||||
@ -53,13 +53,13 @@ async function cpu() {
|
|||||||
### Latest Activity
|
### Latest Activity
|
||||||
|
|
||||||
(last 7 major and minor version releases)
|
(last 7 major and minor version releases)
|
||||||
|
- Version 3.40.0: extended `versions()` (php, redis, mongodb)
|
||||||
- Version 3.39.0: added `versions().mysql` and `versions().nginx`, starting `SunOS` support
|
- Version 3.39.0: added `versions().mysql` and `versions().nginx`, starting `SunOS` support
|
||||||
- Version 3.38.0: added `battery.acconnected`
|
- Version 3.38.0: added `battery.acconnected`
|
||||||
- Version 3.37.0: extended FreeBSD support `networkStats()`
|
- Version 3.37.0: extended FreeBSD support `networkStats()`
|
||||||
- Version 3.36.0: extended FreeBSD support `networkConnections()`
|
- Version 3.36.0: extended FreeBSD support `networkConnections()`
|
||||||
- Version 3.35.0: extended FreeBSD support `processLoad()`
|
- Version 3.35.0: extended FreeBSD support `processLoad()`
|
||||||
- Version 3.34.0: first partial FreeBSD support
|
- Version 3.34.0: first partial FreeBSD support
|
||||||
- Version 3.33.0: added bios `bios()` and main board `baseboard()` information
|
|
||||||
- ...
|
- ...
|
||||||
|
|
||||||
You can find all changes here: [detailed changelog][changelog-url]
|
You can find all changes here: [detailed changelog][changelog-url]
|
||||||
|
|||||||
157
lib/osinfo.js
157
lib/osinfo.js
@ -269,69 +269,112 @@ function versions(callback) {
|
|||||||
git: '',
|
git: '',
|
||||||
tsc: '',
|
tsc: '',
|
||||||
mysql: '',
|
mysql: '',
|
||||||
nginx: ''
|
redis: '',
|
||||||
|
mongodb: '',
|
||||||
|
nginx: '',
|
||||||
|
php: ''
|
||||||
};
|
};
|
||||||
let parts = [];
|
|
||||||
|
let functionProcessed = (function () {
|
||||||
|
let totalFunctions = 12;
|
||||||
|
return function () {
|
||||||
|
if (--totalFunctions === 0) {
|
||||||
|
if (callback) {
|
||||||
|
callback(result);
|
||||||
|
}
|
||||||
|
resolve(result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
exec('npm -v', function (error, stdout) {
|
exec('npm -v', function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
result.npm = stdout.toString().split('\n')[0];
|
result.npm = stdout.toString().split('\n')[0];
|
||||||
}
|
}
|
||||||
exec('pm2 -v', function (error, stdout) {
|
functionProcessed();
|
||||||
if (!error) {
|
});
|
||||||
parts = stdout.toString().split('\n');
|
exec('pm2 -v', function (error, stdout) {
|
||||||
if (parts.length >= 2) {
|
if (!error) {
|
||||||
result.pm2 = parts[parts.length - 2];
|
result.pm2 = stdout.toString().split('\n')[0].trim();
|
||||||
}
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('yarn --version', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.yarn = stdout.toString().split('\n')[0];
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('gulp --version', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.gulp = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.gulp = (result.gulp.toLowerCase().split('version')[1] || '').trim();
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('tsc --version', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.tsc = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.tsc = (result.tsc.toLowerCase().split('version')[1] || '').trim();
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('grunt --version', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.grunt = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.grunt = (result.grunt.toLowerCase().split('cli v')[1] || '').trim();
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('git --version', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.git = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.git = (result.git.toLowerCase().split('version')[1] || '').trim();
|
||||||
|
result.git = (result.git.split(' ')[0] || '').trim();
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('nginx -v', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.nginx = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.nginx = (result.nginx.toLowerCase().split('/')[1] || '').trim();
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('mysql -V', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.mysql = stdout.toString().split('\n')[0] || '';
|
||||||
|
result.mysql = (result.mysql.toLowerCase().split(',')[0] || '').trim();
|
||||||
|
const parts = result.mysql.split(' ');
|
||||||
|
result.mysql = (parts[parts.length - 1] || '').trim();
|
||||||
|
}
|
||||||
|
functionProcessed();
|
||||||
|
});
|
||||||
|
exec('php -v', function (error, stdout) {
|
||||||
|
if (!error) {
|
||||||
|
result.php = stdout.toString().split('\n')[0] || '';
|
||||||
|
let parts = result.php.split('(');
|
||||||
|
if (parts[0].indexOf('-')) {
|
||||||
|
parts = parts[0].split('-');
|
||||||
}
|
}
|
||||||
exec('yarn --version', function (error, stdout) {
|
result.php = parts[0].replace(/[^0-9.]/g, '');
|
||||||
if (!error) {
|
}
|
||||||
result.yarn = stdout.toString().split('\n')[0];
|
functionProcessed();
|
||||||
}
|
});
|
||||||
exec('gulp --version', function (error, stdout) {
|
exec('redis-server --version', function (error, stdout) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
result.gulp = stdout.toString().split('\n')[0] || '';
|
result.redis = stdout.toString().split('\n')[0] || '';
|
||||||
result.gulp = (result.gulp.toLowerCase().split('version')[1] || '').trim();
|
const parts = result.redis.split(' ');
|
||||||
}
|
result.redis = util.getValue(parts, 'v', '=', true);
|
||||||
exec('tsc --version', function (error, stdout) {
|
}
|
||||||
if (!error) {
|
functionProcessed();
|
||||||
result.tsc = stdout.toString().split('\n')[0] || '';
|
});
|
||||||
result.tsc = (result.tsc.toLowerCase().split('version')[1] || '').trim();
|
exec('mongod --version', function (error, stdout) {
|
||||||
}
|
if (!error) {
|
||||||
exec('grunt --version', function (error, stdout) {
|
result.mongodb = stdout.toString().split('\n')[0] || '';
|
||||||
if (!error) {
|
result.mongodb = (result.mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
|
||||||
result.grunt = stdout.toString().split('\n')[0] || '';
|
}
|
||||||
result.grunt = (result.grunt.toLowerCase().split('cli v')[1] || '').trim();
|
functionProcessed();
|
||||||
}
|
|
||||||
exec('git --version', function (error, stdout) {
|
|
||||||
if (!error) {
|
|
||||||
result.git = stdout.toString().split('\n')[0] || '';
|
|
||||||
result.git = (result.git.toLowerCase().split('version')[1] || '').trim();
|
|
||||||
result.git = (result.git.split(' ')[0] || '').trim();
|
|
||||||
}
|
|
||||||
exec('nginx -v', function (error, stdout) {
|
|
||||||
if (!error) {
|
|
||||||
result.nginx = stdout.toString().split('\n')[0] || '';
|
|
||||||
result.nginx = (result.nginx.toLowerCase().split('/')[1] || '').trim();
|
|
||||||
}
|
|
||||||
exec('mysql -V', function (error, stdout) {
|
|
||||||
if (!error) {
|
|
||||||
result.mysql = stdout.toString().split('\n')[0] || '';
|
|
||||||
result.mysql = (result.mysql.toLowerCase().split(',')[0] || '').trim();
|
|
||||||
const parts = result.mysql.split(' ');
|
|
||||||
result.mysql = (parts[parts.length - 1] || '').trim();
|
|
||||||
}
|
|
||||||
if (callback) {
|
|
||||||
callback(result);
|
|
||||||
}
|
|
||||||
resolve(result);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user