[CB-3741] Updating utils to create blackberry10.json earlier and offer
additional methods.


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

Branch: refs/heads/master
Commit: db75de5875fc0c7c70fa3ff541bf348f81112bc5
Parents: 3e673ff
Author: Jeffrey Heifetz <[email protected]>
Authored: Thu Jun 20 11:13:59 2013 -0400
Committer: Jeffrey Heifetz <[email protected]>
Committed: Fri Jun 21 17:39:58 2013 -0400

----------------------------------------------------------------------
 blackberry10/bin/lib/utils.js                       | 12 ++++++++++--
 blackberry10/bin/test/cordova/integration/target.js |  8 ++++----
 2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/db75de58/blackberry10/bin/lib/utils.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/lib/utils.js b/blackberry10/bin/lib/utils.js
index de4557c..0a4f8a8 100644
--- a/blackberry10/bin/lib/utils.js
+++ b/blackberry10/bin/lib/utils.js
@@ -183,14 +183,22 @@ _self = {
         return cordovaPath;
     },
 
-    getProperties: function () {
+    getPropertiesFilePath: function () {
         var propertiesFile = path.join(_self.getCordovaDir(), 
PROPERTY_FILE_NAME);
 
         if (!fs.existsSync(propertiesFile)) {
             _self.writeToPropertiesFile(DEFAULT_PROPERTY_FILE);
         }
 
-        return require(propertiesFile);
+        return propertiesFile;
+    },
+
+    getPropertiesFileName: function () {
+        return PROPERTY_FILE_NAME;
+    },
+
+    getProperties: function () {
+        return require(_self.getPropertiesFilePath());
     },
 
     writeToPropertiesFile: function (data) {

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/db75de58/blackberry10/bin/test/cordova/integration/target.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/test/cordova/integration/target.js 
b/blackberry10/bin/test/cordova/integration/target.js
index d8d067a..4ff2ed9 100644
--- a/blackberry10/bin/test/cordova/integration/target.js
+++ b/blackberry10/bin/test/cordova/integration/target.js
@@ -25,7 +25,7 @@ var childProcess = require('child_process'),
     utils = require('../../../lib/utils'),
     fs = require('fs'),
     path = require('path'),
-    configPath = path.join(utils.getCordovaDir(), 'blackberry10.json'),
+    configPath = utils.getPropertiesFilePath(),
     flag = false,
     testAppCreated = false,
     _stdout = "",
@@ -59,8 +59,8 @@ describe("cordova/target tests", function () {
     });
 
     afterEach(function () {
-        utils.copyFile(path.join(utils.getCordovaDir(), "bb10bak", 
"blackberry10.json"), path.join(utils.getCordovaDir()));
-        wrench.rmdirSyncRecursive(path.join(utils.getCordovaDir(), 
"bb10bak"));   
+        utils.copyFile(path.join(utils.getCordovaDir(), "bb10bak", 
utils.getPropertiesFileName()), path.join(utils.getCordovaDir()));
+        wrench.rmdirSyncRecursive(path.join(utils.getCordovaDir(), "bb10bak"));
     });
 
     it("should add a target", function () {
@@ -224,7 +224,7 @@ describe("cordova/target tests", function () {
     it("should warn invalid pin", function () {
 
         //keep this in last test to remove test app
-        this.after(function() { 
+        this.after(function() {
             wrench.rmdirSyncRecursive(tempFolder);
         });
 

Reply via email to