You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by gt...@apache.org on 2013/03/22 23:56:27 UTC
[2/3] git commit: Tighter Ripple Ingeration
Tighter Ripple Ingeration
- will now only start up one node server
- refactored serve to extract config to boot up ripple server
- ripple will be installed via npm!!11!!!one!!
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/a17c2056
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/a17c2056
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/a17c2056
Branch: refs/heads/master
Commit: a17c205689e1d6c2a4b891c3cc080317c719562b
Parents: cf499d0
Author: Gord Tanner <gt...@gmail.com>
Authored: Fri Mar 22 17:20:27 2013 -0400
Committer: Gord Tanner <gt...@gmail.com>
Committed: Fri Mar 22 17:20:27 2013 -0400
----------------------------------------------------------------------
bootstrap.js | 6 -----
package.json | 3 +-
src/ripple.js | 32 +++++++++++++++++++++++-----
src/serve.js | 57 ++++++++++++++++++++++++---------------------------
4 files changed, 55 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/bootstrap.js
----------------------------------------------------------------------
diff --git a/bootstrap.js b/bootstrap.js
index ca4d964..6eca53f 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -110,9 +110,3 @@ platforms.forEach(function(platform) {
}
});
});
-
-// HACK: Install and configure ripple
-// Ripple will soon be in npm, this is a workaround until that happens
-shell.exec("git clone https://github.com/blackberry/Ripple-UI/ node_modules/ripple", {silent:false});
-shell.cd("node_modules/ripple");
-shell.exec("./configure && jake", {silent: false});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 9a983cf..27fdba3 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,8 @@
"request":"2.11.4",
"semver":"1.1.0",
"prompt":"0.2.7",
- "open": "0.0.*"
+ "ripple-emulator":">=0.9.15",
+ "open": "0.0.3"
},
"devDependencies": {
"jasmine-node":"1.1.x"
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/src/ripple.js
----------------------------------------------------------------------
diff --git a/src/ripple.js b/src/ripple.js
index 2d4ee19..ddbf297 100644
--- a/src/ripple.js
+++ b/src/ripple.js
@@ -18,16 +18,36 @@
under the License.
*/
var serve = require('./serve'),
- ripple = require('ripple'),
+ ripple = require('ripple-emulator'),
open = require('open');
module.exports = function (platform, port) {
port = port || 8000;
- var server = serve(platform, port);
- ripple.emulate.start({
- remote: 'http://localhost:' + port
- });
+ serve.config(platform, port, function (cfg) {
+ ripple.emulate.start({
+ path: cfg.paths,
+ port: port
+ });
+
+ var device;
- open('http://localhost:4400?enableripple=cordova-2.0.0');
+ switch (platform) {
+ case "blackberry":
+ device = "Z10";
+ break;
+ case "ios":
+ device = "IPhone5";
+ break;
+ case "android":
+ device = "NexusS";
+ break;
+ default:
+ device = "XVGA";
+ break;
+ }
+
+ var uri = "http://localhost:" + port + "?enableripple=cordova-2.0.0-" + device;
+ open(uri);
+ });
};
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/src/serve.js
----------------------------------------------------------------------
diff --git a/src/serve.js b/src/serve.js
index b15f907..ba23e7f 100644
--- a/src/serve.js
+++ b/src/serve.js
@@ -79,6 +79,17 @@ function launch_server(www, platform_www, port) {
}
module.exports = function serve (platform, port) {
+ var returnValue = {};
+
+ module.exports.config(platform, port, function (config) {
+ returnValue.server = launch_server(config.paths[0], config.paths[1], port);
+ });
+
+ // Hack for testing despite its async nature.
+ return returnValue;
+};
+
+module.exports.config = function (platform, port, callback) {
var projectRoot = cordova_util.isCordova(process.cwd());
if (!projectRoot) {
@@ -100,46 +111,32 @@ module.exports = function serve (platform, port) {
// If we got to this point, the given platform is valid.
- // Default port is 8000 if not given. This is also the default of the Python module.
- port = port || 8000;
+ var result = {
+ paths: [],
+ // Default port is 8000 if not given. This is also the default of the Python module.
+ port: port || 8000
+ };
// Top-level www directory.
- var www = projectRoot + path.sep + 'www';
+ result.paths.push(projectRoot + path.sep + 'www');
- var parser, platformPath;
+ var parser;
- // Hack for testing despite its async nature.
- var returnValue = {};
switch (platform) {
case 'android':
- platformPath = path.join(projectRoot, 'platforms', 'android');
- parser = new android_parser(platformPath);
-
- // Update the related platform project from the config
- parser.update_project(cfg);
- var platform_www = parser.www_dir();
- returnValue.server = launch_server(www, platform_www, port);
+ parser = new android_parser(path.join(projectRoot, 'platforms', platform));
break;
case 'blackberry-10':
- platformPath = path.join(projectRoot, 'platforms', 'blackberry-10');
- parser = new blackberry_parser(platformPath);
-
- // Update the related platform project from the config
- parser.update_project(cfg, function() {
- // Shell it
- returnValue.server = launch_server(www, parser.www_dir(), port);
- });
+ parser = new blackberry_parser(path.join(projectRoot, 'platforms', platform));
break;
case 'ios':
- platformPath = path.join(projectRoot, 'platforms', 'ios');
- js = path.join(__dirname, '..', 'lib', 'ios', 'CordovaLib', 'javascript', 'cordova.ios.js');
- parser = new ios_parser(platformPath);
- // Update the related platform project from the config
- parser.update_project(cfg, function() {
- returnValue.server = launch_server(www, parser.www_dir(), port);
- });
+ parser = new ios_parser(path.join(projectRoot, 'platforms', platform));
break;
}
- return returnValue;
-};
+ // Update the related platform project from the config
+ parser.update_project(cfg, function() {
+ result.paths.push(parser.www_dir());
+ callback(result);
+ });
+}