Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions lib/utils/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')) {
Expand All @@ -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');
Expand All @@ -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
});

Expand Down
26 changes: 26 additions & 0 deletions test/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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');
Expand Down