-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6083 from epixa/6074-tgz-plugins
Plugin installer support for .tgz file types
- Loading branch information
Showing
6 changed files
with
73 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import expect from 'expect.js'; | ||
import fileType, { ZIP, TAR } from '../file_type'; | ||
|
||
describe('kibana cli', function () { | ||
describe('file_type', function () { | ||
it('returns ZIP for .zip filename', function () { | ||
const type = fileType('wat.zip'); | ||
expect(type).to.equal(ZIP); | ||
}); | ||
it('returns TAR for .tar.gz filename', function () { | ||
const type = fileType('wat.tar.gz'); | ||
expect(type).to.equal(TAR); | ||
}); | ||
it('returns TAR for .tgz filename', function () { | ||
const type = fileType('wat.tgz'); | ||
expect(type).to.equal(TAR); | ||
}); | ||
it('returns undefined for unknown file type', function () { | ||
const type = fileType('wat.unknown'); | ||
expect(type).to.equal(undefined); | ||
}); | ||
it('accepts paths', function () { | ||
const type = fileType('/some/path/to/wat.zip'); | ||
expect(type).to.equal(ZIP); | ||
}); | ||
it('accepts urls', function () { | ||
const type = fileType('http://example.com/wat.zip'); | ||
expect(type).to.equal(ZIP); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const TAR = '.tar.gz'; | ||
export const ZIP = '.zip'; | ||
|
||
export default function fileType(filename) { | ||
if (/\.zip$/i.test(filename)) { | ||
return ZIP; | ||
} | ||
if (/\.tar\.gz$/i.test(filename)) { | ||
return TAR; | ||
} | ||
if (/\.tgz$/i.test(filename)) { | ||
return TAR; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters