diff --git a/docs/assets.md b/docs/assets.md index dd8eca74..805119c6 100644 --- a/docs/assets.md +++ b/docs/assets.md @@ -22,7 +22,7 @@ Filetype and usage will be detected from the extension: | -------- | ---------- | | Windows | `.exe`, `.nupkg`, `.zip` | | OS X | `.dmg`, `.zip` | -| Linux | `.deb`, `.rpm`, `.zip` | +| Linux | `.AppImage`, `.deb`, `.rpm`, `.zip` | ### Example diff --git a/lib/utils/platforms.js b/lib/utils/platforms.js index 5ee5f790..f5d05186 100644 --- a/lib/utils/platforms.js +++ b/lib/utils/platforms.js @@ -5,6 +5,9 @@ var platforms = { LINUX: 'linux', LINUX_32: 'linux_32', LINUX_64: 'linux_64', + LINUX_APPIMAGE: 'linux_AppImage', + LINUX_APPIMAGE_32: 'linux_AppImage_32', + LINUX_APPIMAGE_64: 'linux_AppImage_64', LINUX_RPM: 'linux_rpm', LINUX_RPM_32: 'linux_rpm_32', LINUX_RPM_64: 'linux_rpm_64', @@ -40,12 +43,16 @@ function detectPlatform(platform) { if (_.contains(name, 'linux') || _.contains(name, 'ubuntu') + || hasSuffix(name, '.appimage') || hasSuffix(name, '.deb') || hasSuffix(name, '.rpm') || hasSuffix(name, '.tgz') || hasSuffix(name, '.tar.gz')) { - if (_.contains(name, 'linux_deb') || hasSuffix(name, '.deb')) { + if (_.contains(name, 'linux_appimage') || hasSuffix(name, '.appimage')) { + prefix = platforms.LINUX_APPIMAGE; + } + else if (_.contains(name, 'linux_deb') || hasSuffix(name, '.deb')) { prefix = platforms.LINUX_DEB; } else if (_.contains(name, 'linux_rpm') || hasSuffix(name, '.rpm')) { @@ -64,7 +71,8 @@ function detectPlatform(platform) { // Detect suffix: 32 or 64 if (_.contains(name, '32') || _.contains(name, 'ia32') - || _.contains(name, 'i386')) suffix = '32'; + || _.contains(name, 'i386') + || _.contains(name, 'i686')) suffix = '32'; if (_.contains(name, '64') || _.contains(name, 'x64') || _.contains(name, 'amd64')) suffix = '64'; suffix = suffix || (prefix == platforms.OSX? '64' : '32'); @@ -89,7 +97,7 @@ function satisfiesPlatform(platform, list) { function resolveForVersion(version, platformID, opts) { opts = _.defaults(opts || {}, { // Order for filetype - filePreference: ['.exe', '.dmg', '.deb', '.rpm', '.tgz', '.tar.gz', '.zip', '.nupkg'], + filePreference: ['.exe', '.dmg', '.AppImage', '.deb', '.rpm', '.tgz', '.tar.gz', '.zip', '.nupkg'], wanted: null }); diff --git a/test/platforms.js b/test/platforms.js index 7aadaecb..037ea2da 100644 --- a/test/platforms.js +++ b/test/platforms.js @@ -23,6 +23,14 @@ describe('Platforms', function() { platforms.detect('enterprise-ia32.tgz').should.be.exactly(platforms.LINUX_32); }); + it('should detect AppImage_32', function() { + platforms.detect('appimaged-i686.AppImage').should.be.exactly(platforms.LINUX_APPIMAGE_32); + }); + + it('should detect AppImage_64', function() { + platforms.detect('appimaged-x86_64.AppImage').should.be.exactly(platforms.LINUX_APPIMAGE_64); + }); + it('should detect debian_32', function() { platforms.detect('atom-ia32.deb').should.be.exactly(platforms.LINUX_DEB_32); }); @@ -88,6 +96,22 @@ describe('Platforms', function() { 'download_url': 'https://api.github.com/repos/atom/atom/releases/assets/825658', 'download_count': 2494 }, + { + 'type': 'linux_AppImage_32', + 'filename': 'appimaged-i686.AppImage', + 'size': 244728, + 'content_type': 'application/octet-stream', + 'download_url': 'https://api.github.com/repos/AppImage/AppImageKit/releases/assets/5295931', + 'download_count': 55 + }, + { + 'type': 'linux_AppImage_64', + 'filename': 'appimaged-x86_64.AppImage', + 'size': 244728, + 'content_type': 'application/octet-stream', + 'download_url': 'https://api.github.com/repos/AppImage/AppImageKit/releases/assets/5295938', + 'download_count': 55 + }, { 'type': 'linux_rpm_32', 'filename': 'atom-ia32.rpm', @@ -145,6 +169,8 @@ describe('Platforms', function() { platforms.resolve(version, 'win32').filename.should.be.exactly('AtomSetup.exe'); platforms.resolve(version, 'linux_64').filename.should.be.exactly('atom-amd64.tar.gz'); platforms.resolve(version, 'linux_32').filename.should.be.exactly('atom-ia32.tar.gz'); + platforms.resolve(version, 'linux_AppImage_32').filename.should.be.exactly('appimaged-i686.AppImage'); + platforms.resolve(version, 'linux_AppImage_64').filename.should.be.exactly('appimaged-x86_64.AppImage'); platforms.resolve(version, 'linux_rpm_32').filename.should.be.exactly('atom-ia32.rpm'); platforms.resolve(version, 'linux_rpm_64').filename.should.be.exactly('atom-amd64.rpm'); platforms.resolve(version, 'linux_deb_32').filename.should.be.exactly('atom-ia32.deb');