mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
Change selecting servers behavior. 💎
This commit is contained in:
parent
b5b8e7278c
commit
e0b418e85f
@ -89,12 +89,16 @@ class TaskCommand extends Command
|
||||
}
|
||||
|
||||
} else {
|
||||
// Otherwise run on all servers.
|
||||
$servers = iterator_to_array($this->deployer->servers->getIterator());
|
||||
// Otherwise run on all servers what does not specify stage.
|
||||
foreach($this->deployer->environments as $name => $env) {
|
||||
if (!$env->has('stages')) {
|
||||
$servers[$name] = $this->deployer->servers->get($name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($servers)) {
|
||||
throw new \RuntimeException('You need specify at least one server.');
|
||||
throw new \RuntimeException('You need specify at least one server or stage.');
|
||||
}
|
||||
|
||||
$environments = iterator_to_array($this->deployer->environments);
|
||||
|
@ -36,7 +36,7 @@ class Environment
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int|string|array $value
|
||||
* @param bool|int|string|array $value
|
||||
*/
|
||||
public function set($name, $value)
|
||||
{
|
||||
@ -45,8 +45,8 @@ class Environment
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int|string|array $default
|
||||
* @return int|string|array
|
||||
* @param bool|int|string|array $default
|
||||
* @return bool|int|string|array
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get($name, $default = null)
|
||||
@ -72,6 +72,17 @@ class Environment
|
||||
return $this->parse($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if env var exists.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name)
|
||||
{
|
||||
return $this->values->hasKey($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user