You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2014/06/06 18:21:33 UTC

[5/6] git commit: [docs] document configparser module

[docs] document configparser module


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

Branch: refs/heads/configparser_module
Commit: 25753e87bf79801330ed863cfdb7cbc285b604eb
Parents: 1f68078
Author: Lorin Beer <lo...@gmail.com>
Authored: Thu Jun 5 16:29:54 2014 -0700
Committer: Lorin Beer <lo...@gmail.com>
Committed: Thu Jun 5 16:29:54 2014 -0700

----------------------------------------------------------------------
 cordova-lib/src/configparser/README.md | 78 ++++++++++++++++++++++++-----
 1 file changed, 65 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/25753e87/cordova-lib/src/configparser/README.md
----------------------------------------------------------------------
diff --git a/cordova-lib/src/configparser/README.md b/cordova-lib/src/configparser/README.md
index f2f8067..e5cd1bf 100644
--- a/cordova-lib/src/configparser/README.md
+++ b/cordova-lib/src/configparser/README.md
@@ -19,16 +19,68 @@
 #
 -->
 
-# cordova-lib
-Contains npm modules used primarily by [cordova](https://github.com/apache/cordova-cli/) and [plugman](https://github.com/apache/cordova-plugman/).
-
-## Setup
-* Clone this repository onto your local machine. 
-    `git clone https://git-wip-us.apache.org/repos/asf/cordova-lib.git`
-* In terminal, navigate to the inner cordova-lib directory.
-    `cd cordova-lib/cordova-lib`
-* Install dependencies and npm-link
-    `npm install && npm link`
-* Navigate to CLI and Plugman directories and link cordova-lib
-    `cd ../../cordova-cli && npm link cordova-lib && npm install`
-    `cd ../../cordova-plugman && npm link cordova-lib && npm install`
+# Cordova-Lib
+
+## ConfigParser
+
+wraps a valid cordova config.xml file 
+
+### Usage
+
+### Include the ConfigParser module in a projet
+
+    var ConfigParser = require('cordova-lib').configparser;
+
+### Create a new ConfigParser
+
+    var config = new ConfigParser('path/to/config/xml/');
+    
+### Utility Functions
+
+#### packageName(id)
+returns document root 'id' attribute value
+#### Usage
+
+    config.packageName: function(id) 
+
+/*
+ * sets document root element 'id' attribute to @id
+ *
+ * @id - new id value
+ *
+ */
+#### setPackageName(id)
+set document root 'id' attribute to 
+ function(id) {
+        this.doc.getroot().attrib['id'] = id;
+    },
+
+### 
+    name: function() {
+        return getNodeTextSafe(this.doc.find('name'));
+    },
+    setName: function(name) {
+        var el = findOrCreate(this.doc, 'name');
+        el.text = name;
+    },
+
+### read the description element
+    
+    config.description()
+
+    var text = "New and improved description of App"
+    setDescription(text)
+    
+### version management
+    version()
+    android_versionCode()
+    ios_CFBundleVersion()
+    setVersion()
+    
+### read author element
+
+   config.author();
+
+### read preference
+
+    config.getPreference(name);