Updated Branches: refs/heads/master 6b2ae1dec -> 2a4fd5074
CB-4780 update script with windows support Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/5a96c23c Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/5a96c23c Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/5a96c23c Branch: refs/heads/master Commit: 5a96c23c036a339f838ccd9c36254acaf641e806 Parents: 6b2ae1d Author: lorinbeer <[email protected]> Authored: Wed Oct 23 14:35:16 2013 -0700 Committer: lorinbeer <[email protected]> Committed: Wed Oct 23 14:35:16 2013 -0700 ---------------------------------------------------------------------- blackberry10/bin/lib/update.js | 94 +++++++++++++++++++++++++++ blackberry10/bin/update | 122 +++++++++--------------------------- blackberry10/bin/update.bat | 21 +++++++ 3 files changed, 143 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/5a96c23c/blackberry10/bin/lib/update.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/lib/update.js b/blackberry10/bin/lib/update.js new file mode 100755 index 0000000..d941a6f --- /dev/null +++ b/blackberry10/bin/lib/update.js @@ -0,0 +1,94 @@ +#!/usr/bin/env node + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +var shell = require('shelljs'), + path = require('path'), + fs = require('fs'), + ROOT = path.join(__dirname, '..', '..'); + +function setShellFatal(value, func) { + var oldVal = shell.config.fatal; + shell.config.fatal = value; + func(); + shell.config.fatal = oldVal; +} + + +function updateNativeDir(projectpath) { + shell.cp('-rf', path.join(ROOT,'bin','templates','project','native'), path.join(projectpath,'native')); +} + +function updateProjectJson(projectpath) { + var projectJson = require(path.resolve(path.join(projectpath, "project.json"))); + projectJson.globalFetchDir = path.join(ROOT,'plugins'); + fs.writeFileSync(path.join(projectpath, "project.json"), JSON.stringify(projectJson, null, 4) + "\n", "utf-8"); +} + +function updateCordovaJS(projectpath,version) { + var jspath = path.join(projectpath,'lib','cordova'+version,'javascript'); + shell.rm('-rf', path.join(projectpath, 'lib')); //remove old lib tree + 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')); +} + +function updateCordovaTools(projectpath) { + // update cordova scripts from template + shell.cp('-rf', path.join(ROOT,'bin','templates','project','cordova'), path.join(projectpath,'cordova')); + // update repo level scripts + updateTargetTool(projectpath); + updateInitTool(projectpath); +} + +function updateTargetTool(projectpath) { + shell.cp('-f', path.join(ROOT,'bin','target'), path.join(projectpath,'cordova')); + shell.cp('-f', path.join(ROOT,'bin','target.bat'), path.join(projectpath,'cordova')); + shell.cp('-f', path.join(ROOT,'bin','lib','target.js'), path.join(projectpath,'cordova','lib')); + shell.cp('-f', path.join(ROOT,'bin','lib','utils.js'), path.join(projectpath,'cordova','lib')); +} + +function updateInitTool(projectpath) { + shell.cp('-f', path.join(ROOT,'bin','init.bat'), path.join(projectpath, 'cordova')); + shell.cp('-f', path.join(ROOT,'bin','init'), path.join(projectpath, 'cordova')); +} + +exports.updateProject = function(projectpath) { + var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim(); + setShellFatal(true, function() { + updateCordovaJS(projectpath,version); + updateCordovaTools(projectpath); + updateNativeDir(projectpath); + updateProjectJson(projectpath); + //console.log('BlackBerry10 project is now at version ' + version); + }); +}; + +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>'); + process.exit(1); + } else { + exports.updateProject(args[2]); + } + })(); +} http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/5a96c23c/blackberry10/bin/update ---------------------------------------------------------------------- diff --git a/blackberry10/bin/update b/blackberry10/bin/update index 586873a..4fd94da 100755 --- a/blackberry10/bin/update +++ b/blackberry10/bin/update @@ -1,94 +1,28 @@ -#!/usr/bin/env node - -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -var shell = require('shelljs'), - path = require('path'), - fs = require('fs'), - ROOT = path.join(__dirname, '..'); - -function setShellFatal(value, func) { - var oldVal = shell.config.fatal; - shell.config.fatal = value; - func(); - shell.config.fatal = oldVal; -} - - -function updateNativeDir(projectpath) { - shell.cp('-rf', path.join(ROOT,'bin','templates','project','native'), path.join(projectpath,'native')); -} - -function updateProjectJson(projectpath) { - var projectJson = require(path.resolve(path.join(projectpath, "project.json"))); - projectJson.globalFetchDir = path.join(ROOT,'plugins'); - fs.writeFileSync(path.join(projectpath, "project.json"), JSON.stringify(projectJson, null, 4) + "\n", "utf-8"); -} - -function updateCordovaJS(projectpath,version) { - var jspath = path.join(projectpath,'lib','cordova'+version,'javascript'); - shell.rm('-rf', path.join(projectpath, 'lib')); //remove old lib tree - 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')); -} - -function updateCordovaTools(projectpath) { - // update cordova scripts from template - shell.cp('-rf', path.join(ROOT,'bin','templates','project','cordova'), path.join(projectpath,'cordova')); - // update repo level scripts - updateTargetTool(projectpath); - updateInitTool(projectpath); -} - -function updateTargetTool(projectpath) { - shell.cp('-f', path.join(ROOT,'bin','target'), path.join(projectpath,'cordova')); - shell.cp('-f', path.join(ROOT,'bin','target.bat'), path.join(projectpath,'cordova')); - shell.cp('-f', path.join(ROOT,'bin','lib','target.js'), path.join(projectpath,'cordova','lib')); - shell.cp('-f', path.join(ROOT,'bin','lib','utils.js'), path.join(projectpath,'cordova','lib')); -} - -function updateInitTool(projectpath) { - shell.cp('-f', path.join(ROOT,'bin','init.bat'), path.join(projectpath, 'cordova')); - shell.cp('-f', path.join(ROOT,'bin','init'), path.join(projectpath, 'cordova')); -} - -exports.updateProject = function(projectpath) { - var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim(); - setShellFatal(true, function() { - updateCordovaJS(projectpath,version); - updateCordovaTools(projectpath); - updateNativeDir(projectpath); - updateProjectJson(projectpath); - //console.log('BlackBerry10 project is now at version ' + version); - }); -}; - -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>'); - process.exit(1); - } else { - exports.updateProject(args[2]); - } - })(); -} +#! /bin/sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# create a cordova/blackberry project +# +# USAGE +# ./update [projectpath] +# +#!/bin/sh + +BIN_DIR=$(dirname "$0") +source "$BIN_DIR/init" +"$CORDOVA_NODE/node" "$BIN_DIR/lib/update.js" "$@" http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/5a96c23c/blackberry10/bin/update.bat ---------------------------------------------------------------------- diff --git a/blackberry10/bin/update.bat b/blackberry10/bin/update.bat new file mode 100755 index 0000000..02bd6c7 --- /dev/null +++ b/blackberry10/bin/update.bat @@ -0,0 +1,21 @@ +@ECHO OFF +goto comment + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +:comment +call "%~dps0init" +"%CORDOVA_NODE%\node.exe" "%~dps0\lib\update.js" %*
