You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/10/03 20:28:39 UTC
git commit: Update "cordova serve" to work with promises refactoring
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 <ag...@chromium.org>
Authored: Thu Oct 3 14:27:53 2013 -0400
Committer: Andrew Grieve <ag...@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');
+ });
};