__init__.py 2.59 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# coding: utf-8
#
# Copyright (C) 2016 Savoir-faire Linux Inc. (<www.savoirfairelinux.com>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
18
from fabric.api import task, env, execute
19

20
21
22
23
24
25
from . import core
from . import docker
from . import deploy
from . import drush
from . import patternlab
from . import tests
26

27
28

@task
29
def clean():
30
    """
31
    Remove all files inside src/drupal.
32
    """
33
    core.clean()
34
35
36


@task
37
38
39
def deployment(environment):
    """
    Deploy code and run database updates on a target Drupal environment.
40
    """
41
42
43
    execute(deploy.provision, environment)
    execute(deploy.push, environment, hosts=env.hosts)
    execute(deploy.migrate, environment, hosts=env.hosts)
44
45


46
47
@task
def hosts():
48
    """
49
50
51
52
53
    Update the file /etc/hosts and add aliases for each services that made port
    binding with the local machine
    """
    execute(docker.compose_up)
    core.add_hosts_aliases()
54
55
56


@task
57
def init():
58
    """
59
60
    Complete local installation process, used generally when
    building the docker image for install and configure Drupal.
61
    """
62
63
    execute(docker.compose_up)
    execute(docker.compose_start)
64
65
    execute(drush.make, 'install')
    execute(drush.site_install)
66
    execute(drush.aliases)
67
68
69


@task
70
def install():
71
    """
72
    Run the full installation process.
73
    """
74
75
    execute(drush.make, 'install')
    execute(drush.site_install)
76

77
78
79
80

@task
def release():
    """
81
82
    Generate all artefacts related to a release process or a deployment
    process.
83
84
    """
    execute(drush.archive_dump)
85
    execute(drush.gen_doc)
Emmanuel Milou's avatar
Emmanuel Milou committed
86
87
88


@task
89
def test(pattern=''):
Emmanuel Milou's avatar
Emmanuel Milou committed
90
    """
91
92
93
94
95
96
97
98
    Setup tests engines and run the complete tests suite.
    :param pattern Specific tests to run that match the pattern.
    """
    if pattern:
        execute(tests.run, tags=pattern)
    else:
        execute(tests.run)

Emmanuel Milou's avatar
Emmanuel Milou committed
99

100
101
102
103
104
105
106
@task
def update():
    """
    Update the full codebase and run the availabe database updates.
    """
    execute(drush.make, 'update')
    execute(drush.updatedb)
Samuel Sirois's avatar
Samuel Sirois committed
107
    execute(drush.config_import)