Skip to content

Commit

Permalink
Desktop version now uses electron; Gulp now can package desktop versionl
Browse files Browse the repository at this point in the history
  • Loading branch information
renatopp committed Oct 15, 2015
1 parent d1b1ff3 commit bccb3b7
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- mod: new building system and dependence organization.
- mod: version and building date automatically inserted into code.
- mod: minor presentation changes on loading screen and dash home.
- mod: desktop version now uses electron (see #14).
- fix: cut now remove all nodes, and consider connections too (see #9).
- fix: ctrl+z does not affect property inputs anymore (see #10).

Expand Down
26 changes: 15 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var minifyHTML = require('gulp-minify-html');
var connect = require('gulp-connect');
var less = require('gulp-less');
var jshint = require('gulp-jshint');
var electron = require('gulp-atom-shell');
var templateCache = require('gulp-angular-templatecache');
var replace = require('gulp-replace');
var stylish = require('jshint-stylish');
Expand Down Expand Up @@ -71,10 +72,9 @@ var app_html = [
var app_entry = [
'src/index.html',
'src/package.json',
'src/desktop.js',
]

var build_platforms = ['win32'];//, 'linux32', 'osx32'];

// TASKS (VENDOR) =============================================================
gulp.task('_vendor_js', function() {
return gulp.src(vendor_js)
Expand Down Expand Up @@ -157,7 +157,7 @@ gulp.task('_app_html', function() {

gulp.task('_app_entry', function() {
return gulp.src(app_entry)
.pipe(minifyHTML({empty:true}))
// .pipe(minifyHTML({empty:true}))
.pipe(replace('[BUILD_VERSION]', build_version))
.pipe(replace('[BUILD_DATE]', build_date))
.pipe(gulp.dest('build'))
Expand Down Expand Up @@ -193,17 +193,21 @@ gulp.task('_watch', ['_livereload'], function() {


// TASKS (NODE WEBKIT) ========================================================
gulp.task('_nw', ['build'], function() {
exec('cd build & nw .');
});

gulp.task('_dist', ['build'], function() {
exec('nwbuild -o dist/ -p '+build_platforms.join(',')+' -v 0.12.2 build');
gulp.task('_electron_win', ['build'], function() {
var name = project.name+'-'+project.version+'-win32.zip'
return gulp.src('build/**')
.pipe(electron({version: '0.33.8', platform: 'win32'}))
.pipe(electron.zfsdest('dist/'+name));
});
// gulp.task('_electron_linux', function() {
// var name = project.name+'-'+project.version+'-linux.zip'
// return gulp.src('build/**')
// .pipe(electron({version: '0.33.8', platform: 'linux'}))
// .pipe(electron.zfsdest('dist/'+name));
// });


// COMMANDS ===================================================================
gulp.task('build', ['_vendor', '_preload', '_app']);
gulp.task('serve', ['build', '_watch']);
gulp.task('nw', ['_nw']);
gulp.task('dist', ['_dist'])
gulp.task('dist', ['_electron_win'])
33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"author" : "Renato de Pontes Pereira",
"name" : "behavior3editor",
"version" : "0.3.0",
"homepage" : "http://behavior3.com",
"license" : "MIT",
"bugs" : "https://github.com/behavior3/behavior3editor/issues",
"repository" : "github:behavior3/behavior3editor",

"devDependencies" : {
"author": "Renato de Pontes Pereira",
"name": "behavior3editor",
"version": "0.3.0",
"homepage": "http://behavior3.com",
"license": "MIT",
"bugs": "https://github.com/behavior3/behavior3editor/issues",
"repository": "github:behavior3/behavior3editor",
"devDependencies": {
"electron-prebuilt" : "^0.33.8",
"gulp" : "~3.9.0",
"gulp-angular-templatecache" : "~1.7.0",
"gulp-atom-electron" : "^0.17.2",
"gulp-atom-shell" : "^0.10.0",
"gulp-concat" : "~2.6.0",
"gulp-jshint" : "~1.11.2",
"gulp-uglify" : "~1.4.1",
"gulp-connect" : "~2.2.0",
"gulp-electron" : "0.0.9",
"gulp-jshint" : "~1.11.2",
"gulp-less" : "~3.0.3",
"gulp-angular-templatecache" : "~1.7.0",
"gulp-minify-css" : "~1.2.1",
"gulp-minify-html" : "~1.0.4",
"gulp-replace" : "~0.5.4",
"gulp-uglify" : "~1.4.1",
"jshint-stylish" : "~2.0.1",
"merge-stream" : "~1.0.0"
},
"dependencies": {

}
}
"dependencies": {}
}
39 changes: 39 additions & 0 deletions src/desktop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.

// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform != 'darwin') {
app.quit();
}
});

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({width: 1000, height: 800});

// and load the index.html of the app.
mainWindow.loadUrl('file://' + __dirname + '/index.html');

// Open the DevTools.
// mainWindow.openDevTools();

// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
14 changes: 7 additions & 7 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name" : "behavior3editor",
"version" : "0.3.0",
"main" : "index.html",
"version" : "[BUILD_VERSION]",
"main" : "desktop.js",
"window": {
"title" : "Behavior3 Editor (v0.3.0) - http://behavior3.com",
"title" : "Behavior3 Editor (v[BUILD_VERSION]) http://behavior3.com",
"position" : "center",
"toolbar" : true,
"frame" : true,
"width" : 800,
"height" : 600,
"min_width" : 800,
"min_height" : 600
"width" : 1000,
"height" : 800,
"min_width" : 1000,
"min_height" : 800
}
}

0 comments on commit bccb3b7

Please sign in to comment.