Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
CB-5730 Cordova update does not work
* shell.cp(-rf, path/to/folder, directory) creates a folder named folder in directory
* the public update script is bin/update, not bin/lib/update (which doesn't exist...)
* the platform is blackberry10
* record updated version in VERSION
  • Loading branch information
jsoref committed Jan 13, 2014
1 parent ead6edd commit 85763837b279214314af0a71bd25ceb4b91aa417
Showing 4 changed files with 10 additions and 9 deletions.
@@ -18,7 +18,7 @@
under the License.
COMMENT
#
# create a cordova/blackberry project
# create a cordova/blackberry10 project
#
# USAGE
# ./create path [package [id [name [template]]]]
@@ -18,7 +18,7 @@
*/

/*
* create a cordova/blackberry project
* create a cordova/blackberry10 project
*
* USAGE
* ./create path [package [id [name [template]]]]
@@ -34,20 +34,19 @@ function setShellFatal(value, func) {


function updateNativeDir(projectpath) {
shell.cp('-rf', path.join(ROOT, 'bin', 'templates', 'project', 'native'), path.join(projectpath, 'native'));
shell.cp('-rf', path.join(ROOT, 'bin', 'templates', 'project', 'native'), path.join(projectpath));
}

function updateCordovaJS(projectpath, version) {
var jspath = path.join(projectpath, 'lib', 'cordova' + version, 'javascript');
shell.rm('-rf', path.join(projectpath, 'lib')); //remove old lib tree
var jspath = path.join(projectpath, 'lib', 'cordova.' + version, 'javascript');
shell.mkdir('-p', jspath); // remake lib dir tree with updated version
shell.cp('-f', path.join(ROOT, 'javascript', 'cordova.blackberry10.js'), path.join(jspath, 'cordova.js')); // copy new js
shell.cp('-f', path.join(ROOT, 'javascript', 'cordova.blackberry10.js'), path.join('www', 'cordova.js'));
shell.cp('-f', path.join(ROOT, 'javascript', 'cordova.blackberry10.js'), path.join(projectpath, 'www', 'cordova.js'));
}

function updateCordovaTools(projectpath) {
// update cordova scripts from template
shell.cp('-rf', path.join(ROOT, 'bin', 'templates', 'project', 'cordova'), path.join(projectpath, 'cordova'));
shell.cp('-rf', path.join(ROOT, 'bin', 'templates', 'project', 'cordova'), path.join(projectpath));
// update repo level scripts
updateTargetTool(projectpath);
updateInitTool(projectpath);
@@ -68,9 +67,11 @@ function updateInitTool(projectpath) {
exports.updateProject = function (projectpath) {
var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
setShellFatal(true, function () {
shell.rm('-rf', path.join(projectpath, 'lib')); //remove old lib tree
updateCordovaJS(projectpath, version);
updateCordovaTools(projectpath);
updateNativeDir(projectpath);
fs.writeFileSync(path.join(projectpath, 'VERSION'), version + "\n", 'utf-8');
//console.log('BlackBerry10 project is now at version ' + version);
});
};
@@ -79,7 +80,7 @@ if (require.main === module) {
(function () {
var args = process.argv;
if (args.length < 3 || (args[2] === '--help' || args[2] === '-h')) {
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' <path_to_project>');
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, '..', 'update')) + ' <path_to_project>');
exit(1);
} else {
exports.updateProject(args[2]);
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
# create a cordova/blackberry project
# update a cordova/blackberry10 project
#
# USAGE
# ./update [projectpath]

0 comments on commit 8576383

Please sign in to comment.