added simple confirm-environment task to help prevent accidental deploys to productions

This commit is contained in:
Bart Swaalf 2016-02-15 12:17:18 +01:00
parent 0cd94285de
commit 48484793ac

View file

@ -0,0 +1,32 @@
<?php
namespace Mage\Task\Newcraft\Communication;
use Mage\Task\AbstractTask;
use Mage\Console;
class ConfirmEnvironmentTask extends AbstractTask
{
/**
* Returns the Title of the Task
* @return string
*/
public function getName()
{
return 'Confirm environment [newcraft]';
}
/**
* Runs the task
*
* @return boolean
*/
public function run()
{
Console::output('');
Console::output('Deploying to <white>'.$this->getConfig()->getEnvironment().'</white>! Sure? (Y/N)... ', 3, 0);
$answer = strtoupper(Console::readInput());
Console::output('Cont... <purple>'.$this->getName().'</purple> ... ', 2, 0);
return 'Y' === $answer;
}
}