Skip to content

Instantly share code, notes, and snippets.

@jlipps
Forked from freynaud/HostInfo.js
Last active December 10, 2015 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlipps/4497724 to your computer and use it in GitHub Desktop.
Save jlipps/4497724 to your computer and use it in GitHub Desktop.
/*
* Copyright 2012 ios-driver committers.
*
* 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 os = require('os'), exec = require('child_process').exec;
/**
* Stores all the info related to the host the ios-driver is currently running on.
* @constructor
*/
function HostInfo(cb){
this.arch = os.arch();
this.platform = os.platform();
//TODO freynaud
this.os_version = "TODO";
this.iosVersion;
this.installedSimulator;
this.xCodeInstallFolder;
}
HostInfo.prototype.init = function(cb) {
var self = this;
exec('my first script', function(err, stdout, stderr) {
self.myFirstValue = "do some stdout maninpulation";
exec('my second script', function(err, stdout, stderr) {
self.mySecondValue = "do some more manipulation";
cb(self);
});
});
}
/**
*
* @return {string} x64 ||
*/
HostInfo.prototype.getArchitecture = function(){
return this.arch;
}
/**
*
* @return {string}
*/
HostInfo.prototype.getPlatform = function(){
return this.platform;
}
/**
* // TODO freynaud how to find that in node.js ?
* @return {string} version of the platform
*/
HostInfo.prototype.getVersion = function(){
return this.os_version;
}
function create(cb){
var h = new HostInfo();
h.init(cb);
}
exports.create = create;
// use:
// var host_info = require('host_info');
// host_info.create(function(h) {
// console.log(h.myFirstValue);
// console.log(h.mySecondValue);
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment