Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformApi definition and documentation. #9

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions proposals/CordovaPlatform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* jshint node:true, unused:false */

var path = require('path');
var BuildConfig = require('cordova-common').BuildConfig;
var ConfigParser = require('cordova-common').ConfigParser;

/**
* Encapsulates and stores platform's information.
*
* @class
*/
function CordovaPlatform(root) {
/**
* Simple object that exposes platform's filesystem locations, such as www
* directory.
*
* @type {Object}
*/
this.locations = {
/** @type {String} Platform's www directory location */
www: path.join(root, 'www'),
/** @type {String} Platform's config.xml file location */
configXml: path.join(root, 'config.xml'),
/**
* Location of cordova.js that shipped with platform.
* NOTE: THIS PATH IS NOT ABSOLUTE. IT IS RELATIVE TO PLATFORM'S
* ORIGINAL PACKAGE DIRECTORY, NOT THE INSTALLED PLATFORM'S LOCATION.
*
* @type {String}
*/
cordovaJs: path.join('bin', 'template', 'www', 'cordova.js'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be exposing this file ? I think we should expose the one that gets generated by 'prepare' and is in the 'www' folder.

/**
* Location of platform's cordova.js sources, shipped with platform.
* NOTE: THIS PATH IS NOT ABSOLUTE. IT IS RELATIVE TO PLATFORM'S
* ORIGINAL PACKAGE DIRECTORY, NOT THE INSTALLED PLATFORM'S LOCATION.
*
* @type {String}
*/
cordovaJsSrc: 'cordova-js-src'
};

/**
* The installed platform's root location.
*
* @type {String}
*/
this.root = root;

/**
* Represents the platform's design-time and runtime configuration which
* stored in config.xml file.
*
* @type {ConfigParser}
*/
this.projectConfig = new ConfigParser(this.locations.configXml);
}
60 changes: 60 additions & 0 deletions proposals/CordovaPlatform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<a name="CordovaPlatform"></a>
## CordovaPlatform
**Kind**: global class

* [CordovaPlatform](#CordovaPlatform)
* [new CordovaPlatform()](#new_CordovaPlatform_new)
* [.locations](#CordovaPlatform+locations) : <code>Object</code>
* [.www](#CordovaPlatform+locations.www) : <code>String</code>
* [.configXml](#CordovaPlatform+locations.configXml) : <code>String</code>
* [.cordovaJs](#CordovaPlatform+locations.cordovaJs) : <code>String</code>
* [.cordovaJsSrc](#CordovaPlatform+locations.cordovaJsSrc) : <code>String</code>
* [.root](#CordovaPlatform+root) : <code>String</code>
* [.projectConfig](#CordovaPlatform+projectConfig) : <code>ConfigParser</code>

<a name="new_CordovaPlatform_new"></a>
### new CordovaPlatform()
Encapsulates and stores platform's information.

<a name="CordovaPlatform+locations"></a>
### cordovaPlatform.locations : <code>Object</code>
Simple object that exposes platform's filesystem locations, such as www directory.

**Kind**: instance property of <code>[CordovaPlatform](#CordovaPlatform)</code>

* [.locations](#CordovaPlatform+locations) : <code>Object</code>
* [.www](#CordovaPlatform+locations.www) : <code>String</code>
* [.configXml](#CordovaPlatform+locations.configXml) : <code>String</code>
* [.cordovaJs](#CordovaPlatform+locations.cordovaJs) : <code>String</code>
* [.cordovaJsSrc](#CordovaPlatform+locations.cordovaJsSrc) : <code>String</code>

<a name="CordovaPlatform+locations.www"></a>
#### locations.www : <code>String</code>
Platform's www directory location

**Kind**: static property of <code>[locations](#CordovaPlatform+locations)</code>
<a name="CordovaPlatform+locations.configXml"></a>
#### locations.configXml : <code>String</code>
Platform's config.xml file location

**Kind**: static property of <code>[locations](#CordovaPlatform+locations)</code>
<a name="CordovaPlatform+locations.cordovaJs"></a>
#### locations.cordovaJs : <code>String</code>
Location of cordova.js that shipped with platform. NOTE: THIS PATH IS NOT ABSOLUTE. IT IS RELATIVE TO PLATFORM'S ORIGINAL PACKAGE DIRECTORY, NOT THE INSTALLED PLATFORM'S LOCATION.

**Kind**: static property of <code>[locations](#CordovaPlatform+locations)</code>
<a name="CordovaPlatform+locations.cordovaJsSrc"></a>
#### locations.cordovaJsSrc : <code>String</code>
Location of platform's cordova.js sources, shipped with platform. NOTE: THIS PATH IS NOT ABSOLUTE. IT IS RELATIVE TO PLATFORM'S ORIGINAL PACKAGE DIRECTORY, NOT THE INSTALLED PLATFORM'S LOCATION.

**Kind**: static property of <code>[locations](#CordovaPlatform+locations)</code>
<a name="CordovaPlatform+root"></a>
### cordovaPlatform.root : <code>String</code>
The installed platform's root location.

**Kind**: instance property of <code>[CordovaPlatform](#CordovaPlatform)</code>
<a name="CordovaPlatform+projectConfig"></a>
### cordovaPlatform.projectConfig : <code>ConfigParser</code>
Represents the platform's design-time and runtime configuration which stored in config.xml file.

**Kind**: instance property of <code>[CordovaPlatform](#CordovaPlatform)</code>
Expand Down
53 changes: 53 additions & 0 deletions proposals/CordovaProject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* 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 CordovaProject(root) {
/**
* Simple object that exposes this project's filesystem locations, such as www
* directory.
*
* @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'),
/** @type {String} Installed plugins location */
plugins: path.join(root, 'plugins')
};

/**
* The project's root location.
*
* @type {String}
*/
this.root = root;

/**
* Represents the configuration, used for building project. Populated with
* values from build.json, if exists, or with some default values,
* if not.
*
* @type {BuildConfig}
*/
this.buildConfig = new BuildConfig(root);

/**
* Represents the project design-time and runtime configuration which stored in
* project's config.xml file.
*
* @type {ConfigParser}
*/
this.projectConfig = new ConfigParser(this.locations.configXml);
}
66 changes: 66 additions & 0 deletions proposals/CordovaProject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<a name="CordovaProject"></a>
## CordovaProject
**Kind**: global class

* [CordovaProject](#CordovaProject)
* [new CordovaProject()](#new_CordovaProject_new)
* [.locations](#CordovaProject+locations) : <code>Object</code>
* [.www](#CordovaProject+locations.www) : <code>String</code>
* [.configXml](#CordovaProject+locations.configXml) : <code>String</code>
* [.platforms](#CordovaProject+locations.platforms) : <code>String</code>
* [.plugins](#CordovaProject+locations.plugins) : <code>String</code>
* [.root](#CordovaProject+root) : <code>String</code>
* [.buildConfig](#CordovaProject+buildConfig) : <code>BuildConfig</code>
* [.projectConfig](#CordovaProject+projectConfig) : <code>ConfigParser</code>

<a name="new_CordovaProject_new"></a>
### new CordovaProject()
Encapsulates and stores project information.

<a name="CordovaProject+locations"></a>
### cordovaProject.locations : <code>Object</code>
Simple object that exposes this project's filesystem locations, such as www directory.

**Kind**: instance property of <code>[CordovaProject](#CordovaProject)</code>

* [.locations](#CordovaProject+locations) : <code>Object</code>
* [.www](#CordovaProject+locations.www) : <code>String</code>
* [.configXml](#CordovaProject+locations.configXml) : <code>String</code>
* [.platforms](#CordovaProject+locations.platforms) : <code>String</code>
* [.plugins](#CordovaProject+locations.plugins) : <code>String</code>

<a name="CordovaProject+locations.www"></a>
#### locations.www : <code>String</code>
Www directory location

**Kind**: static property of <code>[locations](#CordovaProject+locations)</code>
<a name="CordovaProject+locations.configXml"></a>
#### locations.configXml : <code>String</code>
config.xml file location

**Kind**: static property of <code>[locations](#CordovaProject+locations)</code>
<a name="CordovaProject+locations.platforms"></a>
#### locations.platforms : <code>String</code>
Installed platforms location

**Kind**: static property of <code>[locations](#CordovaProject+locations)</code>
<a name="CordovaProject+locations.plugins"></a>
#### locations.plugins : <code>String</code>
Installed plugins location

**Kind**: static property of <code>[locations](#CordovaProject+locations)</code>
<a name="CordovaProject+root"></a>
### cordovaProject.root : <code>String</code>
The project's root location.

**Kind**: instance property of <code>[CordovaProject](#CordovaProject)</code>
<a name="CordovaProject+buildConfig"></a>
### cordovaProject.buildConfig : <code>BuildConfig</code>
Represents the configuration, used for building project. Populated with values from build.json, if exists, or with some default values, if not.

**Kind**: instance property of <code>[CordovaProject](#CordovaProject)</code>
<a name="CordovaProject+projectConfig"></a>
### cordovaProject.projectConfig : <code>ConfigParser</code>
Represents the project design-time and runtime configuration which stored in project's config.xml file.

**Kind**: instance property of <code>[CordovaProject](#CordovaProject)</code>
Expand Down
Loading