You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/10/17 16:26:38 UTC
[4/4] git commit: Update action-stack to avoid static platform
detection + test if parseProjectFile is present instead of switch case + test
if project_files is not null instead of [].indexOf + More dynamic,
more long term evolution
Update action-stack to avoid static platform detection
+ test if parseProjectFile is present instead of switch case
+ test if project_files is not null instead of [].indexOf
+ More dynamic, more long term evolution
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/ab857183
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/ab857183
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/ab857183
Branch: refs/heads/master
Commit: ab8571835903b0170b9f5506d9b9b19bc213f4ed
Parents: af458da
Author: SomaticIT <co...@somatic.fr>
Authored: Thu Oct 17 08:10:36 2013 +0200
Committer: SomaticIT <co...@somatic.fr>
Committed: Thu Oct 17 08:10:36 2013 +0200
----------------------------------------------------------------------
src/util/action-stack.js | 40 ++++++++++------------------------------
1 file changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ab857183/src/util/action-stack.js
----------------------------------------------------------------------
diff --git a/src/util/action-stack.js b/src/util/action-stack.js
index 122e19b..def71fc 100644
--- a/src/util/action-stack.js
+++ b/src/util/action-stack.js
@@ -1,7 +1,4 @@
-var ios = require('../platforms/ios'),
- wp7 = require('../platforms/wp7'),
- wp8 = require('../platforms/wp8'),
- windows8 = require('../platforms/windows8'),
+var platforms = require("../platforms"),
Q = require('q'),
fs = require('fs');
@@ -30,32 +27,18 @@ ActionStack.prototype = {
process:function(platform, project_dir) {
require('../../plugman').emit('verbose', 'Beginning processing of action stack for ' + platform + ' project...');
var project_files;
+
// parse platform-specific project files once
- require('../../plugman').emit('verbose', 'Parsing ' + platform + ' project files...');
- switch(platform) {
- case "ios":
- require('../../plugman').emit('verbose', 'Parsing iOS project files...');
- project_files = ios.parseIOSProjectFiles(project_dir);
- break;
- case "wp7":
- require('../../plugman').emit('verbose', 'Parsing WP7 project files...');
- project_files = wp7.parseProjectFile(project_dir);
- break;
- case "wp8":
- require('../../plugman').emit('verbose', 'Parsing WP8 project files...');
- project_files = wp8.parseProjectFile(project_dir);
- break;
- case "windows8":
- require('../../plugman').emit('verbose', 'Parsing Windows8 project files...');
- project_files = windows8.parseProjectFile(project_dir);
- break;
+ if (platforms[platform].parseProjectFile) {
+ require('../../plugman').emit('verbose', 'Parsing ' + platform + ' project files...');
+ project_files = platforms[platform].parseProjectFile(project_dir);
}
while(this.stack.length) {
var action = this.stack.shift();
var handler = action.handler.run;
var action_params = action.handler.params;
- if(['ios','wp7','wp8','windows8'].indexOf(platform) > -1) {
+ if (project_files) {
action_params.push(project_files);
}
@@ -71,7 +54,7 @@ ActionStack.prototype = {
var revert = undo.reverter.run;
var revert_params = undo.reverter.params;
- if(['ios','wp7','wp8','windows8'].indexOf(platform) > -1) {
+ if (project_files) {
revert_params.push(project_files);
}
@@ -88,15 +71,12 @@ ActionStack.prototype = {
this.completed.push(action);
}
require('../../plugman').emit('verbose', 'Action stack processing complete.');
- if (platform == 'ios') {
- // write out xcodeproj file
- require('../../plugman').emit('verbose', 'Writing out iOS pbxproj file...');
- fs.writeFileSync(project_files.pbx, project_files.xcode.writeSync());
- }
- if (platform == 'wp7' || platform == 'wp8' || platform == "windows8") {
+
+ if (project_files) {
require('../../plugman').emit('verbose', 'Writing out ' + platform + ' project files...');
project_files.write();
}
+
return Q();
}
};