You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ripple.apache.org by gt...@apache.org on 2013/10/06 04:34:51 UTC

git commit: Cleaned up `ripple emulate` command for Cordova 3.0

Updated Branches:
  refs/heads/cordova-3.0 af934027b -> 5553148ae


Cleaned up `ripple emulate` command for Cordova 3.0

- automatically open the browser now for the developer
- handle the array correctly.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/5553148a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/5553148a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/5553148a

Branch: refs/heads/cordova-3.0
Commit: 5553148aed5fae4ed80c012819c8bd65e2ef2a45
Parents: af93402
Author: Gord Tanner <gt...@gmail.com>
Authored: Sat Oct 5 22:29:04 2013 -0400
Committer: Gord Tanner <gt...@gmail.com>
Committed: Sat Oct 5 22:29:04 2013 -0400

----------------------------------------------------------------------
 lib/cli/emulate.js    |  6 +++++-
 lib/server/emulate.js | 25 +++++++++++++++----------
 package.json          |  3 ++-
 3 files changed, 22 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/5553148a/lib/cli/emulate.js
----------------------------------------------------------------------
diff --git a/lib/cli/emulate.js b/lib/cli/emulate.js
index 786c535..8648b6e 100644
--- a/lib/cli/emulate.js
+++ b/lib/cli/emulate.js
@@ -19,6 +19,7 @@
  *
  */
 var self,
+    open = require('open'),
     emulate = require('./../server/emulate');
 
 self = {
@@ -26,7 +27,10 @@ self = {
         self.start(opts);
     },
     start: function (opts) {
-        emulate.start(opts);
+        var app = emulate.start(opts);
+
+        var uri = "http://localhost:" + app._port + "?enableripple=cordova-3.0.0";
+        open(uri);
     }
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/5553148a/lib/server/emulate.js
----------------------------------------------------------------------
diff --git a/lib/server/emulate.js b/lib/server/emulate.js
index 1bd6d15..9a9d9a1 100644
--- a/lib/server/emulate.js
+++ b/lib/server/emulate.js
@@ -60,17 +60,22 @@ module.exports = {
         app.use(hosted.inject(options));
 
         if (!options.remote) {
-            try {
-                fs.statSync(path.join(options.path, ".cordova"))
-                console.log("Cordova 3.0 Project detected...");
-                var platforms = fs.readdirSync(path.join(options.path, "platforms"));
-                if (platforms.indexOf('android') >= 0) {
-                    options.cordova = true;
-                    options.path = [path.join(options.path, "platforms", "android", "assets", "www")];
+            options.path = options.path.map(function (p) {
+                try {
+                    //look for the .cordova folder
+                    fs.statSync(path.join(p, ".cordova"))
+                    console.log("Cordova 3.0 Project detected...");
+                    var platforms = fs.readdirSync(path.join(p, "platforms"));
+                    if (platforms.indexOf('android') >= 0) {
+                        options.cordova = true;
+                        p = path.join(p, "platforms", "android", "assets", "www");
+                    }
+                } catch (e) {
+                    //Not a cordova project
                 }
-            } catch (e) {
-                //Not a cordova project
-            }
+
+                return p;
+            });
 
             options.path.forEach(function (path) {
                 app.use("/", express.static(path));

http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/5553148a/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index b6acd87..6f666ff 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,8 @@
     "request": "2.12.0",
     "colors" : "0.6.0-1",
     "moment" : "1.x.x",
-    "accounting" : "0.x.x"
+    "accounting" : "0.x.x",
+    "open": "0.0.3"
   },
   "devDependencies": {
     "connect": "2.3.6",