Updated Branches: refs/heads/master 2299c0fa8 -> 1e8e7b162
[CB-3436] Add ./cordova/version script Reviewed by Bryan Higgins <[email protected]> Tested by Tracy Li <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/1e8e7b16 Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/1e8e7b16 Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/1e8e7b16 Branch: refs/heads/master Commit: 1e8e7b162b6be8165c4a8e5837e75e12150c8c05 Parents: 2299c0f Author: Rosa Tse <[email protected]> Authored: Sat Jun 15 17:43:58 2013 -0400 Committer: Bryan Higgins <[email protected]> Committed: Mon Jun 24 16:47:41 2013 -0400 ---------------------------------------------------------------------- .../templates/project/cordova/lib/version.js | 44 ++++++++++++++++++++ .../bin/templates/project/cordova/version | 5 +++ .../bin/templates/project/cordova/version.bat | 21 ++++++++++ 3 files changed, 70 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1e8e7b16/blackberry10/bin/templates/project/cordova/lib/version.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/lib/version.js b/blackberry10/bin/templates/project/cordova/lib/version.js new file mode 100755 index 0000000..1b9ddc4 --- /dev/null +++ b/blackberry10/bin/templates/project/cordova/lib/version.js @@ -0,0 +1,44 @@ +#!/usr/bin/env node + +/* + * Copyright 2013 Research In Motion Limited. + * + * Licensed 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 fs = require("fs"), + readline = require("readline"), + util = require("util"), + filename = "www/cordova.js"; + +if (fs.existsSync(filename)) { + var rl = readline.createInterface({ + input: fs.createReadStream(filename), + terminal: false + }); + + rl.on("line", function(line){ + if (/^\/\/\s\d/.test(line)) { + rl.close(); + var splitSpace = line.split(" "); + if (splitSpace.length > 1) { + var splitDash = splitSpace[1].split("-"); + if (splitDash.length > 0) { + console.log(splitDash[0]); + } + } + } + }); +} else { + console.log(util.format("The file \"%s\" does not exist.", filename)); +} http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1e8e7b16/blackberry10/bin/templates/project/cordova/version ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/version b/blackberry10/bin/templates/project/cordova/version new file mode 100755 index 0000000..bc03aee --- /dev/null +++ b/blackberry10/bin/templates/project/cordova/version @@ -0,0 +1,5 @@ +#!/bin/sh + +# Prints cordova version number +node "$(dirname "$0")/lib/version" "$@" + http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1e8e7b16/blackberry10/bin/templates/project/cordova/version.bat ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/version.bat b/blackberry10/bin/templates/project/cordova/version.bat new file mode 100755 index 0000000..77fe0e1 --- /dev/null +++ b/blackberry10/bin/templates/project/cordova/version.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 + [email protected] %~dps0\lib\version %*
