cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: Update "cordova serve" to work with promises refactoring
Date Thu, 03 Oct 2013 18:28:39 GMT
Updated Branches:
  refs/heads/master 1bc89e00f -> d3b329277


Update "cordova serve" to work with promises refactoring


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/d3b32927
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/d3b32927
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/d3b32927

Branch: refs/heads/master
Commit: d3b329277209d8863507f3b8bf0bad11e73736ef
Parents: 1bc89e0
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Oct 3 14:27:53 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Oct 3 14:27:53 2013 -0400

----------------------------------------------------------------------
 src/serve.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d3b32927/src/serve.js
----------------------------------------------------------------------
diff --git a/src/serve.js b/src/serve.js
index 54c7f64..de4a3a2 100644
--- a/src/serve.js
+++ b/src/serve.js
@@ -21,6 +21,7 @@ var cordova_util = require('./util'),
     shell = require('shelljs'),
     platforms     = require('../platforms'),
     config_parser = require('./config_parser'),
+    hooker        = require('./hooker'),
     fs = require('fs'),
     util = require('util'),
     http = require("http"),
@@ -122,7 +123,14 @@ module.exports = function server(port) {
         throw new Error('Current working directory is not a Cordova-based project.');
     }
 
-    // Return for testing.
-    return launchServer(projectRoot, port);
+    var hooks = new hooker(projectRoot);
+    return hooks.fire('before_serve')
+    .then(function() {
+        // Run a prepare first!
+        return require('../cordova').raw.prepare([]);
+    }).then(function() {
+        launchServer(projectRoot, port);
+        return hooks.fire('after_serve');
+    });
 };
 


Mime
View raw message