Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init with yii2 receipe #1146

Merged
merged 6 commits into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[v4.3.0...master](https://github.com/deployphp/deployer/compare/v4.3.0...master)

### Added
- Added console init template for Yii2 basic and advanced receipe [#1146](https://github.com/deployphp/deployer/pull/1146)
- Added `use_atomic_symlink` and `use_relative_symlink` option [14a8f8](https://github.com/deployphp/deployer/pull/1092/commits/14a8f8f9c4ebbc7da45c2b6b7c3c00a51b563ccf)
- Added `Ssh\Client` [#1092](https://github.com/deployphp/deployer/pull/1092)
- Added host ranges [#1092](https://github.com/deployphp/deployer/pull/1092)
Expand Down Expand Up @@ -41,6 +42,8 @@
- Changed output of errors for native ssh [#1012](https://github.com/deployphp/deployer/issues/1012)

### Fixed
- Fixed Create initial shared file from release [#1143](https://github.com/deployphp/deployer/pull/1143)
- Fixed Fix task order init/shared for yii2-app-advanced.php [#1143](https://github.com/deployphp/deployer/pull/1143)
- Fixed `Can not share same dirs` for shared folders having similar names [#995](https://github.com/deployphp/deployer/issues/995)
- Fixed scalar override on recursive option merge [#1003](https://github.com/deployphp/deployer/pull/1003)
- Fixed incompatible PHP 7.0 syntax [#1020](https://github.com/deployphp/deployer/pull/1020)
Expand Down
14 changes: 11 additions & 3 deletions recipe/deploy/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,23 @@

foreach (get('shared_files') as $file) {
$dirname = dirname($file);

// Create dir of shared file
run("mkdir -p $sharedPath/" . $dirname);

// Check if shared file does not exists in shared.
// and file exist in release
if (!test("[ -f $sharedPath/$file ]") && test("[ -f {{release_path}}/$file ]")) {
// Copy file in shared dir if not present
run("cp -rv {{release_path}}/$file $sharedPath/$file");
}

// Remove from source.
run("if [ -f $(echo {{release_path}}/$file) ]; then rm -rf {{release_path}}/$file; fi");

// Ensure dir is available in release
run("if [ ! -d $(echo {{release_path}}/$dirname) ]; then mkdir -p {{release_path}}/$dirname;fi");

// Create dir of shared file
run("mkdir -p $sharedPath/" . $dirname);

// Touch shared
run("touch $sharedPath/$file");

Expand Down
2 changes: 1 addition & 1 deletion recipe/yii2-app-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:init',
'deploy:shared',
'deploy:run_migrations',
'deploy:symlink',
'deploy:unlock',
Expand Down
4 changes: 4 additions & 0 deletions src/Console/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Deployer\Initializer\Template\LaravelTemplate;
use Deployer\Initializer\Template\SymfonyTemplate;
use Deployer\Initializer\Template\YiiTemplate;
use Deployer\Initializer\Template\Yii2BasicAppTemplate;
use Deployer\Initializer\Template\Yii2AdvancedAppTemplate;
use Deployer\Initializer\Template\ZendTemplate;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -107,6 +109,8 @@ private function createInitializer()
$initializer->addTemplate('Laravel', new LaravelTemplate());
$initializer->addTemplate('Symfony', new SymfonyTemplate());
$initializer->addTemplate('Yii', new YiiTemplate());
$initializer->addTemplate('Yii2 Basic App', new Yii2BasicAppTemplate());
$initializer->addTemplate('Yii2 Advanced App', new Yii2AdvancedAppTemplate());
$initializer->addTemplate('Zend Framework', new ZendTemplate());
$initializer->addTemplate('CakePHP', new CakeTemplate());
$initializer->addTemplate('CodeIgniter', new CodeIgniterTemplate());
Expand Down
22 changes: 22 additions & 0 deletions src/Initializer/Template/Yii2AdvancedAppTemplate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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\Initializer\Template;

/**
* Generate a Yii deployer configuration.
*
* @author Anton Medvedev <anton@medv.io>
* @codeCoverageIgnore
*/
class Yii2AdvancedAppTemplate extends FrameworkTemplate
{
protected function getRecipe()
{
return 'yii2-app-advanced';
}
}
22 changes: 22 additions & 0 deletions src/Initializer/Template/Yii2BasicAppTemplate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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\Initializer\Template;

/**
* Generate a Yii2 app basic deployer configuration.
*
* @author Anton Medvedev <anton@medv.io>
* @codeCoverageIgnore
*/
class Yii2BasicAppTemplate extends FrameworkTemplate
{
protected function getRecipe()
{
return 'yii2-app-basic';
}
}