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:49:58 UTC

[13/14] git commit: Added prototype ripple support to command line.

Added prototype ripple support to command line.

This will allow:

    cordova ripple ios

which will serve up the app's www folder and then wrap ripple around
it and launch a browser.


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

Branch: refs/heads/next
Commit: cf499d000053b3e6f6631513fd5110c0861f8f01
Parents: 7c0d009
Author: Gord Tanner <gt...@gmail.com>
Authored: Thu Mar 7 11:56:18 2013 -0500
Committer: Gord Tanner <gt...@gmail.com>
Committed: Thu Mar 7 11:56:18 2013 -0500

----------------------------------------------------------------------
 bootstrap.js  |    5 +++++
 cordova.js    |    1 +
 doc/help.txt  |    2 ++
 package.json  |    3 ++-
 src/ripple.js |   33 +++++++++++++++++++++++++++++++++
 5 files changed, 43 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/bootstrap.js
----------------------------------------------------------------------
diff --git a/bootstrap.js b/bootstrap.js
index e45a5f9..ca4d964 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -111,3 +111,8 @@ 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/cf499d00/cordova.js
----------------------------------------------------------------------
diff --git a/cordova.js b/cordova.js
index 5840854..b8f5328 100755
--- a/cordova.js
+++ b/cordova.js
@@ -36,6 +36,7 @@ module.exports = {
     plugin:    require('./src/plugin'),
     plugins:   require('./src/plugin'),
     serve:     require('./src/serve'),
+    ripple:    require('./src/ripple'),
     on:        function() {
         cordova_events.on.apply(cordova_events, arguments);
     },

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
index 28d74a9..937b7f5 100644
--- a/doc/help.txt
+++ b/doc/help.txt
@@ -19,6 +19,8 @@ Project-Level Commands
     serve <platform> [port] ........... runs a local web server for the www/ directory of the given platform
                                         the default port is 8000
                                         note that you must edit the native code to point at the server!
+    ripple <platform> [port] .......... uses the serve command as a base and then wraps the server
+                                        with ripple to test your app in your desktop browser.
     help .............................. shows this!
 
 Example usage

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index bab301c..9a983cf 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,8 @@
     "ncallbacks":"1.0.0",
     "request":"2.11.4",
     "semver":"1.1.0",
-    "prompt":"0.2.7"
+    "prompt":"0.2.7",
+    "open": "0.0.*"
   },
   "devDependencies": {
     "jasmine-node":"1.1.x"

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/src/ripple.js
----------------------------------------------------------------------
diff --git a/src/ripple.js b/src/ripple.js
new file mode 100644
index 0000000..2d4ee19
--- /dev/null
+++ b/src/ripple.js
@@ -0,0 +1,33 @@
+
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+var serve = require('./serve'),
+    ripple = require('ripple'),
+    open = require('open');
+
+module.exports = function (platform, port) {
+    port = port || 8000;
+    var server = serve(platform, port);
+
+    ripple.emulate.start({
+        remote: 'http://localhost:' + port
+    });
+
+    open('http://localhost:4400?enableripple=cordova-2.0.0');
+};