Comparing version 0.9.10 to 0.9.11
@@ -5,3 +5,3 @@ { | ||
"description": "install/uninstall Cordova plugins", | ||
"version": "0.9.10", | ||
"version": "0.9.11", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -7,2 +7,6 @@ # plugman | ||
## Requirements | ||
You must have `git` on your PATH to be able to install plugins directly from remote git URLs. | ||
## Plugin Specification | ||
@@ -9,0 +13,0 @@ |
@@ -10,2 +10,3 @@ var fetch = require('../src/fetch'), | ||
test_plugin = path.join(__dirname, 'plugins', 'ChildBrowser'), | ||
test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'ChildBrowser'), | ||
plugins = require('../src/util/plugins'); | ||
@@ -30,2 +31,6 @@ | ||
}); | ||
it('should copy locally-available plugin to plugins directory when spaces in path', function() { | ||
fetch(test_plugin_with_space, temp); | ||
expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin_with_space, '*'), path.join(temp, 'id')); | ||
}); | ||
it('should create a symlink if used with `link` param', function() { | ||
@@ -32,0 +37,0 @@ fetch(test_plugin, temp, { link: true }); |
@@ -20,3 +20,3 @@ var install = require('../src/install'), | ||
describe('install', function() { | ||
var exists, get_json, chmod, exec, proc, add_to_queue, prepare, actions_push, c_a; | ||
var exists, get_json, chmod, exec, proc, add_to_queue, prepare, actions_push, c_a, mkdir; | ||
beforeEach(function() { | ||
@@ -26,2 +26,3 @@ proc = spyOn(actions.prototype, 'process').andCallFake(function(platform, proj, cb) { | ||
}); | ||
mkdir = spyOn(shell, 'mkdir'); | ||
actions_push = spyOn(actions.prototype, 'push'); | ||
@@ -108,3 +109,4 @@ c_a = spyOn(actions.prototype, 'createAction'); | ||
it('should fetch any dependent plugins if missing', function() { | ||
var s = spyOn(plugman, 'fetch').andCallFake(function(id, dir, opts, cb) { | ||
var deps_dir = path.join(plugins_dir, 'dependencies'), | ||
s = spyOn(plugman, 'fetch').andCallFake(function(id, dir, opts, cb) { | ||
cb(false, path.join(dir, id)); | ||
@@ -114,3 +116,4 @@ }); | ||
// Plugin A depends on C & D | ||
install('android', temp, 'A', path.join(plugins_dir, 'dependencies'), {}); | ||
install('android', temp, 'A', deps_dir, {}); | ||
expect(s).toHaveBeenCalledWith('C', deps_dir, { link: false, subdir: undefined, git_ref: undefined}, jasmine.any(Function)); | ||
expect(s.calls.length).toEqual(3); | ||
@@ -120,3 +123,3 @@ }); | ||
}); | ||
describe('failure', function() { | ||
@@ -133,3 +136,10 @@ it('should throw if platform is unrecognized', function() { | ||
}); | ||
it('should throw if git is not found on the path and a remote url is requested', function() { | ||
exists.andReturn(false); | ||
var which_spy = spyOn(shell, 'which').andReturn(null); | ||
expect(function() { | ||
install('android', temp, 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git', plugins_dir, {}); | ||
}).toThrow('"git" command line tool is not installed: make sure it is accessible on your PATH.'); | ||
}); | ||
}); | ||
}); |
@@ -36,3 +36,3 @@ var wp7 = require('../../src/platforms/wp7'), | ||
shell.cp('-rf', path.join(wp7_project, '*'), temp); | ||
var proj_files = wp7.parseWP7ProjectFile(temp); | ||
var proj_files = wp7.parseProjectFile(temp); | ||
shell.rm('-rf', temp); | ||
@@ -65,6 +65,6 @@ | ||
describe('parseWP7ProjectFile method', function() { | ||
describe('parseProjectFile method', function() { | ||
it('should throw if project is not an wp7 project', function() { | ||
expect(function() { | ||
wp7.parseWP7ProjectFile(temp); | ||
wp7.parseProjectFile(temp); | ||
}).toThrow('does not appear to be a Windows Phone project (no .csproj file)'); | ||
@@ -71,0 +71,0 @@ }); |
@@ -36,3 +36,3 @@ var wp8 = require('../../src/platforms/wp8'), | ||
shell.cp('-rf', path.join(wp8_project, '*'), temp); | ||
var proj_files = wp8.parseWP8ProjectFile(temp); | ||
var proj_files = wp8.parseProjectFile(temp); | ||
shell.rm('-rf', temp); | ||
@@ -65,6 +65,6 @@ | ||
describe('parsewp8ProjectFile method', function() { | ||
describe('parseProjectFile method', function() { | ||
it('should throw if project is not an wp8 project', function() { | ||
expect(function() { | ||
wp8.parseWP8ProjectFile(temp); | ||
wp8.parseProjectFile(temp); | ||
}).toThrow('does not appear to be a Windows Phone project (no .csproj file)'); | ||
@@ -71,0 +71,0 @@ }); |
@@ -9,4 +9,6 @@ var csproj = require('../../src/util/csproj'), | ||
var wp7_project = path.join(__dirname, '..', 'projects', 'wp7'), | ||
wp8_project = path.join(__dirname, '..', 'projects', 'wp8'), | ||
temp = path.join(os.tmpdir(), 'plugman'), | ||
example_csproj = path.join(wp7_project, 'CordovaAppProj.csproj'), | ||
example1_csproj = path.join(wp7_project, 'CordovaAppProj.csproj'), | ||
example2_csproj = path.join(wp8_project, 'CordovaAppProj.csproj'), | ||
wpcsproj = path.join(__dirname, '..', 'plugins', 'WPcsproj'); | ||
@@ -23,3 +25,3 @@ | ||
expect(function() { | ||
doc = new csproj(example_csproj); | ||
doc = new csproj(example1_csproj); | ||
}).not.toThrow(); | ||
@@ -34,3 +36,3 @@ expect(doc.xml.getroot()).toBeDefined(); | ||
describe('source file', function() { | ||
var test_csproj = new csproj(example_csproj); | ||
var page_test = path.join('src', 'UI', 'PageTest.xaml'); | ||
@@ -43,3 +45,3 @@ var page_test_cs = path.join('src', 'UI', 'PageTest.xaml.cs'); | ||
describe('add method', function() { | ||
var test_csproj = new csproj(example1_csproj); | ||
it('should properly add .xaml files', function() { | ||
@@ -69,7 +71,6 @@ test_csproj.addSourceFile(page_test); | ||
}); | ||
}); | ||
describe('remove method', function() { | ||
var test_csproj = new csproj(example2_csproj); | ||
it('should properly remove .xaml pages', function() { | ||
@@ -76,0 +77,0 @@ test_csproj.removeSourceFile(page_test); |
@@ -49,3 +49,5 @@ var shell = require('shelljs'), | ||
// First, read the plugin.xml and grab the ID. | ||
plugin_dir = path.join(uri.href, options.subdir); | ||
// NOTE: Can't use uri.href here as it will convert spaces to %20 and make path invalid. | ||
// Use original plugin_dir value instead. | ||
plugin_dir = path.join(plugin_dir, options.subdir); | ||
var plugin_xml_path = path.join(plugin_dir, 'plugin.xml'); | ||
@@ -52,0 +54,0 @@ require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' + plugin_xml_path + '"...'); |
@@ -56,3 +56,4 @@ var path = require('path'), | ||
if (err) { | ||
callback(err); | ||
if (callback) callback(err); | ||
else throw err; | ||
} else { | ||
@@ -202,2 +203,4 @@ // update ref to plugin_dir after successful fetch, via fetch callback | ||
var dep_url = path.join(result.output.trim(), dep_subdir); | ||
//Clear out the subdir since the url now contains it | ||
dep_subdir = ""; | ||
shell.cd(old_pwd); | ||
@@ -204,0 +207,0 @@ } else if (fetchdata.source.type === 'git') { |
@@ -33,3 +33,3 @@ /* | ||
}, | ||
parseWP7ProjectFile:function(project_dir) { | ||
parseProjectFile:function(project_dir) { | ||
var project_files = glob.sync('*.csproj', { | ||
@@ -36,0 +36,0 @@ cwd:project_dir |
@@ -33,3 +33,3 @@ /* | ||
}, | ||
parseWP8ProjectFile:function(project_dir) { | ||
parseProjectFile:function(project_dir) { | ||
var project_files = glob.sync('*.csproj', { | ||
@@ -36,0 +36,0 @@ cwd:project_dir |
@@ -74,3 +74,3 @@ /** | ||
if(platform == 'wp7' || platform == 'wp8') { | ||
wp_csproj = (platform == wp7? wp7.parseWP7ProjectFile(project_dir) : wp8.parseWP8ProjectFile(project_dir)); | ||
wp_csproj = (platform == wp7? wp7.parseProjectFile(project_dir) : wp8.parseProjectFile(project_dir)); | ||
var item_groups = wp_csproj.xml.findall('ItemGroup'); | ||
@@ -77,0 +77,0 @@ for (var i = 0, l = item_groups.length; i < l; i++) { |
@@ -37,7 +37,7 @@ var ios = require('../platforms/ios'), | ||
require('../../plugman').emit('log', 'Parsing WP7 project files...'); | ||
project_files = wp7.parseWP7ProjectFile(project_dir); | ||
project_files = wp7.parseProjectFile(project_dir); | ||
} | ||
if (platform == 'wp8') { | ||
require('../../plugman').emit('log', 'Parsing WP8 project files...'); | ||
project_files = wp8.parseWP8ProjectFile(project_dir); | ||
project_files = wp8.parseProjectFile(project_dir); | ||
} | ||
@@ -44,0 +44,0 @@ while(this.stack.length) { |
@@ -22,2 +22,5 @@ var xml_helpers = require('./xml-helpers'), | ||
var page = new et.Element('Page'); | ||
var sub_type = new et.Element('SubType'); | ||
sub_type.text = "Designer"; | ||
page.append(sub_type); | ||
page.attrib.Include = relative_path; | ||
@@ -27,6 +30,8 @@ var gen = new et.Element('Generator'); | ||
page.append(gen); | ||
var sub_type = new et.Element('SubType'); | ||
sub_type.text = "Designer"; | ||
page.append(sub_type); | ||
item.append(page); | ||
var item_groups = this.xml.findall('ItemGroup'); | ||
if(item_groups.length == 0) { | ||
item.append(page); | ||
} else { | ||
item_groups[0].append(page); | ||
} | ||
} | ||
@@ -33,0 +38,0 @@ // check if it's a .xaml.cs page that would depend on a .xaml of the same name |
@@ -33,3 +33,3 @@ /* | ||
if(!shell.which('git')) { | ||
var err = new Error('git command line is not installed'); | ||
var err = new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'); | ||
if (callback) return callback(err); | ||
@@ -36,0 +36,0 @@ else throw err; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3021771
244
12148
168
40
14