cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject git commit: Remove src/<platform> directory structure.
Date Wed, 27 Mar 2013 15:34:03 GMT
Updated Branches:
  refs/heads/future 925604376 -> d3c01ad73


Remove src/<platform> directory structure.


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

Branch: refs/heads/future
Commit: d3c01ad73327e3e9a6c6ccefd3c97b62474ebb16
Parents: 9256043
Author: Braden Shepherdson <braden.shepherdson@gmail.com>
Authored: Wed Mar 27 11:30:56 2013 -0400
Committer: Braden Shepherdson <braden.shepherdson@gmail.com>
Committed: Wed Mar 27 11:30:56 2013 -0400

----------------------------------------------------------------------
 platforms/android.js |   17 +++++------------
 platforms/bb10.js    |   14 ++++----------
 platforms/ios.js     |   26 +++++++++++++-------------
 3 files changed, 22 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d3c01ad7/platforms/android.js
----------------------------------------------------------------------
diff --git a/platforms/android.js b/platforms/android.js
index b0f8da7..e13d4cb 100644
--- a/platforms/android.js
+++ b/platforms/android.js
@@ -24,7 +24,6 @@ var fs = require('fs')  // use existsSync in 0.6.x
    , et = require('elementtree')
    , getConfigChanges = require('../util/config-changes')
 
-   , sourceDir = 'src'
    , xml_helpers = require(path.join(__dirname, '..', 'util', 'xml-helpers'));
 
 
@@ -94,10 +93,10 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
             fs.unlinkSync(destFile);
             // check if directory is empty
             var curDir = srcDir;
-            while(curDir !== project_dir + '/src') {
+            while(curDir !== path.join(project_dir, 'src')) {
                 if(fs.readdirSync(curDir).length == 0) {
                     fs.rmdirSync(curDir);
-                    curDir = path.resolve(curDir + '/..');
+                    curDir = path.resolve(path.join(curDir, '..'));
                 } else {
                     // directory not empty...do nothing
                     break;
@@ -113,11 +112,11 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
 
         if (action == 'install') {
             shell.mkdir('-p', libDir);
-            var src = path.resolve(plugin_dir, 'src/android',
+            var src = path.resolve(plugin_dir,
                                         libFile.attrib['src']),
                 dest = path.resolve(libDir,
                                 path.basename(libFile.attrib['src']));
-            
+
             shell.cp(src, dest);
         } else {
             var destFile = path.resolve(libDir,
@@ -161,13 +160,7 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
 
 
 function srcPath(pluginPath, filename) {
-    var prefix = /^src\/android/;
-
-    if (prefix.test(filename)) {
-        return path.resolve(pluginPath, filename);
-    } else {
-        return path.resolve(pluginPath, 'src/android', filename);
-    }
+    return path.resolve(pluginPath, filename);
 }
 
 // reads the package name out of the Android Manifest file

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d3c01ad7/platforms/bb10.js
----------------------------------------------------------------------
diff --git a/platforms/bb10.js b/platforms/bb10.js
index 1142fec..9ea8640 100644
--- a/platforms/bb10.js
+++ b/platforms/bb10.js
@@ -71,10 +71,10 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
             fs.unlinkSync(destFile);
             // check if directory is empty
             var curDir = srcDir;
-            while(curDir !== project_dir + '/src') {
+            while(curDir !== path.join(project_dir, 'src')) {
                 if(fs.readdirSync(curDir).length == 0) {
                     fs.rmdirSync(curDir);
-                    curDir = path.resolve(curDir + '/..');
+                    curDir = path.resolve(curDir, '..');
                 } else {
                     // directory not empty...do nothing
                     break;
@@ -90,7 +90,7 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
 
         if (action == 'install') {
             shell.mkdir('-p', libDir);
-            var src = path.resolve(plugin_dir, 'src/BlackBerry10',
+            var src = path.resolve(plugin_dir,
                                         libFile.attrib['src']),
                 dest = path.resolve(libDir,
                                 path.basename(libFile.attrib['src']));
@@ -138,13 +138,7 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
 
 
 function srcPath(pluginPath, filename) {
-    var prefix = /^src\/BlackBerry10/;
-
-    if (prefix.test(filename)) {
-        return path.resolve(pluginPath, filename);
-    } else {
-        return path.resolve(pluginPath, 'src/BlackBerry10', filename);
-    }
+    return path.resolve(pluginPath, filename);
 }
 
 function pluginInstalled(plugin_et, project_dir) {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d3c01ad7/platforms/ios.js
----------------------------------------------------------------------
diff --git a/platforms/ios.js b/platforms/ios.js
index cc9ac75..fa4af35 100644
--- a/platforms/ios.js
+++ b/platforms/ios.js
@@ -49,7 +49,7 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
 
     // grab and parse pbxproj
     // we don't want CordovaLib's xcode project
-    var project_files = glob.sync(project_dir + '/*.xcodeproj/project.pbxproj');
+    var project_files = glob.sync(path.join(project_dir, '*.xcodeproj', 'project.pbxproj'));
     
     if (!project_files.length) throw "does not appear to be an xcode project";
     var pbxPath = project_files[0];
@@ -58,9 +58,9 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
     xcodeproj.parseSync();
 
     // grab and parse plist file or config.xml
-    var config_files = (glob.sync(project_dir + '/**/{PhoneGap,Cordova}.plist').length ==
0 ? 
-                        glob.sync(project_dir + '/**/config.xml') :
-                        glob.sync(project_dir + '/**/{PhoneGap,Cordova}.plist')
+    var config_files = (glob.sync(path.join(project_dir, '**', '{PhoneGap,Cordova}.plist')).length
== 0 ? 
+                        glob.sync(path.join(project_dir, '**', 'config.xml')) :
+                        glob.sync(path.join(project_dir, '**', '{PhoneGap,Cordova}.plist'))
                        );
 
     if (!config_files.length) {
@@ -84,16 +84,16 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
     // move native files (source/header/resource)
     sourceFiles && sourceFiles.forEach(function (sourceFile) {
         var src = sourceFile.attrib['src'],
-            srcFile = path.resolve(plugin_dir, 'src/ios', src),
+            srcFile = path.resolve(plugin_dir, src),
             targetDir = path.resolve(pluginsDir, getRelativeDir(sourceFile)),
             destFile = path.resolve(targetDir, path.basename(src));
          
         if (action == 'install') {
-            xcodeproj.addSourceFile('Plugins/' + path.relative(pluginsDir, destFile));
+            xcodeproj.addSourceFile(path.join('Plugins', path.relative(pluginsDir, destFile)));
             shell.mkdir('-p', targetDir);
             shell.cp(srcFile, destFile);
         } else {
-            xcodeproj.removeSourceFile('Plugins/' + path.basename(src));   
+            xcodeproj.removeSourceFile(path.join('Plugins', path.basename(src)));
             if(fs.existsSync(destFile))
                 fs.unlinkSync(destFile);
             shell.rm('-rf', targetDir);    
@@ -102,16 +102,16 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
 
     headerFiles && headerFiles.forEach(function (headerFile) {
         var src = headerFile.attrib['src'],
-            srcFile = path.resolve(plugin_dir, 'src/ios', src),
+            srcFile = path.resolve(plugin_dir, src),
             targetDir = path.resolve(pluginsDir, getRelativeDir(headerFile)),
             destFile = path.resolve(targetDir, path.basename(src));
          
         if (action == 'install') {     
-            xcodeproj.addHeaderFile('Plugins/' + path.relative(pluginsDir, destFile));
+            xcodeproj.addHeaderFile(path.join('Plugins', path.relative(pluginsDir, destFile)));
             shell.mkdir('-p', targetDir);
             shell.cp(srcFile, destFile);
         } else {
-            xcodeproj.removeHeaderFile('Plugins/' + path.basename(src));
+            xcodeproj.removeHeaderFile(path.join('Plugins', path.basename(src)));
             if(fs.existsSync(destFile))
                 fs.unlinkSync(destFile);
             shell.rm('-rf', targetDir);
@@ -120,11 +120,11 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
 
     resourceFiles && resourceFiles.forEach(function (resource) {
         var src = resource.attrib['src'],
-            srcFile = path.resolve(plugin_dir, 'src/ios', src),
+            srcFile = path.resolve(plugin_dir, src),
             destFile = path.resolve(resourcesDir, path.basename(src));
 
         if (action == 'install') {
-            xcodeproj.addResourceFile('Resources/' + path.basename(src));
+            xcodeproj.addResourceFile(path.join('Resources', path.basename(src)));
             var st = fs.statSync(srcFile);
             if (st.isDirectory()) {
                 shell.cp('-R', srcFile, resourcesDir);
@@ -132,7 +132,7 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et)
{
                 shell.cp(srcFile, destFile);
             }
         } else {
-            xcodeproj.removeResourceFile('Resources/' + path.basename(src));
+            xcodeproj.removeResourceFile(path.join('Resources', path.basename(src)));
             shell.rm('-rf', destFile);
         }
     });


Mime
View raw message