public function nodesFromSSHConfigHosts($paths = array()) { $configPaths = array(); if (is_string($paths)) { $configPaths[] = $paths; } else { $configPaths = $paths; } if (sizeof($configPaths) < 1) { $configPaths = array("/etc/ssh_config", "/etc/ssh/ssh_config", Env::get("homedir") . "/.ssh/config"); } $nodesOptions = SSHConfig::parseToNodeOptionsFromFiles($configPaths); foreach ($nodesOptions as $key => $option) { $this->node($key, $option); } }
public function testRunLocally1() { $this->runtimeTask->getOutput()->setVerbosity(3); $homedir = Env::get("homedir"); $node = new Node(); $node->setName("127.0.0.1"); $process = new Process($this->runtimeTask, $node); $process->runLocally("echo helloworld", array("cwd" => $homedir)); $output = $process->getRuntimeTask()->getOutput()->fetch(); $this->assertRegExp("/helloworld/", $output); $os = php_uname('s'); if (preg_match('/Windows/i', $os)) { $regexp = '/Real command: cmd.exe \\/C "cd ' . preg_quote($homedir, '/') . ' & echo helloworld"/'; } else { $regexp = '/Real command: bash -l -c "cd ' . preg_quote($homedir, '/') . ' && echo helloworld"/'; } $this->assertRegExp($regexp, $output); }
public function getDefaultUsername() { return $this->defaultUsername ? $this->defaultUsername : Env::get("server.username"); }
public function testSetAndGet() { Env::set("aaa", "bbb"); $this->assertEquals("bbb", Env::get("aaa")); }