Use gulp API correctly

This commit is contained in:
Yuya Ochiai
2015-12-19 19:43:57 +09:00
parent dc9794b1f5
commit 7774584e63

View File

@@ -10,7 +10,7 @@ var packager = require('electron-packager');
var sources = ['**/*.js', '**/*.css', '**/*.html', '!**/node_modules/**', '!release/**']; var sources = ['**/*.js', '**/*.css', '**/*.html', '!**/node_modules/**', '!release/**'];
gulp.task('prettify', ['sync-meta'], function() { gulp.task('prettify', ['sync-meta'], function() {
gulp.src(sources) return gulp.src(sources)
.pipe(prettify({ .pipe(prettify({
html: { html: {
indentSize: 2 indentSize: 2
@@ -35,7 +35,7 @@ gulp.task('serve', function() {
}); });
}); });
function makePackage(platform, arch) { function makePackage(platform, arch, callback) {
var packageJson = require('./src/package.json'); var packageJson = require('./src/package.json');
packager({ packager({
dir: './src', dir: './src',
@@ -59,32 +59,32 @@ function makePackage(platform, arch) {
} }
}, function(err, appPath) { }, function(err, appPath) {
if (err) { if (err) {
console.log(err); callback(err);
} }
else { else {
console.log('done'); callback();
} }
}); });
}; };
gulp.task('package', ['sync-meta'], function() { gulp.task('package', ['sync-meta'], function(cb) {
makePackage(process.platform, 'all'); makePackage(process.platform, 'all', cb);
}); });
gulp.task('package:all', ['sync-meta'], function() { gulp.task('package:all', ['sync-meta'], function(cb) {
makePackage('all', 'all'); makePackage('all', 'all', cb);
}); });
gulp.task('package:windows', ['sync-meta'], function() { gulp.task('package:windows', ['sync-meta'], function(cb) {
makePackage('win32', 'all'); makePackage('win32', 'all', cb);
}); });
gulp.task('package:osx', ['sync-meta'], function() { gulp.task('package:osx', ['sync-meta'], function(cb) {
makePackage('darwin', 'all'); makePackage('darwin', 'all', cb);
}); });
gulp.task('package:linux', ['sync-meta'], function() { gulp.task('package:linux', ['sync-meta'], function(cb) {
makePackage('linux', 'all'); makePackage('linux', 'all', cb);
}); });
gulp.task('sync-meta', function() { gulp.task('sync-meta', function() {