Exemple #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']);
 }
 protected static function _getApplicationName()
 {
     $deployConfig = new Garp_Deploy_Config();
     try {
         $appName = $deployConfig->getParam('production', 'application');
     } catch (Exception $e) {
         return isset(Zend_Registry::get('config')->app->name) ? Zend_Registry::get('config')->app->name : 'anonymous application';
     }
     return $appName;
 }
 /**
  * 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;
 }
Exemple #4
0
 protected function _verifyCapified()
 {
     $deployConfig = new Garp_Deploy_Config();
     $environment = $this->getEnvironment();
     if (!$deployConfig->isConfigured($environment)) {
         throw new Exception("Could not find deploy information for {$environment}.");
     }
 }