Updated Branches:
  refs/heads/cordova-client 7a6a5bdb1 -> 1b309ae3d

swapped out wrench for shelljs


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/commit/1b309ae3
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/1b309ae3
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/1b309ae3

Branch: refs/heads/cordova-client
Commit: 1b309ae3d4fb2a58b6fa9987736decbc2736b159
Parents: 7a6a5bd
Author: Fil Maj <maj....@gmail.com>
Authored: Tue Sep 25 14:55:59 2012 -0700
Committer: Fil Maj <maj....@gmail.com>
Committed: Tue Sep 25 14:55:59 2012 -0700

----------------------------------------------------------------------
 package.json               |    3 +--
 spec/build.spec.js         |    8 +++-----
 spec/config_parser.spec.js |    8 +++-----
 spec/create.spec.js        |   10 ++++------
 spec/helper.js             |    6 ++----
 spec/platform.spec.js      |    8 +++-----
 spec/plugin.spec.js        |   10 +++-------
 src/build.js               |   10 ++++------
 src/create.js              |   15 ++++++---------
 src/platform.js            |    5 ++---
 src/plugin.js              |   12 +++++-------
 11 files changed, 36 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 149a354..3c753c3 100644
--- a/package.json
+++ b/package.json
@@ -21,12 +21,11 @@
   ],
   "dependencies": {
     "colors":">=0.6.0",
-    "wrench":"1.3.9",
     "elementtree":"0.1.3",
     "pluginstall":"git://github.com/imhotep/pluginstall.git",
     "node-xcode":"git://github.com/imhotep/node-xcode.git",
     "express":"3.0",
-    "shelljs":"0.0.4",
+    "shelljs":"0.0.7",
     "ncallbacks":"1.0.0"
   },
   "devDependencies": {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/spec/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/build.spec.js b/spec/build.spec.js
index 067c267..e7e9ab0 100644
--- a/spec/build.spec.js
+++ b/spec/build.spec.js
@@ -1,9 +1,7 @@
 var cordova = require('../cordova'),
-    wrench = require('wrench'),
     et = require('elementtree'),
-    mkdirp = wrench.mkdirSyncRecursive,
+    shell = require('shelljs'),
     path = require('path'),
-    rmrf = wrench.rmdirSyncRecursive,
     fs = require('fs'),
     config_parser = require('../src/config_parser'),
     tempDir = path.join(__dirname, '..', 'temp');
@@ -13,8 +11,8 @@ var cwd = process.cwd();
 describe('build command', function() {
     beforeEach(function() {
         // Make a temp directory
-        try { rmrf(tempDir); } catch(e) {}
-        mkdirp(tempDir);
+        try { shell.rm('-rf', tempDir); } catch(e) {}
+        shell.mkdir('-p', tempDir);
     });
 
     it('should not run inside a Cordova-based project with no added 
platforms', function() {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/spec/config_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/config_parser.spec.js b/spec/config_parser.spec.js
index 59a5f2b..581cb9d 100644
--- a/spec/config_parser.spec.js
+++ b/spec/config_parser.spec.js
@@ -1,9 +1,7 @@
 var cordova = require('../cordova'),
-    wrench = require('wrench'),
-    mkdirp = wrench.mkdirSyncRecursive,
     path = require('path'),
-    rmrf = wrench.rmdirSyncRecursive,
     fs = require('fs'),
+    shell = require('shelljs'),
     config_parser = require('../src/config_parser'),
     tempDir = path.join(__dirname, '..', 'temp'),
     et = require('elementtree'),
@@ -12,8 +10,8 @@ var cordova = require('../cordova'),
 describe('config.xml parser', function () {
     beforeEach(function() {
         // Make a temp directory
-        try { rmrf(tempDir); } catch(e) {}
-        mkdirp(tempDir);
+        try { shell.rm('-rf', tempDir); } catch(e) {}
+        shell.mkdir('-p', tempDir);
         cordova.create(tempDir);
     });
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/create.spec.js b/spec/create.spec.js
index aadd14b..d384847 100644
--- a/spec/create.spec.js
+++ b/spec/create.spec.js
@@ -1,16 +1,14 @@
 var cordova = require('../cordova'),
-    wrench  = require('wrench'),
-    mkdirp  = wrench.mkdirSyncRecursive,
     path    = require('path'),
-    rmrf    = wrench.rmdirSyncRecursive,
+    shell   = require('shelljs'),
     fs      = require('fs'),
     tempDir = path.join(__dirname, '..', 'temp');
 
 describe('create command', function () {
     beforeEach(function() {
         // Make a temp directory
-        try { rmrf(tempDir); } catch(e) {}
-        mkdirp(tempDir);
+        try { shell.rm('-rf', tempDir); } catch(e) {}
+        shell.mkdir('-p', tempDir);
     });
 
     it('should print out help txt if no directory is provided', function() {
@@ -28,7 +26,7 @@ describe('create command', function () {
         expect(JSON.parse(fs.readFileSync(dotc, 'utf8')).name).toBe("Hello 
Cordova");
     });
     it('should throw if the directory is already a cordova project', 
function() {
-        mkdirp(path.join(tempDir, '.cordova'));
+        shell.mkdir('-p', path.join(tempDir, '.cordova'));
         
         expect(function() {
             cordova.create(tempDir);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/spec/helper.js
----------------------------------------------------------------------
diff --git a/spec/helper.js b/spec/helper.js
index 98b2228..79d7de8 100644
--- a/spec/helper.js
+++ b/spec/helper.js
@@ -3,9 +3,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
 var shell = require('shelljs'),
     path = require('path'),
     fs = require('fs'),
-    android_project = path.join(__dirname, 'fixtures', 'projects', 'native', 
'android'),
-    wrench = require('wrench'),
-    cpr = wrench.copyDirSyncRecursive;
+    android_project = path.join(__dirname, 'fixtures', 'projects', 'native', 
'android');
 
 var orig_exec = shell.exec;
 
@@ -14,7 +12,7 @@ shell.exec = function(cmd, opts) {
     if (cmd.match(/android.bin.create/)) {
         var r = new RegExp(/android.bin.create"\s"([\/\\\w-_\.]*)"/);
         var dir = r.exec(cmd)[1];
-        cpr(android_project, dir);
+        shell.cp('-r', android_project, path.join(dir, '..'));
         fs.chmodSync(path.join(dir, 'cordova', 'debug'), '754');
         return {code:0};
     }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/spec/platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/platform.spec.js b/spec/platform.spec.js
index f7b1649..13c3f1b 100644
--- a/spec/platform.spec.js
+++ b/spec/platform.spec.js
@@ -1,8 +1,6 @@
 var cordova = require('../cordova'),
-    wrench = require('wrench'),
-    mkdirp = wrench.mkdirSyncRecursive,
     path = require('path'),
-    rmrf = wrench.rmdirSyncRecursive,
+    shell = require('shelljs'),
     fs = require('fs'),
     et = require('elementtree'),
     config_parser = require('../src/config_parser'),
@@ -13,8 +11,8 @@ var cwd = process.cwd();
 describe('platform command', function() {
     beforeEach(function() {
         // Make a temp directory
-        try { rmrf(tempDir); } catch(e) {}
-        mkdirp(tempDir);
+        try { shell.rm('-rf', tempDir); } catch(e) {}
+        shell.mkdir('-p', tempDir);
     });
     it('should run inside a Cordova-based project', function() {
         this.after(function() {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/spec/plugin.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugin.spec.js b/spec/plugin.spec.js
index 2ba78a5..f9fe18e 100644
--- a/spec/plugin.spec.js
+++ b/spec/plugin.spec.js
@@ -1,8 +1,6 @@
 var cordova = require('../cordova'),
-    wrench = require('wrench'),
-    mkdirp = wrench.mkdirSyncRecursive,
     path = require('path'),
-    rmrf = wrench.rmdirSyncRecursive,
+    shell = require('shelljs'),
     fs = require('fs'),
     tempDir = path.join(__dirname, '..', 'temp'),
     fixturesDir = path.join(__dirname, 'fixtures'),
@@ -14,8 +12,8 @@ var cwd = process.cwd();
 describe('plugin command', function() {
     beforeEach(function() {
         // Make a temp directory
-        try { rmrf(tempDir); } catch(e) {}
-        mkdirp(tempDir);
+        try { shell.rm('-rf', tempDir); } catch(e) {}
+        shell.mkdir('-p', tempDir);
     });
 
     it('should run inside a Cordova-based project', function() {
@@ -103,8 +101,6 @@ describe('plugin command', function() {
                     }).toThrow('Plugin "test" already added to project.');
                 });
             });
-            it('should throw if plugin www assets collide with existing 
project www assets', function() {
-            });
             it('should throw if plugin does not have a plugin.xml', function() 
{
                 var cb = jasmine.createSpy();
                 runs(function() {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/src/build.js
----------------------------------------------------------------------
diff --git a/src/build.js b/src/build.js
index 31a28ab..f813f68 100644
--- a/src/build.js
+++ b/src/build.js
@@ -3,8 +3,6 @@ var cordova_util  = require('./util'),
     config_parser = require('./config_parser'),
     fs            = require('fs'),
     shell         = require('shelljs'),
-    wrench        = require('wrench'),
-    cpr           = wrench.copyDirSyncRecursive,
     et            = require('elementtree'),
     android_parser= require('./metadata/android_parser'),
     ios_parser    = require('./metadata/ios_parser'),
@@ -13,10 +11,10 @@ var cordova_util  = require('./util'),
 
 function shell_out_to_debug(projectRoot, platform,  www_target, js) {
     // Clean out the existing www.
-    shell.rm('-rf', www_target);
+    shell.rm('-rf', path.join(www_target, 'www'));
 
     // Copy app assets into native package
-    cpr(path.join(projectRoot, 'www'), www_target);
+    shell.cp('-r', path.join(projectRoot, 'www'), www_target);
 
     // Copy in the appropriate JS
     var jsPath = path.join(www_target, 'cordova.js');
@@ -52,7 +50,7 @@ module.exports = function build (callback) {
         var assetsPath, js, parser;
         switch (platform) {
             case 'android':
-                assetsPath = path.join(projectRoot, 'platforms', 'android', 
'assets', 'www');
+                assetsPath = path.join(projectRoot, 'platforms', 'android', 
'assets');
                 js = path.join(__dirname, '..', 'lib', 'android', 'framework', 
'assets', 'js', 'cordova.android.js');
                 parser = new android_parser(path.join(projectRoot, 
'platforms', 'android'));
                 // Update the related platform project from the config
@@ -61,7 +59,7 @@ module.exports = function build (callback) {
                 end();
                 break;
             case 'ios':
-                assetsPath = path.join(projectRoot, 'platforms', 'ios', 'www');
+                assetsPath = path.join(projectRoot, 'platforms', 'ios');
                 js = path.join(__dirname, '..', 'lib', 'ios', 'CordovaLib', 
'javascript', 'cordova.ios.js');
                 parser = new ios_parser(path.join(projectRoot, 'platforms', 
'ios'));
                 // Update the related platform project from the config

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/src/create.js
----------------------------------------------------------------------
diff --git a/src/create.js b/src/create.js
index 36d69dd..0b33ecf 100644
--- a/src/create.js
+++ b/src/create.js
@@ -1,10 +1,8 @@
-var wrench        = require('wrench'),
-    path          = require('path'),
+var path          = require('path'),
     fs            = require('fs'),
+    shell         = require('shelljs'),
     help          = require('./help'),
-    config_parser = require('./config_parser'),
-    mkdirp        = wrench.mkdirSyncRecursive,
-    cpr           = wrench.copyDirSyncRecursive;
+    config_parser = require('./config_parser');
 
 var DEFAULT_NAME = "Hello Cordova",
     DEFAULT_ID   = "io.cordova.hello-cordova";
@@ -40,9 +38,8 @@ module.exports = function create (dir, id, name) {
     }
 
     // Create basic project structure.
-    mkdirp(path.join(dir, 'platforms'));
-    mkdirp(path.join(dir, 'plugins'));
-    mkdirp(path.join(dir, 'www'));
+    shell.mkdir('-p', path.join(dir, 'platforms'));
+    shell.mkdir('-p', path.join(dir, 'plugins'));
 
     // Write out .cordova file with a simple json manifest
     fs.writeFileSync(dotCordova, JSON.stringify({
@@ -51,7 +48,7 @@ module.exports = function create (dir, id, name) {
     }));
 
     // Copy in base template
-    cpr(path.join(__dirname, '..', 'templates', 'www'), path.join(dir, 'www'));
+    shell.cp('-r', path.join(__dirname, '..', 'templates', 'www'), dir);
 
     // Write out id and name to config.xml
     var configPath = path.join(dir, 'www', 'config.xml');

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 7ed3360..e8586e5 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -2,9 +2,8 @@ var config_parser = require('./config_parser'),
     cordova_util  = require('./util'),
     util          = require('util'),
     fs            = require('fs'),
-    wrench        = require('wrench'),
-    rmrf          = wrench.rmdirSyncRecursive,
     path          = require('path'),
+    shell         = require('shelljs'),
     android_parser= require('./metadata/android_parser'),
     ios_parser    = require('./metadata/ios_parser'),
     shell         = require('shelljs');
@@ -71,7 +70,7 @@ module.exports = function platform(command, target, callback) 
{
 
             // Remove the Cordova project for the platform.
             try {
-                rmrf(path.join(projectRoot, 'platforms', target));
+                shell.rm('-rf', path.join(projectRoot, 'platforms', target));
             } catch(e) {}
             break;
         default:

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/1b309ae3/src/plugin.js
----------------------------------------------------------------------
diff --git a/src/plugin.js b/src/plugin.js
index e5423d1..2352c68 100644
--- a/src/plugin.js
+++ b/src/plugin.js
@@ -1,9 +1,7 @@
 var cordova_util  = require('./util'),
     util          = require('util'),
-    wrench        = require('wrench'),
-    cpr           = wrench.copyDirSyncRecursive,
-    rmrf          = wrench.rmdirSyncRecursive,
     fs            = require('fs'),
+    shell         = require('shelljs'),
     path          = require('path'),
     shell         = require('shelljs'),
     config_parser = require('./config_parser'),
@@ -90,14 +88,14 @@ module.exports = function plugin(command, target, callback) 
{
                 var name = asset.substr(asset.lastIndexOf('/')+1);
                 var wwwPath = path.join(projectWww, name);
                 if (info.isDirectory()) {
-                    cpr(asset, wwwPath);
+                    shell.cp('-r', asset, projectWww);
                 } else {
                     fs.writeFileSync(wwwPath, fs.readFileSync(asset));
                 }
             });
 
             // Finally copy the plugin into the project
-            cpr(target, path.join(pluginPath, targetName));
+            shell.cp('-r', target, pluginPath);
 
             if (callback) callback();
             break;
@@ -134,14 +132,14 @@ module.exports = function plugin(command, target, 
callback) {
                     asset = path.resolve(path.join(projectWww, asset));
                     var info = fs.lstatSync(asset);
                     if (info.isDirectory()) {
-                        rmrf(asset);
+                        shell.rm('-rf', asset);
                     } else {
                         fs.unlinkSync(asset);
                     }
                 });
 
                 // Finally remove the plugin dir from plugins/
-                rmrf(path.join(pluginPath, target));
+                shell.rm('-rf', path.join(pluginPath, target));
 
                 if (callback) callback();
             } else {

Reply via email to