From 9a83ea16f34ddd31fcc3ae88b2f4ea9b5783fb32 Mon Sep 17 00:00:00 2001 From: Amio Date: Thu, 6 Mar 2014 13:09:59 +0800 Subject: [PATCH] =?UTF-8?q?WA=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=EF=BC=9A?= =?UTF-8?q?=E6=95=B4=E7=90=86=20gulp=20dist=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gulpfile.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index a6732a2..6291c67 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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(); @@ -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); @@ -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++) { @@ -128,16 +128,24 @@ var sh = function (commands) { } }); } -}; +} -gulp.task('dist', function () { - var target = { +function distribution (tar) { + var targets = { prod: 'sxxie@wxddb1.qa.nt.ctripcorp.com:/usr/local/httpd/htdocs/tohell/html/', beta: 'sxxie@wxddb1.qa.nt.ctripcorp.com:/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'); }); /**************************************