Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.setUp = function(callback) {
shell.mkdir('-p', test_dir);
// copy the blackberry test project to a temp directory
shell.cp('-r', path.join(__dirname, 'projects'), test_dir);
// copy the blackberry test plugin to a temp directory
shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);
// parse the plugin.xml into an elementtree object
xml_text = fs.readFileSync(xml_path, 'utf-8')
plugin_et = new et.ElementTree(et.XML(xml_text));
callback();
}
exports.setUp = function(callback) {
shell.mkdir('-p', test_dir);
// copy the ios test project to a temp directory
shell.cp('-r', path.join(__dirname, 'projects'), test_dir);
// copy the ios test plugin to a temp directory
shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);
// parse the plugin.xml into an elementtree object
xml_text = fs.readFileSync(xml_path, 'utf-8')
plugin_et = new et.ElementTree(et.XML(xml_text));
callback();
}
exports.setUp = function(callback) {
shell.mkdir('-p', test_dir);
// copy the ios test project to a temp directory
shell.cp('-r', path.join(__dirname, 'projects'), test_dir);
// copy the ios test plugin to a temp directory
shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);
// parse the plugin.xml into an elementtree object
xml_text = fs.readFileSync(xml_path, 'utf-8')
plugin_et = new et.ElementTree(et.XML(xml_text));
callback();
}
exports.setUp = function(callback) {
shell.mkdir('-p', test_dir);
// copy the ios test project to a temp directory
shell.cp('-r', path.join(__dirname, 'projects'), test_dir);
// copy the ios test plugin to a temp directory
shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);
// parse the plugin.xml into an elementtree object
xml_text = fs.readFileSync(xml_path, 'utf-8')
plugin_et = new et.ElementTree(et.XML(xml_text));
callback();
}
exports.setUp = function(callback) {
shell.mkdir('-p', test_dir);
// copy the ios test project to a temp directory
shell.cp('-r', path.join(__dirname, 'projects'), test_dir);
// copy the ios test plugin to a temp directory
shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);
// parse the plugin.xml into an elementtree object
xml_text = fs.readFileSync(xml_path, 'utf-8')
plugin_et = new et.ElementTree(et.XML(xml_text));
callback();
}
// Create a plugin.xml file
root = et.Element( 'plugin' );
root.set( 'xmlns', 'http://apache.org/cordova/ns/plugins/1.0' );
root.set( 'xmlns:android', 'http://schemas.android.com/apk/res/android' );
root.set( 'id', id );
root.set( 'version', version );
// Add the name tag
pluginName = et.XML( '' );
pluginName.text = name;
root.append( pluginName );
// Loop through the options( variables ) for other tags
for( var key in options ) {
var temp = et.XML( '<' + key + '>');
temp.text = options[ key ];
root.append( temp );
}
// Setup the directory structure
shell.mkdir( '-p', cwd + 'www' );
shell.mkdir( '-p', cwd + 'src' );
// Create a base plugin.js file
baseJS = stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.js', 'utf-8').replace(/%pluginName%/g, name));
fs.writeFileSync( cwd + 'www/' + name + '.js', baseJS, 'utf-8' );
// Add it to the xml as a js module
jsMod = et.Element( 'js-module' );
jsMod.set( 'src', 'www/' + name + '.js' );
jsMod.set( 'name', name );
// Create a plugin.xml file
root = et.Element('plugin');
root.set('xmlns', 'http://apache.org/cordova/ns/plugins/1.0');
root.set('xmlns:android', 'http://schemas.android.com/apk/res/android');
root.set('id', id);
root.set('version', version);
// Add the name tag
pluginName = et.XML('');
pluginName.text = name;
root.append(pluginName);
// Loop through the options( variables ) for other tags
for (var key in options) {
var temp = et.XML('<' + key + '>');
temp.text = options[key];
root.append(temp);
}
// Setup the directory structure
fs.ensureDirSync(cwd + 'www');
fs.ensureDirSync(cwd + 'src');
// Create a base plugin.js file
baseJS = stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.js', 'utf-8').replace(/%pluginName%/g, name));
fs.writeFileSync(cwd + 'www/' + name + '.js', baseJS, 'utf-8');
// Add it to the xml as a js module
jsMod = et.Element('js-module');
jsMod.set('src', 'www/' + name + '.js');
jsMod.set('name', name);
spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function(path) {
if (/WMAppManifest.xml$/.exec(path)) {
return manifestXml = new et.ElementTree(et.XML(MANIFEST_XML));
} else if (/csproj$/.exec(path)) {
return projXml = new et.ElementTree(et.XML(PROJ_XML));
} else if (/MainPage.xaml$/.exec(path)) {
return mainPageXamlXml = new et.ElementTree(et.XML(MAINPAGEXAML_XML));
} else if (/xaml$/.exec(path)) {
return new et.ElementTree(et.XML(XAML_XML));
} else {
throw new CordovaError('Unexpected parseElementtreeSync: ' + path);
}
});
});
spyOn(xml, 'parseElementtreeSync').and.callFake(function (path) {
if (path === 'config.xml') return new et.ElementTree(et.XML(TEST_XML));
return origParseElementtreeSync(path);
});
spyOn(xml, 'parseElementtreeSync').and.callFake(function (path) {
if (path === 'config.xml') return new et.ElementTree(et.XML(TEST_XML));
return origParseElementtreeSync(path);
});