public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables) { // create a definition for localhost $host = new BaseObject(); $host->hostId = "localhost"; $host->osName = $this->detectOs(); $host->type = "PhysicalHost"; $host->ipAddress = "127.0.0.1"; $host->hostname = "localhost"; $host->provisioned = true; // we need to make sure it's registered in the hosts table $runtimeConfigManager = $injectables->getRuntimeConfigManager(); $runtimeConfig = $injectables->getRuntimeConfig(); $hostsTable = $runtimeConfigManager->getTable($runtimeConfig, 'hosts'); $testEnv = $injectables->activeTestEnvironmentName; if (!isset($hostsTable->{$testEnv})) { $hostsTable->{$testEnv} = new BaseObject(); } $hostsTable->{$testEnv}->localhost = $host; }
public function __construct(Injectables $injectables) { // remember our output object $this->setOutput($injectables->output); // our data formatter $this->setDataFormatter($injectables->dataFormatter); // set a default page context $this->setPageContext(new PageContext()); // create the actionlog $this->setActionLogger(new Action_Logger($injectables)); // create an empty checkpoint $this->setCheckpoint(new Story_Checkpoint($this)); // create our Prose Loader $this->setProseLoader($injectables->proseLoader); // create our Phase Loader $this->setPhaseLoader($injectables->phaseLoader); // remember the device we are testing with $this->setDevice($injectables->activeDeviceName, $injectables->activeDevice); // the config that we have loaded $this->setConfig($injectables->activeConfig); // our runtime config $this->setRuntimeConfig($injectables->getRuntimeConfig()); $this->setRuntimeConfigManager($injectables->getRuntimeConfigManager()); self::$self = $this; }
public function init(Injectables $injectables) { // we start off with the built-in config $this->mergeData('storyplayer', $injectables->defaultConfig); // these are the initial variables we want $this->setData('storyplayer.ipAddress', $this->getHostIpAddress()); $this->setData('storyplayer.currentDir', getcwd()); $this->setData('storyplayer.user.home', getenv('HOME')); // we also want to link in the hosts and roles tables, to make // it a lot easier for Prose modules $activeConfig = $this->getConfig(); $runtimeConfig = $injectables->getRuntimeConfig(); $runtimeConfigManager = $injectables->getRuntimeConfigManager(); $testEnvName = $injectables->activeTestEnvironmentName; $hostsTable = $runtimeConfigManager->getTable($runtimeConfig, 'hosts'); if (!isset($hostsTable->{$testEnvName})) { $hostsTable->{$testEnvName} = new BaseObject(); } $activeConfig->hosts = $hostsTable->{$testEnvName}; $rolesTable = $runtimeConfigManager->getTable($runtimeConfig, 'roles'); if (!isset($rolesTable->{$testEnvName})) { $rolesTable->{$testEnvName} = new BaseObject(); } $activeConfig->roles = $rolesTable->{$testEnvName}; }