Skip to content

Commit

Permalink
WA开发环境:整理 gulp dist 配置
Browse files Browse the repository at this point in the history
  • Loading branch information
amio committed Mar 6, 2014
1 parent b2c45d9 commit 9a83ea1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var EXPRESS_PORT = 9999;
var SOURCE_ROOT = __dirname + '/app';
var BUILD_ROOT = __dirname + '/dist';

var createServers = function (root, port, lrport) {
function createServers (root, port, lrport) {

// App Server
var app = express();
Expand Down Expand Up @@ -46,7 +46,7 @@ var createServers = function (root, port, lrport) {
app: app,
onchange: onchange
};
};
}

gulp.task('serverdev', function () {
var servers = createServers(SOURCE_ROOT, EXPRESS_PORT, LIVERELOAD_PORT);
Expand Down Expand Up @@ -115,7 +115,7 @@ gulp.task('build', ['clean'], function () {
* Distribution
*/

var sh = function (commands) {
function sh (commands) {
var exec = require('child_process').exec;
var sys = require('sys');
for (var i = 0, l = arguments.length; i < l; i++) {
Expand All @@ -128,16 +128,24 @@ var sh = function (commands) {
}
});
}
};
}

gulp.task('dist', function () {
var target = {
function distribution (tar) {
var targets = {
prod: '[email protected]:/usr/local/httpd/htdocs/tohell/html/',
beta: '[email protected]:/usr/local/httpd/htdocs/beta/html/'
};
var rsyncParams = ' -avz -e ssh --delete --exclude=.git* --exclude=*.scss --exclude=node_modules';

sh('rsync ' + BUILD_ROOT + '/ ' + target.beta + rsyncParams);
sh('rsync ' + BUILD_ROOT + '/ ' + targets[tar].beta + rsyncParams);
}

gulp.task('dist',function(){
distribution('beta');
});

gulp.task('dist:prod',function(){
distribution('prod');
});

/**************************************
Expand Down

0 comments on commit 9a83ea1

Please sign in to comment.