mirror of
https://github.com/appium/appium.git
synced 2026-05-05 01:39:51 -05:00
add --show-config flag to show appium config, and include server build time
This commit is contained in:
@@ -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
@@ -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||
|
||||
|
||||
@@ -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
@@ -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 " +
|
||||
|
||||
@@ -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'
|
||||
}]
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user