Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
55c42d0
fix(windows) revive windows build, installer
kangas Aug 13, 2015
407c498
fix(windows) tweaks
kangas Aug 14, 2015
2849ac5
fix(windows) revive windows build, installer
kangas Aug 13, 2015
0f4e9e4
fix(windows) add/remove shortcuts
kangas Aug 31, 2015
d15f65e
fix(windows) installer_filename path
kangas Aug 31, 2015
a6556af
fix(windows) pin electron-squirrel-startup 0.1.2
kangas Aug 31, 2015
0e8c558
fix(windows) NOSPACE_PRODUCT_NAME
kangas Sep 1, 2015
dc328e9
Revert "fix(windows) NOSPACE_PRODUCT_NAME"
imlucas Sep 1, 2015
8a5c58a
Revert "fix(windows) pin electron-squirrel-startup 0.1.2"
imlucas Sep 1, 2015
046f342
fix(windows) NOSPACE_PRODUCT_NAME
kangas Sep 1, 2015
c18feae
fix(windows) pin electron-installer-squirrel-windows to reset-munged-…
kangas Sep 1, 2015
ea4e6c9
fix(windows) make asar toggleable for win32
kangas Sep 1, 2015
9a7087a
Merge branch 'fix-windows' of github.com:10gen/scout into fix-windows
imlucas Sep 1, 2015
9fca157
bump electron-installer-squirrel-windows and refactor so windows inst…
imlucas Sep 1, 2015
4a8177d
Revert "bump electron-installer-squirrel-windows and refactor so wind…
imlucas Sep 1, 2015
17445bc
new rev of electron-installer-squirrel-windows to fix issues with whi…
imlucas Sep 1, 2015
ca65924
Merge branch 'fix-windows' of github.com:10gen/scout into fix-windows
imlucas Sep 1, 2015
b3176bb
fix typo
imlucas Sep 1, 2015
3f61ec7
Bump electron to 0.31.1 and refactor a bit to make windows work.
imlucas Sep 1, 2015
640281c
Merge branch 'fix-windows' of github.com:10gen/scout into fix-windows
imlucas Sep 1, 2015
dae3dd2
Trying to install npm@3 on build machines for more reliability
imlucas Sep 2, 2015
98c1eee
npm depdupe when building release so asar doesnt freak
imlucas Sep 1, 2015
f727940
Roll electron back to 0.30.5
imlucas Sep 2, 2015
b81a033
Don't run npm dedupe to test npm@3 fix
imlucas Sep 2, 2015
383e492
Start scout-server as a subproc.
imlucas Sep 2, 2015
089cbb3
move scout-server to a child process
imlucas Sep 3, 2015
a8593a4
fix(gulp): stupid race on release task
imlucas Sep 3, 2015
9a912f9
fix(gulp): add back package.json copy
imlucas Sep 3, 2015
f3cb527
tired eyes
imlucas Sep 3, 2015
d9c3b77
Revert "fix(windows) installer_filename path"
kangas Sep 3, 2015
4d3b4b4
Revert "Trying to install npm@3 on build machines for more reliability"
kangas Sep 3, 2015
aba9caf
start crash-reporter first to inspect .dmp files
imlucas Sep 3, 2015
35c86d3
switch scout-server-ctl to spawn instead of fork
imlucas Sep 3, 2015
1c9c414
better debug message when overriding window.open
imlucas Sep 3, 2015
5d2ee2d
fix(gulp): put bin files in the right place
imlucas Sep 3, 2015
b8079ed
lint cleanup
imlucas Sep 3, 2015
cd87739
fix(gulp): shouldn't pass callback to sequence when package.json changed
imlucas Sep 3, 2015
a68c1ed
bump electron to v0.30.6
imlucas Sep 3, 2015
7266e0f
experimental task to detect a potential win32 MAX_PATH problem
imlucas Sep 3, 2015
4101709
fix(gulp): use our fork of gulp-asar thats not broken..
imlucas Sep 4, 2015
4492ec9
get mac build running again
imlucas Sep 5, 2015
f9a62e0
hooray for npm@3
imlucas Sep 5, 2015
8ce3b8a
when suddenly a weird UI error
imlucas Sep 5, 2015
56fefb7
switch windows to x64 builds
imlucas Sep 5, 2015
f303b50
dont need to prune anymore since we've switched to npm@3 + fmt
imlucas Sep 5, 2015
dcd78c9
fix(osx) signed installer build bug
kangas Sep 7, 2015
7c34100
don't re-run packager when building installer
imlucas Sep 8, 2015
af8be58
standardizing win32+darwin builds
imlucas Sep 8, 2015
9f40931
better debug msg when verifying code signature on darwin
imlucas Sep 8, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 139 additions & 76 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
process.env.DEBUG = '*';

/**
* # Welcome to Scout's gulpfile!
*
* Here are a few tips to guide you on your quest:
*
* - [Gulp](http://gulpjs.com) is a toolkit for workflow automation
* - Use the `DEBUG` environment variable if you run into trouble! @see http://npm.im/debug
* - Check out the [gulp cookbook](http://git.io/vGye8) for more info
* - Remember to smile and floss
*/
var path = require('path');
var spawn = require('child_process').spawn;
var browserify = require('browserify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');
Expand All @@ -9,91 +23,101 @@ var sourcemaps = require('gulp-sourcemaps');
var buffer = require('vinyl-buffer');
var merge = require('merge-stream');
var shell = require('gulp-shell');
var path = require('path');
var del = require('del');
var spawn = require('child_process').spawn;
var sequence = require('run-sequence');

var notify = require('./tasks/notify');
var pkg = require('./package.json');

// Platform specific tasks
var platform = require(path.join(__dirname, 'tasks', process.platform));

gulp.task('dev:configure', function() {
process.env.NODE_ENV = 'development';
});

gulp.task('release:configure', function() {
/**
* # release
*
* `npm run release` calls this to build Scout
* and generate installers for users.
*/
gulp.task('release', function(done) {
process.env.NODE_ENV = 'production';
sequence(
'build',
'electron:build',
'electron:build-installer'
, done);
});

// `npm start` calls this.
gulp.task('dev', ['dev:build-app', 'dev:build-js', 'dev:remove-unpacked-app'], function() {
var child = spawn(path.resolve(platform.ELECTRON), ['build/']);
child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);
child.on('exit', function(code) {
process.exit(code);
});
return gulp.start('dev:watch');
});

gulp.task('dev:build-app', ['dev:configure', 'dev:build-electron'], function() {
return gulp.start('pages', 'less', 'copy:fonts', 'copy:images', 'copy:electron');
});

gulp.task('dev:remove-unpacked-app', ['dev:build-electron'], function() {
// deletes the `app` folder in electron build
// so `platform:start` can just point the electron renderer at `BUILD`
// and we don't have to do all kinds of crazy copying.
return del(platform.BUILD);
});
gulp.task('dev:build-electron', platform.build);

// `npm run release` calls this.
gulp.task('release', ['release:build-app'], function() {
return gulp.start('release:electron:build-installer');
/**
* # build
*/
gulp.task('build', function(done) {
sequence(
[
'build:pages',
'build:less',
'copy:fonts',
'copy:images',
'copy:text',
'copy:js',
'copy:package.json'
],
'npm:install',
'build:js'
, done);
});

gulp.task('release:build-app', [
'js',
'pages',
'less',
'copy:fonts',
'copy:images',
'copy:electron'
]);

gulp.task('release:electron:build-installer', ['release:build-app'], platform.installer);

var bundler = browserify(pkg.browserify).transform('jadeify');
gulp.task('js', ['release:npm-install'], function() {
return bundler.bundle()
.on('error', notify('js'))
.pipe(source('index.js'))
.pipe(buffer())
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('build/'));
/**
* # dev
*
* `npm start` calls this which you call at least once a day
* so if there is something bugging you, post a message in flowdock!
*/
gulp.task('dev', function(done) {
process.env.NODE_ENV = 'development';
sequence(
'build',
'electron:build',
'electron:start',
'watch'
, done);
});

gulp.task('dev:watch', function() {
gulp.watch(['src/{*,**/*}.less', 'styles/*.less'], ['less']);
gulp.watch(['src/*.jade'], ['pages']);
/**
* # watch
*
* Once you build the app and start it up, the next thing you'll want to do
* is actually change things. `watch` handles applying the correct
* tasks to your change so you can actually view the results.
*/
gulp.task('watch', function() {
gulp.watch(['src/{*,**/*}.less', 'styles/*.less'], ['build:less']);
gulp.watch(['src/*.jade'], ['build:pages']);
gulp.watch('images/{*,**/*}', ['copy:images']);
gulp.watch('fonts/*', ['copy:fonts']);
gulp.watch(['main.js', 'src/electron/*', 'settings.json'], ['copy:electron']);
gulp.watch('package.json', ['copy:electron', 'dev:npm-install']);
gulp.watch(['src/electron/*'], ['copy:js']);
gulp.watch('package.json', function() {
gutil.log('package.json changed!');
sequence('copy:package.json', 'npm:install');
});
});

/**
* Gulp's [fast browserify builds recipe](http://git.io/iiCk-A)
* Use browserify to compile the UI js.
*/
gulp.task('dev:build-js', [
'dev:build-app',
'dev:npm-install'], function() {
gulp.task('build:js', function() {
var bundler = browserify(pkg.browserify).transform('jadeify');
if (process.env.NODE_ENV === 'production') {
return bundler.bundle()
.on('error', notify('js'))
.pipe(source('index.js'))
.pipe(buffer())
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('build/'));
}
// @see [fast browserify builds recipe](http://git.io/iiCk-A)
var b;
function rebundle(files) {
if (files) {
Expand All @@ -112,8 +136,10 @@ gulp.task('dev:build-js', [
return rebundle();
});

// Compile LESS to CSS.
gulp.task('less', function() {
/**
* Compile LESS to CSS.
*/
gulp.task('build:less', function() {
return gulp.src('src/*.less')
.pipe(sourcemaps.init())
.pipe(less(pkg.less))
Expand All @@ -122,8 +148,13 @@ gulp.task('less', function() {
.pipe(gulp.dest('build/'));
});

// Compile jade templates to HTML files.
gulp.task('pages', function() {
/**
* Compile jade templates to static HTML files.
* require('*.jade') statements you see in `src`
* are compiled via the `jadeify` browserify transform.
* @see build:js
*/
gulp.task('build:pages', function() {
return gulp.src('src/index.jade')
.pipe(jade({
locals: {
Expand All @@ -134,7 +165,32 @@ gulp.task('pages', function() {
.pipe(gulp.dest('build/'));
});

// Things that should be copied into `build/`.
/**
* ## electron
*/
gulp.task('electron:start', function() {
var child = spawn(path.resolve(platform.ELECTRON), ['build/']);
child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);
child.on('exit', function(code) {
process.exit(code);
});
});

gulp.task('electron:build', function(done) {
platform.build(function(err) {
if (err) {
return done(err);
}
done();
});
});

gulp.task('electron:build-installer', platform.installer);

/**
* ## Things that should be copied into `build/`.
*/
gulp.task('copy:fonts', function() {
return gulp.src(pkg.fonts)
.pipe(gulp.dest('build/fonts'));
Expand All @@ -145,20 +201,27 @@ gulp.task('copy:images', function() {
.pipe(gulp.dest('build/images'));
});

gulp.task('copy:electron', function() {
gulp.task('copy:package.json', function() {
return gulp.src('package.json')
.pipe(gulp.dest('build/'));
});

gulp.task('copy:text', function() {
return gulp.src(['README.md'])
.pipe(gulp.dest('build/'));
});

// Copy non-UI js into the build.
gulp.task('copy:js', function() {
return merge(
gulp.src(['main.js', 'package.json', 'settings.json', 'README.md'])
gulp.src(['main.js'])
.pipe(gulp.dest('build/')),
gulp.src(['src/electron/*'])
.pipe(gulp.dest('build/src/electron'))
);
});

gulp.task('dev:npm-install', ['copy:electron'], shell.task('npm install', {
cwd: 'build/'
}));

gulp.task('release:npm-install', ['copy:electron'], shell.task('npm install --production', {
gulp.task('npm:install', shell.task('npm install --production --quiet --loglevel error', {
cwd: 'build/'
}));

Expand Down
7 changes: 0 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
/**
* The main entrpoint Electron will execute.
*/
if (process.env.NODE_ENV === 'development') {
process.env.DEBUG = 'mon*,sco*';
}

// @todo (imlucas): Use subprocess instead?
require('scout-server').start();

require('./src/electron');
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "scout",
"name": "mongodb-scout",
"description": "The MongoDB GUI.",
"version": "0.3.0",
"main": "main.js",
"electron_version": "0.30.5",
"electron_version": "0.30.6",
"product_name": "MongoDB Scout",
"authors": "MongoDB Inc.",
"check": {
Expand All @@ -27,7 +27,12 @@
"browser-window",
"menu",
"jade",
"ampersand-state"
"ampersand-state",
"scout-server",
"tiny-lr",
"watch",
"glob",
"electron-squirrel-startup"
]
},
"fonts": [
Expand Down Expand Up @@ -62,6 +67,11 @@
"url": "git://github.com/10gen/scout.git"
},
"dependencies": {
"debug": "^2.2.0",
"scout-server": "http://bin.mongodb.org/js/scout-server/v0.0.4/scout-server-0.0.4.tar.gz",
"electron-squirrel-startup": "^0.1.2"
},
"devDependencies": {
"ampersand-app": "^1.0.4",
"ampersand-collection": "^1.4.5",
"ampersand-collection-filterable": "^0.2.1",
Expand All @@ -75,10 +85,10 @@
"bootstrap": "https://github.com/twbs/bootstrap/archive/v3.3.5.tar.gz",
"bugsnag-js": "^2.4.8",
"d3": "^3.5.5",
"debug": "^2.2.0",
"domready": "^1.0.8",
"event-stream": "^3.3.1",
"font-awesome": "https://github.com/FortAwesome/Font-Awesome/archive/v4.3.0.tar.gz",
"glob": "^5.0.14",
"jade": "^1.11.0",
"jquery": "^2.1.4",
"local-links": "^1.4.0",
Expand All @@ -96,15 +106,12 @@
"raf": "^3.0.0",
"scout-brain": "http://bin.mongodb.org/js/scout-brain/v0.0.2/scout-brain-0.0.2.tar.gz",
"scout-client": "http://bin.mongodb.org/js/scout-client/v0.0.5/scout-client-0.0.5.tar.gz",
"scout-server": "http://bin.mongodb.org/js/scout-server/v0.0.4/scout-server-0.0.4.tar.gz",
"tiny-lr": "^0.1.6",
"watch": "^0.16.0"
},
"devDependencies": {
"watch": "^0.16.0",
"browserify": "^10.2.4",
"del": "^1.2.0",
"electron-installer-dmg": "^0.1.0",
"electron-installer-squirrel-windows": "0.0.1",
"electron-installer-squirrel-windows": "^0.4.0",
"electron-packager": "^5.0.0",
"eslint": "^0.24.1",
"eslint-config-mongodb-js": "^0.1.4",
Expand All @@ -123,6 +130,7 @@
"node-notifier": "^4.2.3",
"phantomjs": "^1.9.17",
"pre-commit": "^1.0.10",
"run-sequence": "^1.1.2",
"run-series": "^1.1.2",
"stream-combiner2": "^1.0.2",
"vinyl-buffer": "^1.0.0",
Expand Down
Loading