Skip to content

Commit 9bd0ca6

Browse files
committed
fix app signing on osx
1 parent 6cdc213 commit 9bd0ca6

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

gulpfile.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,13 @@ var platform = require(path.join(__dirname, 'tasks', process.platform));
2323
gulp.task('build:electron', platform.build);
2424
gulp.task('build:electron-installer', ['build:electron'], platform.installer);
2525

26-
// @todo: debugging...
27-
var tar = require('gulp-tar');
28-
var gzip = require('gulp-gzip');
29-
30-
gulp.task('package:electron', function() {
31-
return gulp.src(['dist/MongoDB\ Enterprise\ Scout-darwin-x64/*', 'dist/MongoDB\ Enterprise\ Scout-darwin-x64/**/*'])
32-
.pipe(tar('MongoDB Enterprise Scout-v0.2.0.tar'))
33-
.pipe(gzip())
34-
.pipe(gulp.dest('dist/'));
35-
});
36-
3726
var BUILD = 'build/';
3827

3928
// `npm start` calls this.
40-
gulp.task('start', ['build:app', 'build:electron', 'hack:app'], function() {
29+
gulp.task('start', ['build:app', 'build:electron'], function() {
4130
platform.start();
4231
return gulp.start('watch');
4332
});
44-
gulp.task('hack:app', function() {
45-
return del(platform.BUILD);
46-
});
4733

4834
gulp.task('build:release', function() {
4935
BUILD = platform.BUILD;

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,10 @@
9292
"electron-packager": "^5.0.0",
9393
"eslint-config-mongodb-js": "^0.1.4",
9494
"gulp": "^3.9.0",
95-
"gulp-gzip": "^1.1.0",
9695
"gulp-jade": "^1.0.1",
9796
"gulp-less": "^3.0.3",
9897
"gulp-shell": "^0.4.2",
9998
"gulp-sourcemaps": "^1.5.2",
100-
"gulp-tar": "^1.4.0",
10199
"gulp-uglify": "^1.2.0",
102100
"gulp-util": "^3.0.6",
103101
"gulp-webserver": "^0.9.1",

tasks/darwin.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
var path = require('path');
22
var pkg = require(path.resolve(__dirname, '../package.json'));
33
var fs = require('fs');
4+
var cp = require('child_process');
5+
var format = require('util').format;
46

57
var debug = require('debug')('scout:tasks:darwin');
68

@@ -11,8 +13,6 @@ var APP_PATH = path.join(PACKAGE, NAME + '.app');
1113
var packager = require('electron-packager');
1214
var createDMG = require('electron-installer-dmg');
1315

14-
var spawn = require('child_process').spawn;
15-
1616
var CONFIG = module.exports = {
1717
name: pkg.electron.name,
1818
dir: path.resolve(__dirname, '../build'),
@@ -51,13 +51,33 @@ module.exports.build = function(done) {
5151
});
5252
};
5353

54+
var codesign = function(done) {
55+
var cmd = 'codesign --deep --force --sign "' + CONFIG.sign + '" "' + CONFIG.appPath + '"';
56+
debug('Running', cmd);
57+
cp.exec(cmd, done);
58+
};
59+
60+
var verify = function(done) {
61+
var cmd = 'codesign --verify "' + CONFIG.appPath + '"';
62+
debug('Running', cmd);
63+
cp.exec(cmd, done);
64+
};
65+
5466
module.exports.installer = function(done) {
55-
createDMG(CONFIG, done);
67+
codesign(function(err) {
68+
if (err) return done(err);
69+
70+
verify(function(err) {
71+
if (err) return done(err);
72+
73+
createDMG(CONFIG, done);
74+
});
75+
});
5676
};
5777

5878

5979
module.exports.start = function() {
60-
var child = spawn(path.resolve(CONFIG.ELECTRON), [path.resolve(CONFIG.dir)]);
80+
var child = cp.spawn(path.resolve(CONFIG.ELECTRON), [path.resolve(CONFIG.dir)]);
6181
child.stderr.pipe(process.stderr);
6282
child.stdout.pipe(process.stdout);
6383
};

0 commit comments

Comments
 (0)