예제 #1
0
 public function _openConnection($environment)
 {
     $config = new Garp_Deploy_Config();
     $params = $config->getParams($environment);
     if (!$params) {
         Garp_Cli::errorOut('No settings found for environment ' . $environment);
     }
     if (empty($params['server'])) {
         Garp_Cli::errorOut("'server' is a required setting.");
         return false;
     }
     // To provide a bit of backward-compatibility, convert to array
     if (!is_array($params['server'])) {
         $params['server'] = array(array('server' => $params['server'], 'user' => $params['user']));
     }
     if (count($params['server']) === 1) {
         $this->_executeSshCommand($params['server'][0]['server'], $params['server'][0]['user']);
         return true;
     }
     $choice = Garp_Cli::prompt("Choose a server to use: \n" . array_reduce($params['server'], function ($output, $server) {
         $number = count(explode("\n", $output));
         $output .= "{$number}) {$server['server']}\n";
         return $output;
     }, ''));
     if (!array_key_exists($choice - 1, $params['server'])) {
         Garp_Cli::errorOut('Invalid choice: ' . $choice);
         return false;
     }
     $this->_executeSshCommand($params['server'][$choice - 1]['server'], $params['server'][$choice - 1]['user']);
 }
예제 #2
0
 /**
  * Fetches the deploy parameters for the environment which this storage instance runs on.
  */
 public function getDeployParams()
 {
     $deployConfig = new Garp_Deploy_Config();
     $deployParams = $deployConfig->getParams($this->getEnvironment());
     return $deployParams;
 }
예제 #3
0
 /**
  * Fetches the SSH deploy parameters for the environment which this storage instance runs on.
  * @return Array Deployment parameters containing values for 'server', 'user' and 'deploy_to' path.
  */
 protected function _fetchDeployParams()
 {
     $deployConfig = new Garp_Deploy_Config();
     $deployParams = $deployConfig->getParams($this->getEnvironment());
     return $deployParams;
 }