mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
Make version in version script easier to replace by coho
This commit is contained in:
parent
80a09b8f36
commit
1bfcc92677
53
bin/templates/cordova/lib/version.js
vendored
53
bin/templates/cordova/lib/version.js
vendored
@ -1,53 +0,0 @@
|
||||
#!/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'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/*
|
||||
* Displays the version, gotten from cordova.js
|
||||
*/
|
||||
module.exports.run = function() {
|
||||
var cordovajs_path = path.join(ROOT, 'assets', 'www', 'cordova.js');
|
||||
if (fs.existsSync(cordovajs_path)) {
|
||||
var version_line = shell.grep(/^.*CORDOVA_JS_BUILD_LABEL.*$/, cordovajs_path);
|
||||
var version = version_line.match(/(\d+)\.(\d+)\.(\d+)(rc\d)?/)[0];
|
||||
if (version) {
|
||||
console.log(version);
|
||||
return version;
|
||||
} else {
|
||||
console.error("ERROR : Unable to find version in cordova.js");
|
||||
process.exit(2);
|
||||
}
|
||||
} else {
|
||||
console.error("ERROR : Could not find cordova.js");
|
||||
console.error('Expected Location : ' + cordovajs_path);
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'version')));
|
||||
console.log('Returns the version of Cordova.');
|
||||
process.exit(0);
|
||||
}
|
@ -19,15 +19,7 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var version = require('./lib/version');
|
||||
var args = process.argv;
|
||||
// Coho updates this line:
|
||||
var VERSION = '3.1.0-dev';
|
||||
|
||||
// Usage support for when args are given
|
||||
if(args.length > 2) {
|
||||
version.help();
|
||||
} else {
|
||||
// TODO : Don't have this hardcoded into the scripts
|
||||
console.log('3.1.0-dev');
|
||||
//console.log(version.run());
|
||||
process.exit(0);
|
||||
}
|
||||
console.log(VERSION);
|
||||
|
Loading…
Reference in New Issue
Block a user