Start refactoring Deployer.

This commit is contained in:
Elfet 2014-08-09 14:56:40 +04:00
parent 0de61256b6
commit be590bb088

View File

@ -19,7 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class Deployer class Deployer
{ {
/** /**
* Singleton instance of deployer. It's can be accessed only after constructor call. * Global instance of deployer. It's can be accessed only after constructor call.
* @var Deployer * @var Deployer
*/ */
private static $instance; private static $instance;
@ -48,38 +48,37 @@ class Deployer
* List of all tasks. * List of all tasks.
* @var TaskInterface[] * @var TaskInterface[]
*/ */
public static $tasks = []; private $tasks = [];
/** /**
* List of all servers. * List of all servers.
* @var ServerInterface[] * @var ServerInterface[]
*/ */
public static $servers = []; private $servers = [];
/** /**
* Turn on/off multistage support * Turn on/off multistage support
* @var bool * @var bool
*/ */
public static $multistage = false; private $multistage = false;
/** /**
* Default deploy stage * Default deploy stage
* @var string * @var string
*/ */
public static $defaultStage = 'develop'; private $defaultStage = 'develop';
/** /**
* List of all stages. * List of all stages.
* @var array[] * @var array[]
*/ */
public static $stages = []; private $stages = [];
/** /**
* Array of global parameters. * Array of global parameters.
* @var array * @var array
*/ */
public static $parameters = []; private $parameters = [];
/** /**
* @param Application $app * @param Application $app
@ -162,10 +161,10 @@ class Deployer
* @return TaskInterface * @return TaskInterface
* @throws \RuntimeException If task does not defined. * @throws \RuntimeException If task does not defined.
*/ */
public static function getTask($name) public function getTask($name)
{ {
if (array_key_exists($name, self::$tasks)) { if (array_key_exists($name, $this->tasks)) {
return self::$tasks[$name]; return $this->tasks[$name];
} else { } else {
throw new \RuntimeException("Task \"$name\" does not defined."); throw new \RuntimeException("Task \"$name\" does not defined.");
} }