You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
723 B
33 lines
723 B
'use strict';
|
|
var os = require('os');
|
|
var osxRelease = require('osx-release');
|
|
var winRelease = require('win-release');
|
|
|
|
module.exports = function (platform, release) {
|
|
if (!platform && release) {
|
|
throw new Error('You can\'t specify a `release` without specfying `platform`');
|
|
}
|
|
|
|
platform = platform || os.platform();
|
|
release = release || os.release();
|
|
|
|
var id;
|
|
|
|
if (platform === 'darwin') {
|
|
id = osxRelease(release).name;
|
|
return 'OS X' + (id ? ' ' + id : '');
|
|
}
|
|
|
|
if (platform === 'linux') {
|
|
id = release.replace(/^(\d+\.\d+).*/, '$1');
|
|
return 'Linux' + (id ? ' ' + id : '');
|
|
}
|
|
|
|
if (platform === 'win32') {
|
|
id = winRelease(release);
|
|
return 'Windows' + (id ? ' ' + id : '');
|
|
}
|
|
|
|
return platform;
|
|
};
|