Skip to content

Commit

Permalink
Merge pull request #103 from erik-pantheon/ehm-upstream-check
Browse files Browse the repository at this point in the history
Redoing upstream code check logic. Adding additional language for missing environments.
  • Loading branch information
mikevanwinkle committed Feb 5, 2015
2 parents 183c565 + 94bacef commit d44146d
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions php/commands/site.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,31 +1224,32 @@ public function upstream_updates($args, $assoc_args) {

// data munging as usual
$data = array();
$data['dev'] = ( isset($upstream->test->is_up_to_date_with_upstream) AND $upstream->dev->is_up_to_date_with_upstream ) ?"Up-to-date":"Updates Available";
if (isset($upstream->test)) {
$data['test'] = ( isset($upstream->test->is_up_to_date_with_upstream) AND $upstream->test->is_up_to_date_with_upstream ) ?"Up-to-date":"Updates Available";
}
if (isset($upstream->live)) {
$data['test'] = ( isset($upstream->test->is_up_to_date_with_upstream) AND $upstream->test->is_up_to_date_with_upstream ) ?"Up-to-date":"Updates Available";
}

$this->_constructTableForResponse($data, array('Environment','Status') );
if (!isset($upstream) OR empty($upstream->update_log)) Terminus::success("No updates to show");
$upstreams = (array) $upstream->update_log;
if (!empty($upstreams)) {
$data = array();
foreach ($upstreams as $commit) {
$data = array(
'hash' => $commit->hash,
'datetime'=> $commit->datetime,
'message' => $commit->message,
'author' => $commit->author,
);
$this->handleDisplay($data,$args);
echo PHP_EOL;
if(isset($upstream->remote_url) && isset($upstream->behind)) {
// The $upstream object returns a value of [behind] -> 1 if there is an
// upstream update that has not been applied to Dev.
$data[$upstream->remote_url] = ($upstream->behind == 1 ? "Updates Available":"Up-to-date");

$this->_constructTableForResponse($data, array('Upstream','Status') );
if (!isset($upstream) OR empty($upstream->update_log)) Terminus::success("No updates to show");
$upstreams = (array) $upstream->update_log;
if (!empty($upstreams)) {
$data = array();
foreach ($upstreams as $commit) {
$data = array(
'hash' => $commit->hash,
'datetime'=> $commit->datetime,
'message' => $commit->message,
'author' => $commit->author,
);
$this->handleDisplay($data,$args);
echo PHP_EOL;
}
}
} else {
$this->handleDisplay('There was a problem checking your upstream status. Please try again.');
echo PHP_EOL;
}

if (isset($assoc_args['update']) AND !empty($upstream->update_log)) {
$env = 'dev';
Terminus::confirm(sprintf("Are you sure you want to apply the upstream updates to %s-dev", $site->getName(), $env));
Expand Down

0 comments on commit d44146d

Please sign in to comment.