add --show-config flag to show appium config, and include server build time

This commit is contained in:
Jonathan Lipps
2013-12-09 14:13:42 -08:00
parent 3e39227015
commit 52bb752773
6 changed files with 32 additions and 2 deletions
+4
View File
@@ -17,6 +17,7 @@ var path = require('path')
, generateServerDocs = gruntHelpers.generateServerDocs
, generateAppiumIo = gruntHelpers.generateAppiumIo
, setDeviceConfigVer = gruntHelpers.setDeviceConfigVer
, setBuildTime = gruntHelpers.setBuildTime
, setGitRev = gruntHelpers.setGitRev
, getGitRev = require('./lib/helpers').getGitRev
, runTestsWithServer = gruntHelpers.runTestsWithServer;
@@ -151,6 +152,9 @@ module.exports = function(grunt) {
grunt.registerTask('setConfigVer', function(device) {
setDeviceConfigVer(grunt, device, this.async());
});
grunt.registerTask('setBuildTime', function() {
setBuildTime(grunt, this.async());
});
grunt.registerTask('setGitRev', function(rev) {
var done = this.async();
if (typeof rev === "undefined") {
+2 -1
View File
@@ -31,7 +31,7 @@ All flags are optional, but some are required in conjunction with certain others
|`--avd`|null|name of the avd to launch|`--avd @default`|
|`--device-ready-timeout`|5|(Android-only) Timeout in seconds while waiting for device to become ready|`--device-ready-timeout 5`|
|`--safari`|false|(IOS-Only) Use the safari app||
|`--device-name`|false|(IOS-only) Name of the device to set for the IOS Simulator|`--deviceName "iPhone Retina (3.5-inch)"`|
|`--device-name`|null|(IOS-Simulator-only) name of the iOS device to use|`--device-name iPhone Retina (4-inch)`|
|`--force-iphone`|false|(IOS-only) Use the iPhone Simulator no matter what the app wants||
|`--force-ipad`|false|(IOS-only) Use the iPad Simulator no matter what the app wants||
|`--language`|null|(IOS-only) language for the iOS simulator|`--language en`|
@@ -48,3 +48,4 @@ All flags are optional, but some are required in conjunction with certain others
|`--keystore-password`|android|(Android-only) Password to keystore||
|`--key-alias`|androiddebugkey|(Android-only) Key alias||
|`--key-password`|android|(Android-only) Key password||
|`--show-config`|true|Show info about the appium server configuration and exit||
+5
View File
@@ -167,6 +167,11 @@ module.exports.setGitRev = function(grunt, rev, cb) {
exports.writeConfigKey(grunt, "git-sha", rev, cb);
};
module.exports.setBuildTime = function(grunt, cb) {
var time = new Date();
exports.writeConfigKey(grunt, "built", time.toISOString(), cb);
};
var auth_enableDevTools = function(grunt, cb) {
grunt.log.writeln("Enabling DevToolsSecurity");
exec('DevToolsSecurity --enable', function(err) {
+12 -1
View File
@@ -24,12 +24,24 @@ var http = require('http')
, _ = require("underscore")
, io = require('socket.io')
, gridRegister = require('./grid-register.js')
, configFile = path.resolve(__dirname, "..", "..", ".appiumconfig")
, bytes = require('bytes')
, isWindows = require('../helpers.js').isWindows()
, exec = require('child_process').exec
, spawn = require('child_process').spawn
, endInstrumentsPath = path.resolve(__dirname, '../../build/force_quit/ForceQuitUnresponsiveApps.app/Contents/MacOS/ForceQuitUnresponsiveApps');
if (require.main === module && args.showConfig) {
try {
var config = fs.readFileSync(configFile);
console.log(config.toString('utf8'));
process.exit(0);
} catch (e) {
console.error("Error: Appium is not correctly configured");
process.exit(1);
}
}
var watchForUnresponsiveInstruments = function(cb) {
if (isWindows) return;
@@ -146,7 +158,6 @@ var main = function(args, readyCb, doneCb) {
appiumServer.attachTo(rest);
var checkSetup = function(cb) {
var configFile = path.resolve(__dirname, "..", "..", ".appiumconfig");
fs.readFile(configFile, function(err, data) {
if (err) {
logger.error("Could not find config file; looks like config hasn't " +
+8
View File
@@ -332,6 +332,14 @@ var args = [
, dest: 'keyPassword'
, required: false
, help: '(Android-only) Key password'
}],
[['--show-config'], {
defaultValue: true
, dest: 'showConfig'
, action: 'storeTrue'
, required: false
, help: 'Show info about the appium server configuration and exit'
}]
];
+1
View File
@@ -374,6 +374,7 @@ main() {
reset_gappium
fi
cleanup
$grunt setBuildTime
reset_successful=true
}