You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/07/11 23:50:12 UTC

[12/43] git commit: [CB-3751] test running on windows, yay

[CB-3751] test running on windows, yay


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

Branch: refs/heads/plugman-registry
Commit: 84d14f89304df99d873b46aea1b0ed58005dd69f
Parents: c0ddac9
Author: bennmapes <be...@gmail.com>
Authored: Wed Jul 3 15:52:04 2013 -0700
Committer: bennmapes <be...@gmail.com>
Committed: Wed Jul 3 15:52:04 2013 -0700

----------------------------------------------------------------------
 spec/platforms/android.spec.js      |  6 +++---
 spec/platforms/blackberry10.spec.js | 22 +++++++++++-----------
 spec/platforms/ios.spec.js          |  8 ++++----
 spec/util/config-changes.spec.js    |  6 +++---
 spec/util/plugins.spec.js           |  2 +-
 src/fetch.js                        |  4 ++--
 6 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/84d14f89/spec/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/android.spec.js b/spec/platforms/android.spec.js
index d665512..cecb191 100644
--- a/spec/platforms/android.spec.js
+++ b/spec/platforms/android.spec.js
@@ -49,7 +49,7 @@ function copyArray(arr) {
 describe('android project handler', function() {
     describe('www_dir method', function() {
         it('should return cordova-android project www location using www_dir', function() {
-            expect(android.www_dir('/')).toEqual('/assets/www');
+            expect(android.www_dir(path.sep)).toEqual(path.sep + path.join('assets', 'www'));
         });
     });
     describe('package_name method', function() {
@@ -74,7 +74,7 @@ describe('android project handler', function() {
                 var source = copyArray(valid_source);
                 var s = spyOn(common, 'copyFile');
                 android['source-file'].install(source[0], dummyplugin, temp); 
-                expect(s).toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin.java', temp, 'src/com/phonegap/plugins/dummyplugin/DummyPlugin.java');
+                expect(s).toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin.java', temp, path.join('src', 'com', 'phonegap', 'plugins', 'dummyplugin', 'DummyPlugin.java'));
             });
             it('should throw if source file cannot be found', function() {
                 var source = copyArray(invalid_source);
@@ -112,7 +112,7 @@ describe('android project handler', function() {
                 install('android', temp, dummyplugin, plugins_dir, {}, function() {
                     var source = copyArray(valid_source);
                     android['source-file'].uninstall(source[0], temp);
-                    expect(s).toHaveBeenCalledWith(temp, 'src/com/phonegap/plugins/dummyplugin/DummyPlugin.java');
+                    expect(s).toHaveBeenCalledWith(temp, path.join('src', 'com', 'phonegap', 'plugins', 'dummyplugin', 'DummyPlugin.java'));
                     done();
                 });
             });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/84d14f89/spec/platforms/blackberry10.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/blackberry10.spec.js b/spec/platforms/blackberry10.spec.js
index 7c66ec2..bfdf926 100644
--- a/spec/platforms/blackberry10.spec.js
+++ b/spec/platforms/blackberry10.spec.js
@@ -40,7 +40,7 @@ function parsePlugin (pluginPath) {
 describe('blackberry10 project handler', function() {
     describe('www_dir method', function() {
         it('should return cordova-blackberry10 project www location using www_dir', function() {
-            expect(blackberry10.www_dir('/')).toEqual('/www');
+            expect(blackberry10.www_dir(path.sep)).toEqual(path.sep + 'www');
         });
     });
 
@@ -65,7 +65,7 @@ describe('blackberry10 project handler', function() {
                     s = spyOn(common, 'copyFile');
 
                 blackberry10['lib-file'].install(libs[0], plugin.path, temp);
-                expect(s).toHaveBeenCalledWith(plugin.path, 'src/blackberry10/native/device/echoJnext.so', temp, 'native/device/plugins/jnext/echoJnext.so');
+                expect(s).toHaveBeenCalledWith(plugin.path, 'src/blackberry10/native/device/echoJnext.so', temp, path.join('native', 'device', 'plugins', 'jnext', 'echoJnext.so'));
             });
         });
         describe('of <source-file> elements', function() {
@@ -75,15 +75,15 @@ describe('blackberry10 project handler', function() {
                     s = spyOn(common, 'copyFile');
 
                 blackberry10['source-file'].install(source[0], plugin.path, temp, plugin.id);
-                expect(s).toHaveBeenCalledWith(plugin.path, 'src/blackberry10/index.js', temp, 'native/device/chrome/plugin/cordova.echo/index.js');
-                expect(s).toHaveBeenCalledWith(plugin.path, 'src/blackberry10/index.js', temp, 'native/simulator/chrome/plugin/cordova.echo/index.js');
+                expect(s).toHaveBeenCalledWith(plugin.path, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', 'cordova.echo', 'index.js'));
+                expect(s).toHaveBeenCalledWith(plugin.path, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', 'cordova.echo', 'index.js'));
             });
             it('defaults to plugin id when dest is not present', function() {
                 var source = copyArray(plugins.dummy.srcFiles);
                 var s = spyOn(common, 'copyFile');
                 blackberry10['source-file'].install(source[0], plugins.dummy.path, temp, plugins.dummy.id);
-                expect(s).toHaveBeenCalledWith(plugins.dummy.path, 'src/blackberry10/index.js', temp, 'native/device/chrome/plugin/' + plugins.dummy.id + '/index.js');
-                expect(s).toHaveBeenCalledWith(plugins.dummy.path, 'src/blackberry10/index.js', temp, 'native/simulator/chrome/plugin/' + plugins.dummy.id + '/index.js');
+                expect(s).toHaveBeenCalledWith(plugins.dummy.path, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', plugins.dummy.id, 'index.js'));
+                expect(s).toHaveBeenCalledWith(plugins.dummy.path, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', plugins.dummy.id, 'index.js'));
             });
             it('should throw if source file cannot be found', function() {
                 var source = copyArray(plugins.faulty.srcFiles);
@@ -121,8 +121,8 @@ describe('blackberry10 project handler', function() {
                 var source = copyArray(plugin.srcFiles);
                 blackberry10['source-file'].install(source[0], plugin.path, temp, plugin.id);
                 blackberry10['source-file'].uninstall(source[0], temp, plugin.id);
-                expect(s).toHaveBeenCalledWith(temp, 'native/device/chrome/plugin/cordova.echo/index.js');
-                expect(s).toHaveBeenCalledWith(temp, 'native/simulator/chrome/plugin/cordova.echo/index.js');
+                expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'chrome', 'plugin', 'cordova.echo', 'index.js'));
+                expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', 'cordova.echo', 'index.js'));
             });
             it('should remove stuff by calling common.removeFile', function() {
                 var s = spyOn(common, 'removeFile'),
@@ -130,8 +130,8 @@ describe('blackberry10 project handler', function() {
                 var source = copyArray(plugin.srcFiles);
                 blackberry10['source-file'].install(source[0], plugin.path, temp, plugin.id);
                 blackberry10['source-file'].uninstall(source[0], temp, plugin.id);
-                expect(s).toHaveBeenCalledWith(temp, 'native/device/chrome/plugin/' + plugin.id + '/index.js');
-                expect(s).toHaveBeenCalledWith(temp, 'native/simulator/chrome/plugin/' + plugin.id + '/index.js');
+                expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'chrome', 'plugin', plugin.id, 'index.js'));
+                expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', plugin.id, 'index.js'));
             });
         });
         describe('of <lib-file> elements', function(done) {
@@ -141,7 +141,7 @@ describe('blackberry10 project handler', function() {
                 var source = copyArray(plugin.libFiles);
                 blackberry10['lib-file'].install(source[0], plugin.path, temp, plugin.id);
                 blackberry10['lib-file'].uninstall(source[0], temp, plugin.id);
-                expect(s).toHaveBeenCalledWith(temp, 'native/device/plugins/jnext/echoJnext.so');
+                expect(s).toHaveBeenCalledWith(temp, path.join('native','device','plugins','jnext','echoJnext.so'));
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/84d14f89/spec/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/ios.spec.js b/spec/platforms/ios.spec.js
index 79a45a2..3c34b8f 100644
--- a/spec/platforms/ios.spec.js
+++ b/spec/platforms/ios.spec.js
@@ -82,7 +82,7 @@ describe('ios project handler', function() {
 
     describe('www_dir method', function() {
         it('should return cordova-ios project www location using www_dir', function() {
-            expect(ios.www_dir('/')).toEqual('/www');
+            expect(ios.www_dir(path.sep)).toEqual(path.sep + 'www');
         });
     });
 
@@ -249,13 +249,13 @@ describe('ios project handler', function() {
                 var frameworks = copyArray(valid_frameworks).filter(function(f) { return f.attrib.weak == undefined; });
                 var spy = spyOn(proj_files.xcode, 'addFramework');
                 ios.framework.install(frameworks[0], dummyplugin, temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('src', 'ios', 'libsqlite3.dylib'), {weak:false});
+                expect(spy).toHaveBeenCalledWith(path.join('src', 'ios', 'libsqlite3.dylib').replace(/\\/g, '/'), {weak:false});
             });
             it('should pass in whether the framework is weak or not to xcodeproj.addFramework', function() {
                 var frameworks = copyArray(valid_frameworks).filter(function(f) { return f.attrib.weak != undefined; });;
                 var spy = spyOn(proj_files.xcode, 'addFramework');
                 ios.framework.install(frameworks[0], dummyplugin, temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('src', 'ios', 'libsqlite3.dylib'), {weak:true});
+                expect(spy).toHaveBeenCalledWith(path.join('src', 'ios', 'libsqlite3.dylib').replace(/\\/g, '/'), {weak:true});
             });
         });
     });
@@ -359,7 +359,7 @@ describe('ios project handler', function() {
                 var spy = spyOn(proj_files.xcode, 'removeFramework');
                 
                 ios.framework.uninstall(frameworks[0], temp, proj_files);
-                expect(spy).toHaveBeenCalledWith(path.join('src', 'ios', 'libsqlite3.dylib'));
+                expect(spy).toHaveBeenCalledWith(path.join('src', 'ios', 'libsqlite3.dylib').replace(/\\/g, '/'));
             });
         });
     });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/84d14f89/spec/util/config-changes.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/config-changes.spec.js b/spec/util/config-changes.spec.js
index de60063..59f674c 100644
--- a/spec/util/config-changes.spec.js
+++ b/spec/util/config-changes.spec.js
@@ -290,7 +290,7 @@ describe('config-changes module', function() {
                 var spy = spyOn(fs, 'readFileSync').andCallThrough();
 
                 configChanges.process(plugins_dir, temp, 'ios');
-                expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'), 'utf8');
+                expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'SampleApp-Info.plist').replace(/\\/g, '/'), 'utf8');
             });
             it('should move successfully installed plugins from queue to installed plugins section, and include/retain vars if applicable', function() {
                 shell.cp('-rf', android_two_project, temp);
@@ -323,7 +323,7 @@ describe('config-changes module', function() {
 
                     var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
                     configChanges.process(plugins_dir, temp, 'ios');
-                    expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist'));
+                    expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist').replace(/\\/g, '/'));
                 });
             });
         });
@@ -417,7 +417,7 @@ describe('config-changes module', function() {
 
                 var spy = spyOn(plist, 'parseFileSync').andReturn({Plugins:{}});
                 configChanges.process(plugins_dir, temp, 'ios');
-                expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist'));
+                expect(spy).toHaveBeenCalledWith(path.join(temp, 'SampleApp', 'PhoneGap.plist').replace(/\\/g, '/'));
             });
             it('should save changes to global config munge after completing an uninstall', function() {
                 shell.cp('-rf', android_two_project, temp);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/84d14f89/spec/util/plugins.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/plugins.spec.js b/spec/util/plugins.spec.js
index 6653819..7f569eb 100644
--- a/spec/util/plugins.spec.js
+++ b/spec/util/plugins.spec.js
@@ -56,7 +56,7 @@ describe('plugins utility module', function(){
 
             expect(callback).toHaveBeenCalled();
             expect(callback.mostRecentCall.args[0]).toBe(null);
-            expect(callback.mostRecentCall.args[1]).toMatch(new RegExp('/' + fake_id + '$'));
+            expect(callback.mostRecentCall.args[1]).toMatch(new RegExp(path.sep + fake_id + '$'));
         });
         it('should take into account subdirectory argument when copying over final repository into plugins+plugin_id directory', function() {
             var plugin_git_url = 'https://github.com/imhotep/ChildBrowser'

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/84d14f89/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 8f2064a..28d9994 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -17,7 +17,7 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
 
     // clone from git repository
     var uri = url.parse(plugin_dir);
-    if (uri.protocol && uri.protocol != 'file:') {
+    if ( uri.protocol && uri.protocol != 'file:' && !plugin_dir.match(/^\w+:\\/)) {
         if (options.link) {
             var err = new Error('--link is not supported for git URLs');
             if (callback) return callback(err);
@@ -46,7 +46,7 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
 
         // Copy from the local filesystem.
         // First, read the plugin.xml and grab the ID.
-        plugin_dir = path.join(uri.path, options.subdir);
+        plugin_dir = path.join(uri.href, options.subdir);
         var plugin_xml_path = path.join(plugin_dir, 'plugin.xml');
         require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' + plugin_xml_path + '"...');
         var xml = xml_helpers.parseElementtreeSync(plugin_xml_path);