lib/utils/platforms.js
function detectPlatform(platform) {
    var name = platform.toLowerCase();
    var prefix = "", suffix = "";

    // Detect NuGet/Squirrel.Windows files
    if (name == 'releases' || hasSuffix(name, '.nupkg')) return platforms.WINDOWS_32;

    // Detect prefix: osx, widnows or linux
    if (_.contains(name, 'win')
        || hasSuffix(name, '.exe')) prefix = platforms.WINDOWS;

    if (_.contains(name, 'linux')
        || _.contains(name, 'ubuntu')
        || hasSuffix(name, '.deb')
        || hasSuffix(name, '.rpm')
        || hasSuffix(name, '.tgz')
        || hasSuffix(name, '.tar.gz')) {

        if (_.contains(name, 'linux_deb') || hasSuffix(name, '.deb')) {
            prefix = platforms.LINUX_DEB;
        }
        else if (_.contains(name, 'linux_rpm') || hasSuffix(name, '.rpm')) {
            prefix = platforms.LINUX_RPM;
        }
        else if (_.contains(name, 'linux') || hasSuffix(name, '.tgz') || hasSuffix(name, '.tar.gz')) {
            prefix = platforms.LINUX;
        }
    }

    if (_.contains(name, 'mac')
        || _.contains(name, 'osx')
        || name.indexOf('darwin') >= 0
        || hasSuffix(name, '.dmg')) prefix = platforms.OSX;

    // Detect suffix: 32 or 64
    if (_.contains(name, '32')
        || _.contains(name, 'ia32')
        || _.contains(name, 'i386')) suffix = '32';
    if (_.contains(name, '64') || _.contains(name, 'x64') || _.contains(name, 'amd64')) suffix = '64';

    suffix = suffix || (prefix == platforms.OSX? '64' : '32');
    return _.compact([prefix, suffix]).join('_');
}
function detectPlatform(platform) {
    var name = platform.toLowerCase();
    var prefix = "", suffix = "";

    // Detect NuGet/Squirrel.Windows files
    if (name == 'releases' || hasSuffix(name, '.nupkg')) return platforms.WINDOWS_32;

    // Detect prefix: osx, widnows or linux
    if (_.contains(name, 'win')
        || hasSuffix(name, '.exe')) prefix = platforms.WINDOWS;

    if (_.contains(name, 'linux')
        || _.contains(name, 'ubuntu')
        || hasSuffix(name, '.deb')
        || hasSuffix(name, '.rpm')
        || hasSuffix(name, '.tgz')
        || hasSuffix(name, '.tar.gz')) {

        if (_.contains(name, 'linux_deb') || hasSuffix(name, '.deb')) {
            prefix = platforms.LINUX_DEB;
        }
        else if (_.contains(name, 'linux_rpm') || hasSuffix(name, '.rpm')) {
            prefix = platforms.LINUX_RPM;
        }
        else if (_.contains(name, 'linux') || hasSuffix(name, '.tgz') || hasSuffix(name, '.tar.gz')) {
            prefix = platforms.LINUX;
        }
    }

    if (_.contains(name, 'mac')
        || _.contains(name, 'osx')
        || name.indexOf('darwin') >= 0
        || hasSuffix(name, '.dmg')) prefix = platforms.OSX;

    // Detect suffix: 32 or 64
    if (_.contains(name, '32')
        || _.contains(name, 'ia32')
        || _.contains(name, 'i386')) suffix = '32';
    if (_.contains(name, '64') || _.contains(name, 'x64') || _.contains(name, 'amd64')) suffix = '64';

    suffix = suffix || (prefix == platforms.OSX? '64' : '32');
    return _.compact([prefix, suffix]).join('_');
}
function detectPlatform ( platform ) { var name = platform . toLowerCase ( ) ; var prefix = "" , suffix = "" ; // Detect NuGet/Squirrel.Windows files if ( name == 'releases' || hasSuffix ( name , '.nupkg' ) ) return platforms . WINDOWS_32 ; // Detect prefix: osx, widnows or linux if ( _ . contains ( name , 'win' ) || hasSuffix ( name , '.exe' ) ) prefix = platforms . WINDOWS ; if ( _ . contains ( name , 'linux' ) || _ . contains ( name , 'ubuntu' ) || hasSuffix ( name , '.deb' ) || hasSuffix ( name , '.rpm' ) || hasSuffix ( name , '.tgz' ) || hasSuffix ( name , '.tar.gz' ) ) { if ( _ . contains ( name , 'linux_deb' ) || hasSuffix ( name , '.deb' ) ) { prefix = platforms . LINUX_DEB ; } else if ( _ . contains ( name , 'linux_rpm' ) || hasSuffix ( name , '.rpm' ) ) { prefix = platforms . LINUX_RPM ; } else if ( _ . contains ( name , 'linux' ) || hasSuffix ( name , '.tgz' ) || hasSuffix ( name , '.tar.gz' ) ) { prefix = platforms . LINUX ; } } if ( _ . contains ( name , 'mac' ) || _ . contains ( name , 'osx' ) || name . indexOf ( 'darwin' ) >= 0 || hasSuffix ( name , '.dmg' ) ) prefix = platforms . OSX ; // Detect suffix: 32 or 64 if ( _ . contains ( name , '32' ) || _ . contains ( name , 'ia32' ) || _ . contains ( name , 'i386' ) ) suffix = '32' ; if ( _ . contains ( name , '64' ) || _ . contains ( name , 'x64' ) || _ . contains ( name , 'amd64' ) ) suffix = '64' ; suffix = suffix || ( prefix == platforms . OSX ? '64' : '32' ) ; return _ . compact ( [ prefix , suffix ] ) . join ( '_' ) ; }
Detect and normalize the platform name
Detect and normalize the platform name