var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var packager = require('electron-packager');

gulp.task('compile', function(){
	return gulp.src('src/**/*.{js,jsx}')
		.pipe(
			$.babel({
				stage: 0
			})
		)
		.pipe(gulp.dest('js'));
});

var commonOption = {
		dir: './',
		out: 'release',
		name: 'TDUCTF-2015',
		arch: 'all',
		platform: 'all',
		ignore: [
			'./node_modules/electron*',
			'./node_modules/.bin',
			'./release/',
			'./src/',
			'./.git*'
		],
		version: '0.31.1'
}

gulp.task('package:darwin', ['compile'], function (done) {
	var option = commonOption;
	option.platform = 'darwin';
	option.arch = 'x64';
	option.icon = "app-icon.icns";
	packager(option, function (err, path) {
		done();
	});
});

gulp.task('package:linux:ia32', ['compile'], function (done) {
	var option = commonOption;
	option.platform = 'linux';
	option.arch = 'ia32';
	option.icon = "app-icon.png";
	packager(option, function (err, path) {
		done();
	});
});

gulp.task('package:linux:x64', ['compile'], function (done) {
	var option = commonOption;
	option.platform = 'linux';
	option.arch = 'x64';
	option.icon = "app-icon.png";
	packager(option, function (err, path) {
		done();
	});
});

gulp.task('package:win:ia32', ['compile'], function (done) {
	var option = commonOption;
	option.platform = 'win';
	option.arch = 'ia32';
	option.icon = "app-icon.ico";
	packager(option, function (err, path) {
		done();
	});
});

gulp.task('package:win:x64', ['compile'], function (done) {
	var option = commonOption;
	option.platform = 'win';
	option.arch = 'x64';
	option.icon = "app-icon.ico";
	packager(option, function (err, path) {
		done();
	});
});

gulp.task('package:all', [
		'package:darwin',
		'package:linux:ia32',
		'package:linux:x64',
		'package:win:ia32',
		'package:win:x64'], function (done) {
	done();
});


@@ -363,16 +363,30 @@
  'all',%0A
+%09%09asar: true,%0A
 %09%09ignore
@@ -389,16 +389,16 @@
 nore: %5B%0A
-
 %09%09%09'./no
@@ -659,40 +659,8 @@
 4';%0A
-%09option.icon = %22app-icon.icns%22;%0A
 %09pac
@@ -862,39 +862,8 @@
 2';%0A
-%09option.icon = %22app-icon.png%22;%0A
 %09pac
@@ -1063,39 +1063,8 @@
 4';%0A
-%09option.icon = %22app-icon.png%22;%0A
 %09pac
@@ -1262,39 +1262,8 @@
 2';%0A
-%09option.icon = %22app-icon.ico%22;%0A
 %09pac
@@ -1425,32 +1425,32 @@
 atform = 'win';%0A
+
 %09option.arch = '
@@ -1459,39 +1459,8 @@
 4';%0A
-%09option.icon = %22app-icon.ico%22;%0A
 %09pac

Enable asar and disable icon support