Exemple #1
0
 /**
  * Print and save drush aliases
  *
  * ## OPTIONS
  *
  * [--print]
  * : print aliases to screen
  *
  * [--location=<location>]
  * : Specify the the full path, including the filename, to the alias file
  *   you wish to create. Without this option a default of
  *   '~/.drush/pantheon.aliases.drushrc.php' will be used.
  */
 public function aliases($args, $assoc_args)
 {
     $user = new User(new stdClass(), array());
     $print = Input::optional('print', $assoc_args, false);
     $location = Input::optional('location', $assoc_args, getenv('HOME') . '/.drush/pantheon.aliases.drushrc.php');
     if (is_dir($location)) {
         $message = 'Please provide a full path with filename,';
         $message .= ' e.g. {location}/pantheon.aliases.drushrc.php';
         $this->failure($message, compact('location'));
     }
     $file_exists = file_exists($location);
     // Create the directory if it doesn't yet exist
     $dirname = dirname($location);
     if (!is_dir($dirname)) {
         mkdir($dirname, 0700, true);
     }
     $content = $user->getAliases();
     $h = fopen($location, 'w+');
     fwrite($h, $content);
     fclose($h);
     chmod($location, 0700);
     $message = 'Pantheon aliases created';
     if ($file_exists) {
         $message = 'Pantheon aliases updated';
     }
     $this->log()->info($message);
     if ($print) {
         eval(str_replace(array('<?php', '?>'), '', $content));
         $this->output()->outputDump($aliases);
     }
 }
 /**
  * Show a list of your organizations on Pantheon
  *
  * @subcommand list
  *
  */
 public function all($args, $assoc_args)
 {
     $user = new User(new stdClass(), array());
     $data = array();
     foreach ($user->organizations() as $org_id => $org) {
         $data[] = array('name' => $org->name, 'id' => $org_id);
     }
     $this->handleDisplay($data);
 }
Exemple #3
0
 /**
  * Show a list of your organizations on Pantheon
  *
  * @subcommand list
  *
  */
 public function all($args, $assoc_args)
 {
     $user = new User(new stdClass(), array());
     $data = array();
     foreach ($user->getOrganizations() as $id => $org) {
         $data[] = array('name' => $org->get('name'), 'id' => $org->get('id'));
     }
     $this->output()->outputRecordList($data);
 }
Exemple #4
0
 /**
  * Show a list of your organizations on Pantheon
  *
  * @subcommand list
  */
 public function all($args, $assoc_args)
 {
     $user = new User();
     $data = array();
     foreach ($user->getOrganizations() as $id => $org) {
         $org_data = $org->get('organization');
         $data[] = array('name' => $org_data->profile->name, 'id' => $org->get('id'));
     }
     $this->output()->outputRecordList($data);
 }
Exemple #5
0
 /**
  * Returns an array listing organizaitions applicable to user
  *
  * @return [array] List of organizations
  */
 public static function orglist($options = array())
 {
     $orgs = array();
     $allow_none = isset($options['allow_none']) ? $options['allow_none'] : true;
     if ($allow_none) {
         $orgs = array('-' => 'None');
     }
     $user = new User();
     foreach ($user->getOrganizations() as $id => $org) {
         $orgs[$org->get('id')] = $org->get('name');
     }
     return $orgs;
 }
Exemple #6
0
 /**
  * Print and save drush aliases
  *
  * ## OPTIONS
  *
  * [--print]
  * : print aliases to screen
  *
  * [--location=<location>]
  * : Specify the the full path, including the filename, to the alias file you wish to create.
  *   Without this option a default of '~/.drush/pantheon.drushrc.php' will be used.
  *
  */
 public function aliases($args, $assoc_args)
 {
     $user = new User(new stdClass(), array());
     $print = Input::optional('print', $assoc_args, false);
     $json = \Terminus::get_config('json');
     $location = Input::optional('location', $assoc_args, getenv("HOME") . '/.drush/pantheon.aliases.drushrc.php');
     // Cannot provide just a directory
     if (is_dir($location)) {
         \Terminus::error("Please provide a full path with filename, e.g. %s/pantheon.aliases.drushrc.php", $location);
         exit(1);
     }
     $file_exists = file_exists($location);
     // Create the directory if it doesn't yet exist
     $dirname = dirname($location);
     if (!is_dir($dirname)) {
         mkdir($dirname, 0700, true);
     }
     $content = $user->getAliases();
     $h = fopen($location, 'w+');
     fwrite($h, $content);
     fclose($h);
     chmod($location, 0700);
     $message = $file_exists ? 'Pantheon aliases updated' : 'Pantheon aliases created';
     Logger::coloredOutput("%2%K{$message}%n");
     if ($json) {
         include $location;
         print \Terminus\Utils\json_dump($aliases);
     } elseif ($print) {
         print $content;
     }
 }
 /**
  * Adds a user to this organization
  *
  * @param User $user User object of user to add to this organization
  * @return Workflow $workflow
  */
 public function addMember(User $user)
 {
     $workflow = $this->organization->workflows->create('add_organization_user_membership', array('params' => array('user_id' => $user->get('id'), 'role' => 'team_member')));
     return $workflow;
 }
Exemple #8
0
 /**
  * Print and save drush aliases
  *
  * ## OPTIONS
  *
  * [--print]
  * : print aliases to screen
  *
  * [--location=<location>]
  * : Specify the the full path, including the filename, to the alias file you wish to create.
  *   Without this option a default of '~/.drush/pantheon.aliases.drushrc.php' will be used.
  *
  */
 public function aliases($args, $assoc_args)
 {
     $user = new User(new stdClass(), array());
     $print = Input::optional('print', $assoc_args, false);
     $location = Input::optional('location', $assoc_args, getenv("HOME") . '/.drush/pantheon.aliases.drushrc.php');
     // Cannot provide just a directory
     if (is_dir($location)) {
         $this->log()->error("Please provide a full path with filename, e.g. %s/pantheon.aliases.drushrc.php", $location);
         exit(1);
     }
     $file_exists = file_exists($location);
     // Create the directory if it doesn't yet exist
     $dirname = dirname($location);
     if (!is_dir($dirname)) {
         mkdir($dirname, 0700, true);
     }
     $content = $user->getAliases();
     $h = fopen($location, 'w+');
     fwrite($h, $content);
     fclose($h);
     chmod($location, 0700);
     $message = $file_exists ? 'Pantheon aliases updated' : 'Pantheon aliases created';
     $this->log()->info($message);
     if ($print) {
         $this->output()->outputRecordList($aliases);
     }
 }