mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
Validate shared_dirs on deploy:shared
This commit is contained in:
parent
49a7f55ed7
commit
73e6c3b441
@ -5,6 +5,7 @@
|
||||
|
||||
### Added
|
||||
- Added `testLocally` function (analog `test` fn)
|
||||
- Added `ConfigurationException`
|
||||
|
||||
### Changed
|
||||
- Server config `setPty` renamed to `pty` [#953](https://github.com/deployphp/deployer/pull/953)
|
||||
@ -12,6 +13,7 @@
|
||||
- `deploy:unlock` now always successful [#950](https://github.com/deployphp/deployer/pull/950)
|
||||
- Added option `-L` to `setfacl` [#956](https://github.com/deployphp/deployer/pull/956)
|
||||
- Run `deploy:unlock` when deploy is fail [#958](https://github.com/deployphp/deployer/pull/958)
|
||||
- Now throw exception on duplicates in `shared_dirs`
|
||||
|
||||
### Fixed
|
||||
- Fixed native ssh scp option
|
||||
|
@ -7,10 +7,21 @@
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
use Deployer\Exception\ConfigurationException;
|
||||
|
||||
desc('Creating symlinks for shared files and dirs');
|
||||
task('deploy:shared', function () {
|
||||
$sharedPath = "{{deploy_path}}/shared";
|
||||
|
||||
// Validate shared_dir, find duplicates
|
||||
foreach (get('shared_dirs') as $a) {
|
||||
foreach (get('shared_dirs') as $b) {
|
||||
if ($a !== $b && strpos($a, $b) === 0) {
|
||||
throw new ConfigurationException("Can not share same dirs `$a` and `$b`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (get('shared_dirs') as $dir) {
|
||||
// Check if shared dir does not exists.
|
||||
if (!test("[ -d $sharedPath/$dir ]")) {
|
||||
|
12
src/Exception/ConfigurationException.php
Normal file
12
src/Exception/ConfigurationException.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/* (c) Anton Medvedev <anton@medv.io>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Deployer\Exception;
|
||||
|
||||
class ConfigurationException extends \RuntimeException
|
||||
{
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user