CommonTemplate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 64
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B getTemplateContent() 0 58 2
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Initializer\Template;
9
10
/**
11
 * Generate a common (base) deployer configuration
12
 *
13
 * @author Vitaliy Zhuk <[email protected]>
14
 * @author Anton Medvedev <[email protected]>
15
 * @codeCoverageIgnore
16
 */
17
class CommonTemplate extends Template
18
{
19
    /**
20
     * {@inheritDoc}
21
     */
22
    protected function getTemplateContent($params)
23
    {
24
        $stats = $params['allow_anonymous_stats']
25
            ? ''
26
            : "set('allow_anonymous_stats', false);";
27
        return <<<PHP
28
<?php
29
namespace Deployer;
30
31
require 'recipe/common.php';
32
33
// Project name
34
set('application', 'my_project');
35
36
// Project repository
37
set('repository', '{$params['repository']}');
38
39
// [Optional] Allocate tty for git clone. Default value is false.
40
set('git_tty', true); 
41
42
// Shared files/dirs between deploys 
43
set('shared_files', []);
44
set('shared_dirs', []);
45
46
// Writable dirs by web server 
47
set('writable_dirs', []);
48
{$stats}
49
50
// Hosts
51
52
host('project.com')
53
    ->set('deploy_path', '~/{{application}}');    
54
    
55
56
// Tasks
57
58
desc('Deploy your project');
59
task('deploy', [
60
    'deploy:info',
61
    'deploy:prepare',
62
    'deploy:lock',
63
    'deploy:release',
64
    'deploy:update_code',
65
    'deploy:shared',
66
    'deploy:writable',
67
    'deploy:vendors',
68
    'deploy:clear_paths',
69
    'deploy:symlink',
70
    'deploy:unlock',
71
    'cleanup',
72
    'success'
73
]);
74
75
// [Optional] If deploy fails automatically unlock.
76
after('deploy:failed', 'deploy:unlock');
77
78
PHP;
79
    }
80
}
81