judpack-common
Version:
jud pack common
87 lines (65 loc) • 2 kB
Markdown
<!--
#
# 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.
#
-->
# 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);