Skip to content

Instantly share code, notes, and snippets.

@vladimir-kotikov
Last active August 29, 2015 14:23
Show Gist options
  • Save vladimir-kotikov/14a8094b425d489e3a7b to your computer and use it in GitHub Desktop.
Save vladimir-kotikov/14a8094b425d489e3a7b to your computer and use it in GitHub Desktop.
The structure of ProjectInfo class for PlatformApi
/* jshint node:true, unused:false */
var path = require('path');
var BuildConfig = require('cordova-common').BuildConfig;
var ConfigParser = require('cordova-common').ConfigParser;
/**
* Encapsulates and stores project information.
*
* @class
*/
function ProjectInfo(root) {
/**
* Simple object that exposes this project's FS locations, such as www
* directory location.
*
* @type {Object}
*/
this.locations = {
/** @type {String} Www directory location */
www: path.join(root, 'www'),
/** @type {String} config.xml file location */
configXml: path.join(root, 'config.xml'),
/** @type {String } Installed platforms location */
platforms: path.join(root, 'platforms')
};
/**
* The project's location. This field isn't being persisted and set up in
* constructor only
*
* @type {String}
*/
this.root = root;
/**
* Represents the configuration, used for build project. Created dynamically
* in constructor and populated with values from buildconfig.json, if
* exists.
*
* @type {BuildConfig}
*/
this.buildConfig = new BuildConfig(root);
/**
* Represents the project design- and runtime configuration that stored in
* project's config.xml file
*
* @type {ConfigParser}
*/
this.projectConfig = new ConfigParser(this.locations.configXml);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment