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_X64 = OSX_OUT + '/' + OSX_APPNAME + '-darwin-x64';
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_LINUX = process.platform == 'linux';
var IS_LINUX = process.platform === 'linux';
var IS_I386 = process.arch == 'ia32';
var IS_X64 = process.arch == 'x64';
var IS_I386 = process.arch === 'ia32';
var IS_X64 = process.arch === 'x64';
var IS_DEB = fs.existsSync('/etc/lsb-release') || fs.existsSync('/etc/debian_version');
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({
IDENTITY: 'Developer ID Application: Docker Inc',
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: {
@ -191,7 +208,7 @@ module.exports = function (grunt) {
expand: true,
cwd: 'src/',
src: ['**/*.js'],
dest: 'build/',
dest: 'build/'
}]
}
},
@ -208,31 +225,34 @@ module.exports = function (grunt) {
},
sign: {
options: {
failOnError: false,
failOnError: false
},
command: [
'codesign --deep -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>/Contents/Frameworks/*',
'codesign -v -f -s "<%= IDENTITY %>" <%= OSX_FILENAME_ESCAPED %>',
'codesign -vvv --display <%= OSX_FILENAME_ESCAPED %>',
'codesign -v --verify <%= OSX_FILENAME_ESCAPED %>'
].join(' && '),
].join(' && ')
},
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: {
command: 'cd build && npm install --production'
},
linux_zip: {
command: 'ditto -c -k --sequesterRsrc --keepParent <%= LINUX_FILENAME %> release/' + BASENAME + '-Ubuntu.deb'
}
},
clean: {
release: ['build/', 'dist/'],
release: ['build/', 'dist/']
},
compress: {
windows: {
options: {
archive: './release/' + BASENAME + '-Windows.zip',
archive: './release/' + BASENAME + '-Windows.zip',
mode: 'zip'
},
files: [{
@ -241,7 +261,7 @@ module.exports = function (grunt) {
cwd: './dist/Kitematic-win32-x64',
src: '**/*'
}]
},
}
},
// livereload
@ -280,15 +300,15 @@ module.exports = function (grunt) {
}
},
osxlnx: {
options: {
platform: 'linux',
arch: 'x64',
dir: './build',
out: './dist/',
name: 'Kitematic',
ignore: 'bower.json',
version: packagejson['electron-version'], // set version of electron
overwrite: true
options: {
platform: 'linux',
arch: 'x64',
dir: './build',
out: './dist/',
name: 'Kitematic',
ignore: 'bower.json',
version: packagejson['electron-version'], // set version of electron
overwrite: true
}
}
},
@ -308,7 +328,7 @@ module.exports = function (grunt) {
'Utility'
],
rename: function (dest, src) {
return dest + '<%= name %>_'+ packagejson.version +'-<%= revision %>_<%= arch %>.deb';
return LINUX_FILENAME;
}
},
linux64: {
@ -316,14 +336,14 @@ module.exports = function (grunt) {
arch: 'amd64'
},
src: './dist/Kitematic-linux-x64/',
dest: './dist/',
dest: './dist/'
},
linux32: {
options: {
arch: 'i386'
},
src: './dist/Kitematic-linux-ia32/',
dest: './dist/',
dest: './dist/'
}
},
'electron-installer-redhat': {
@ -336,7 +356,7 @@ module.exports = function (grunt) {
'Utilities'
],
rename: function (dest, src) {
return dest + '<%= name %>_'+ packagejson.version +'-<%= revision %>_<%= arch %>.rpm';
return LINUX_FILENAME;
}
},
linux64: {
@ -364,27 +384,13 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['newer:babel', 'less', 'newer:copy:dev', 'shell:electron', 'watchChokidar']);
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']);
}else if(IS_LINUX){
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', '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) {
if (linuxpackage) {
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'shell:linux_npm', 'electron-packager:build', linuxpackage]);
}else{
grunt.log.errorlns('Your Linux distribution is not yet supported - arch:'+ process.arch + ' platform:' + process.platform);
}else {
grunt.log.errorlns('Your Linux distribution is not yet supported - arch:' + process.arch + ' platform:' + process.platform);
}
}else {
grunt.registerTask('release', ['clean:release', 'babel', 'less', 'copy:dev', 'electron:windows', 'copy:windows', 'rcedit:exes', 'compress']);
}

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

@ -13,3 +13,4 @@ deployment:
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-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",
"integration": "jest -c jest-integration.json",
"release": "grunt release",
"release-verbose": "grunt --verbose release",
"lint": "jsxhint src"
},
"license": "Apache-2.0",