Signed-off-by: French Ben <frenchben@docker.com>
This commit is contained in:
French Ben 2016-05-26 17:06:20 -07:00
Родитель 7df13112d2
Коммит 739e9ef43b
3 изменённых файлов: 53 добавлений и 45 удалений

Просмотреть файл

@ -27,20 +27,37 @@ module.exports = function (grunt) {
var OSX_OUT = './dist'; var OSX_OUT = './dist';
var OSX_OUT_X64 = OSX_OUT + '/' + OSX_APPNAME + '-darwin-x64'; var OSX_OUT_X64 = OSX_OUT + '/' + OSX_APPNAME + '-darwin-x64';
var OSX_FILENAME = OSX_OUT_X64 + '/' + OSX_APPNAME + '.app'; var OSX_FILENAME = OSX_OUT_X64 + '/' + OSX_APPNAME + '.app';
var LINUX_FILENAME = OSX_OUT + '/' + BASENAME + '_' + packagejson.version + '_amd64.deb';
var IS_WINDOWS = process.platform === 'win32'; var IS_WINDOWS = process.platform === 'win32';
var IS_LINUX = process.platform == 'linux'; var IS_LINUX = process.platform === 'linux';
var IS_I386 = process.arch == 'ia32'; var IS_I386 = process.arch === 'ia32';
var IS_X64 = process.arch == 'x64'; var IS_X64 = process.arch === 'x64';
var IS_DEB = fs.existsSync('/etc/lsb-release') || fs.existsSync('/etc/debian_version'); var IS_DEB = fs.existsSync('/etc/lsb-release') || fs.existsSync('/etc/debian_version');
var IS_RPM = fs.existsSync('/etc/redhat-release'); var IS_RPM = fs.existsSync('/etc/redhat-release');
var linuxpackage = null;
// linux package detection
if (IS_DEB && IS_X64) {
linuxpackage = 'electron-installer-debian:linux64';
} else if (IS_DEB && IS_I386) {
linuxpackage = 'electron-installer-debian:linux32';
LINUX_FILENAME = OSX_OUT + '/' + BASENAME + '_' + packagejson.version + '_i386.deb';
} else if (IS_RPM && IS_X64) {
linuxpackage = 'electron-installer-redhat:linux64';
LINUX_FILENAME = OSX_OUT + '/' + BASENAME + '_' + packagejson.version + '_x86_64.rpm';
} else if (IS_RPM && IS_I386) {
linuxpackage = 'electron-installer-redhat:linux32';
LINUX_FILENAME = OSX_OUT + '/' + BASENAME + '_' + packagejson.version + '_x86.rpm';
}
grunt.initConfig({ grunt.initConfig({
IDENTITY: 'Developer ID Application: Docker Inc', IDENTITY: 'Developer ID Application: Docker Inc',
OSX_FILENAME: OSX_FILENAME, OSX_FILENAME: OSX_FILENAME,
OSX_FILENAME_ESCAPED: OSX_FILENAME.replace(/ /g, '\\ ').replace(/\(/g,'\\(').replace(/\)/g,'\\)'), OSX_FILENAME_ESCAPED: OSX_FILENAME.replace(/ /g, '\\ ').replace(/\(/g, '\\(').replace(/\)/g, '\\)'),
LINUX_FILENAME: LINUX_FILENAME,
// electron // electron
electron: { electron: {
@ -191,7 +208,7 @@ module.exports = function (grunt) {
expand: true, expand: true,
cwd: 'src/', cwd: 'src/',
src: ['**/*.js'], src: ['**/*.js'],
dest: 'build/', dest: 'build/'
}] }]
} }
}, },
@ -208,31 +225,34 @@ module.exports = function (grunt) {
}, },
sign: { sign: {
options: { options: {
failOnError: false, failOnError: false
}, },
command: [ command: [
'codesign --deep -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>/Contents/Frameworks/*', 'codesign --deep -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>/Contents/Frameworks/*',
'codesign -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>', 'codesign -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>',
'codesign -vvv --display <%= OSX_FILENAME_ESCAPED %>', 'codesign -vvv --display <%= OSX_FILENAME_ESCAPED %>',
'codesign -v --verify <%= OSX_FILENAME_ESCAPED %>' 'codesign -v --verify <%= OSX_FILENAME_ESCAPED %>'
].join(' && '), ].join(' && ')
}, },
zip: { zip: {
command: 'ditto -c -k --sequesterRsrc --keepParent <%= OSX_FILENAME_ESCAPED %> release/' + BASENAME + '-Mac.zip', command: 'ditto -c -k --sequesterRsrc --keepParent <%= OSX_FILENAME_ESCAPED %> release/' + BASENAME + '-Mac.zip'
}, },
linux_npm: { linux_npm: {
command: 'cd build && npm install --production' command: 'cd build && npm install --production'
},
linux_zip: {
command: 'ditto -c -k --sequesterRsrc --keepParent <%= LINUX_FILENAME %> release/' + BASENAME + '-Ubuntu.deb'
} }
}, },
clean: { clean: {
release: ['build/', 'dist/'], release: ['build/', 'dist/']
}, },
compress: { compress: {
windows: { windows: {
options: { options: {
archive: './release/' + BASENAME + '-Windows.zip', archive: './release/' + BASENAME + '-Windows.zip',
mode: 'zip' mode: 'zip'
}, },
files: [{ files: [{
@ -241,7 +261,7 @@ module.exports = function (grunt) {
cwd: './dist/Kitematic-win32-x64', cwd: './dist/Kitematic-win32-x64',
src: '**/*' src: '**/*'
}] }]
}, }
}, },
// livereload // livereload
@ -280,15 +300,15 @@ module.exports = function (grunt) {
} }
}, },
osxlnx: { osxlnx: {
options: { options: {
platform: 'linux', platform: 'linux',
arch: 'x64', arch: 'x64',
dir: './build', dir: './build',
out: './dist/', out: './dist/',
name: 'Kitematic', name: 'Kitematic',
ignore: 'bower.json', ignore: 'bower.json',
version: packagejson['electron-version'], // set version of electron version: packagejson['electron-version'], // set version of electron
overwrite: true overwrite: true
} }
} }
}, },
@ -308,7 +328,7 @@ module.exports = function (grunt) {
'Utility' 'Utility'
], ],
rename: function (dest, src) { rename: function (dest, src) {
return dest + '<%= name %>_'+ packagejson.version +'-<%= revision %>_<%= arch %>.deb'; return LINUX_FILENAME;
} }
}, },
linux64: { linux64: {
@ -316,27 +336,27 @@ module.exports = function (grunt) {
arch: 'amd64' arch: 'amd64'
}, },
src: './dist/Kitematic-linux-x64/', src: './dist/Kitematic-linux-x64/',
dest: './dist/', dest: './dist/'
}, },
linux32: { linux32: {
options: { options: {
arch: 'i386' arch: 'i386'
}, },
src: './dist/Kitematic-linux-ia32/', src: './dist/Kitematic-linux-ia32/',
dest: './dist/', dest: './dist/'
} }
}, },
'electron-installer-redhat': { 'electron-installer-redhat': {
options: { options: {
productName: LINUX_APPNAME, productName: LINUX_APPNAME,
productDescription: 'Run containers through a simple, yet powerful graphical user interface.', productDescription: 'Run containers through a simple, yet powerful graphical user interface.',
priority: 'optional', priority: 'optional',
icon: './util/kitematic.png', icon: './util/kitematic.png',
categories: [ categories: [
'Utilities' 'Utilities'
], ],
rename: function (dest, src) { rename: function (dest, src) {
return dest + '<%= name %>_'+ packagejson.version +'-<%= revision %>_<%= arch %>.rpm'; return LINUX_FILENAME;
} }
}, },
linux64: { linux64: {
@ -364,27 +384,13 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']); grunt.registerTask('default', ['newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']);
if (!IS_WINDOWS && !IS_LINUX) { if (!IS_WINDOWS && !IS_LINUX) {
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron', 'copy:osx', 'shell:sign', 'shell:zip', 'copy:windows', 'rcedit:exes', 'compress', 'shell:linux_npm', 'electron-packager:osxlnx', 'electron-installer-debian:linux64']); grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron', 'copy:osx', 'shell:sign', 'shell:zip', 'copy:windows', 'rcedit:exes', 'shell:linux_npm', 'electron-packager:osxlnx', 'electron-installer-debian:linux64', 'shell:linux_zip']);
}else if(IS_LINUX){ }else if (IS_LINUX) {
if (linuxpackage) {
var linuxpackage = null;
// linux package detection
if(IS_DEB && IS_X64){
linuxpackage = 'electron-installer-debian:linux64';
}else if(IS_DEB && IS_I386){
linuxpackage = 'electron-installer-debian:linux32';
}else if(IS_RPM && IS_X64){
linuxpackage = 'electron-installer-redhat:linux64';
}else if(IS_RPM && IS_I386){
linuxpackage = 'electron-installer-redhat:linux32';
}
if(linuxpackage){
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'shell:linux_npm', 'electron-packager:build', linuxpackage]); grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'shell:linux_npm', 'electron-packager:build', linuxpackage]);
}else{ }else {
grunt.log.errorlns('Your Linux distribution is not yet supported - arch:'+ process.arch + ' platform:' + process.platform); grunt.log.errorlns('Your Linux distribution is not yet supported - arch:' + process.arch + ' platform:' + process.platform);
} }
}else { }else {
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'compress']); grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'compress']);
} }

Просмотреть файл

@ -13,3 +13,4 @@ deployment:
commands: commands:
- github-release upload --user docker --repo kitematic --tag $CIRCLE_TAG --file release/Kitematic-Mac.zip --name Kitematic-$(echo $CIRCLE_TAG | cut -c2-)-Mac.zip - github-release upload --user docker --repo kitematic --tag $CIRCLE_TAG --file release/Kitematic-Mac.zip --name Kitematic-$(echo $CIRCLE_TAG | cut -c2-)-Mac.zip
- github-release upload --user docker --repo kitematic --tag $CIRCLE_TAG --file release/Kitematic-Windows.zip --name Kitematic-$(echo $CIRCLE_TAG | cut -c2-)-Windows.zip - github-release upload --user docker --repo kitematic --tag $CIRCLE_TAG --file release/Kitematic-Windows.zip --name Kitematic-$(echo $CIRCLE_TAG | cut -c2-)-Windows.zip
- github-release upload --user docker --repo kitematic --tag $CIRCLE_TAG --file release/Kitematic-Ubuntu.deb --name Kitematic-$(echo $CIRCLE_TAG | cut -c2-)-Ubuntu.deb

Просмотреть файл

@ -16,6 +16,7 @@
"test": "jest -c jest-unit.json", "test": "jest -c jest-unit.json",
"integration": "jest -c jest-integration.json", "integration": "jest -c jest-integration.json",
"release": "grunt release", "release": "grunt release",
"release-verbose": "grunt --verbose release",
"lint": "jsxhint src" "lint": "jsxhint src"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",