Skip to content

Commit af8be58

Browse files
committed
standardizing win32+darwin builds
1 parent 7c34100 commit af8be58

File tree

3 files changed

+28
-36
lines changed

3 files changed

+28
-36
lines changed

gulpfile.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ gulp.task('release', function(done) {
4343
sequence(
4444
'build',
4545
'electron:build',
46-
'build:server',
4746
'electron:build-installer'
4847
, done);
4948
});
@@ -78,7 +77,6 @@ gulp.task('dev', function(done) {
7877
sequence(
7978
'build',
8079
'electron:build',
81-
'build:server',
8280
'electron:start',
8381
'watch'
8482
, done);
@@ -167,18 +165,6 @@ gulp.task('build:pages', function() {
167165
.pipe(gulp.dest('build/'));
168166
});
169167

170-
/**
171-
* Install scout-server separately while we're
172-
* using tarballs from S3 as they're filtered
173-
* out by default.
174-
*/
175-
var format = require('util').format;
176-
gulp.task('build:server', shell.task(
177-
format('npm install --production %s',
178-
pkg.dependencies['scout-server']), {
179-
cwd: path.join(platform.RESOURCES, 'app')
180-
}));
181-
182168
/**
183169
* ## electron
184170
*/

tasks/darwin.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,19 @@ var APP_PATH = path.join(PACKAGE, NAME + '.app');
1414
var packager = require('electron-packager');
1515
var createDMG = require('electron-installer-dmg');
1616

17-
var CONFIG = module.exports = {
17+
module.exports.ELECTRON = path.join(APP_PATH, 'Contents', 'MacOS', 'Electron');
18+
module.exports.RESOURCES = path.join(APP_PATH, 'Contents', 'Resources');
19+
20+
var PACKAGER_CONFIG = {
1821
name: pkg.product_name,
1922
dir: path.resolve(__dirname, '../build'),
2023
out: path.resolve(__dirname, '../dist'),
21-
ignore: new RegExp('(scout-server.asar|node_modules/scout-server)'),
22-
appPath: APP_PATH,
23-
PACKAGE: PACKAGE,
24-
BUILD: path.join(APP_PATH, 'Contents', 'Resources', 'app'),
25-
ELECTRON: path.join(APP_PATH, 'Contents', 'MacOS', 'Electron'),
2624
platform: 'darwin',
2725
arch: 'x64',
2826
version: pkg.electron_version,
2927
icon: path.resolve(__dirname, '../images/darwin/scout.icns'),
30-
background: path.resolve(__dirname, '../images/darwin/background.png'),
3128
overwrite: true,
29+
prune: true,
3230
'app-bundle-id': 'com.mongodb.scout',
3331
'app-version': pkg.version,
3432
sign: '90E39AA7832E95369F0FC6DAF823A04DFBD9CF7A',
@@ -37,7 +35,23 @@ var CONFIG = module.exports = {
3735
name: 'MongoDB Prototcol',
3836
schemes: ['mongodb']
3937
}
40-
],
38+
]
39+
};
40+
41+
// Adjust config via environment variables
42+
if (process.env.SCOUT_INSTALLER_UNSIGNED !== undefined) {
43+
PACKAGER_CONFIG.sign = null;
44+
}
45+
46+
// @todo (imlucas): Standardize `electron-installer-dmg`
47+
// options w/ `electron-installer-squirrel-windows`.
48+
var INSTALLER_CONFIG = {
49+
name: pkg.product_name,
50+
out: path.resolve(__dirname, '../dist'),
51+
icon: path.resolve(__dirname, '../images/darwin/scout.icns'),
52+
appPath: APP_PATH,
53+
overwrite: true,
54+
background: path.resolve(__dirname, '../images/darwin/background.png'),
4155
// The following only modifies "x","y" values from defaults
4256
contents: [
4357
{
@@ -55,28 +69,19 @@ var CONFIG = module.exports = {
5569
]
5670
};
5771

58-
module.exports.RESOURCES = path.join(APP_PATH, 'Contents', 'Resources');
59-
60-
// Adjust config via environment variables
61-
if (process.env.SCOUT_INSTALLER_UNSIGNED !== undefined) {
62-
CONFIG.sign = null;
63-
}
64-
65-
debug('packager config: ', JSON.stringify(CONFIG, null, 2));
66-
6772
module.exports.build = function(done) {
6873
fs.exists(APP_PATH, function(exists) {
6974
if (exists) {
7075
debug('.app already exists. skipping packager run.');
7176
return done();
7277
}
7378
debug('running packager to create electron binaries...');
74-
packager(CONFIG, done);
79+
packager(PACKAGER_CONFIG, done);
7580
});
7681
};
7782

7883
var verify = function(done) {
79-
var cmd = 'codesign --verify "' + CONFIG.appPath + '"';
84+
var cmd = 'codesign --verify "' + PACKAGER_CONFIG.appPath + '"';
8085
debug('Running', cmd);
8186
cp.exec(cmd, done);
8287
};
@@ -85,11 +90,11 @@ module.exports.installer = function(done) {
8590
debug('creating installer...');
8691

8792
var tasks = [];
88-
if (CONFIG.sign) {
93+
if (PACKAGER_CONFIG.sign) {
8994
tasks.push(verify);
9095
}
9196

92-
tasks.push(_.partial(createDMG, CONFIG));
97+
tasks.push(_.partial(createDMG, INSTALLER_CONFIG));
9398

9499
series(tasks, function(err) {
95100
if (err) {

tasks/win32.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ var PACKAGER_CONFIG = {
1414
dir: path.resolve(__dirname, '../build'),
1515
out: path.resolve(__dirname, '../dist'),
1616
platform: 'win32',
17-
ignore: new RegExp('(scout-server.asar|node_modules/scout-server)'),
1817
arch: 'x64',
1918
version: pkg.electron_version,
2019
icon: path.resolve(__dirname, '../images/win32/scout.icon'),
2120
overwrite: true,
21+
prune: true,
2222
'version-string': {
2323
CompanyName: 'MongoDB Inc.',
2424
LegalCopyright: '2015 MongoDB Inc.',
@@ -29,6 +29,7 @@ var PACKAGER_CONFIG = {
2929
InternalName: pkg.name
3030
}
3131
};
32+
3233
var INSTALLER_CONFIG = {
3334
name: 'MongoDBScout',
3435
path: APP_PATH,

0 commit comments

Comments
 (0)