Add stare and roles helpers

This commit is contained in:
Anton Medvedev 2017-03-15 19:49:58 +07:00
parent 66b40c7259
commit 67ecaebe20
2 changed files with 42 additions and 4 deletions

View File

@ -2,9 +2,10 @@
1. Servers to Hosts
* Refactor `server($name, $hostname)` to `host($hostname)`
* Refactor `localServer($name)` to `localhost()`
* Rename `serverList($file)` to `inventory($file)`
* `server($name, $hostname)` to `host($hostname)`
* `localServer($name)` to `localhost()`
* `cluster($name, $nodes, $port)` to `hosts(...$hodes)`
* `serverList($file)` to `inventory($file)`
2. Configuration options
@ -35,6 +36,14 @@
get('a_b');
```
4. Credentials
Best practice in new v5 is to omit credentials for connection in `deploy.php` and write them in `~/.ssh/config` instead.
* `identityFile($publicKeyFile,, $privateKeyFile, $passPhrase)` to `identityFile($privateKeyFile)`
* `pemFile($pemFile)` to `identityFile($pemFile)`
* `forwardAgent()` to `forwardAgent(true)`
# Upgrade from 3.x to 4.x
1. Namespace for functions

View File

@ -59,7 +59,7 @@ trait ConfigurationAccessor
}
/**
* Add Configuration option
* Add configuration option
*
* @param string $name
* @param array|bool|int|string $value
@ -70,4 +70,33 @@ trait ConfigurationAccessor
$this->configuration->add($name, $value);
return $this;
}
/**
* Set stage
*
* @param string $stage
* @return $this
*/
public function stage(string $stage)
{
$this->configuration->set('stage', $stage);
return $this;
}
/**
* Set roles
*
* @param array ...$roles
* @return $this
*/
public function roles(...$roles)
{
$this->configuration->set('roles', []);
foreach ($roles as $role) {
$this->configuration->add('roles', $role);
}
return $this;
}
}