@theintern/digdug
Version:
Dig Dug. A simple abstraction library for downloading and launching WebDriver service tunnels.
45 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var fs = tslib_1.__importStar(require("fs"));
var path = tslib_1.__importStar(require("path"));
var digdugPath = path.dirname(__dirname);
var tunnels = fs
.readdirSync(digdugPath)
.filter(function (name) {
return (/[A-Z]\w+Tunnel\.js$/.test(name) &&
name !== 'NullTunnel.js' &&
name !== 'Tunnel.js' &&
name !== 'SeleniumTunnel.js');
})
.map(function (name) {
return name.slice(0, name.length - 3);
});
if (process.argv.length !== 3) {
console.log('usage: environments TUNNEL');
console.log();
console.log('Available tunnels:');
tunnels.forEach(function (tunnel) {
console.log(' ' + tunnel);
});
process.exit(1);
}
var tunnelName = process.argv[2];
if (tunnels.indexOf(tunnelName) === -1) {
console.log(tunnelName + ' is not a valid tunnel class');
process.exit(1);
}
var TunnelCtor = require('../' + tunnelName).default;
var tunnel = new TunnelCtor();
tunnel
.getEnvironments()
.then(function (environments) {
environments.forEach(function (environment) {
console.log(JSON.stringify(environment.intern));
});
})
.catch(function (error) {
console.error(error);
});
//# sourceMappingURL=digdugEnvironments.js.map