__init__.py 1.79 KB
Newer Older
Emmanuel Milou's avatar
Emmanuel Milou committed
1
2
import docker
from deploy  import *
3
import drush
4
import behat
5
import patternlab
6
7
from .environments import e

8
from fabric.api import task, env, execute
9
10
11
12
13
14
15
16
17
18
19
20

import helpers as h

@task
def init():
    """
    Complete local installation process, used generally when building the docker image for install and configure Drupal.
    """

    execute(docker.image_create)
    execute(docker.container_start)
    execute(drush.make, 'install')
21
    execute(drush.site_install, host='root@{}'.format(env.container_ip))
22
    execute(drush.aliases)
23
    execute(behat.init, host='root@{}'.format(env.container_ip))
24
25
26
27



@task
28
def test(tags=''):
29
30
31
32
    """
    Setup Behat and run the complete tests suite. Default output formatters: pretty and JUnit.
    The JUnit report file is specified in the Behat configuration file. Default: tests/behat/out/behat.junit.xml.

33
    :param tags Specific Behat tests tags to run.
34
35
36

    """
    execute(behat.init)
37
38
39
40
    if not tags:
      execute(behat.run)
    else:
      execute(behat.run, tags='{}'.format(tags))
41
42
43
44
45
46
47
48
49
50
51
52
53



@task
def install():

    """
    Run the full installation process.
    """

    execute(drush.make, 'install')
    execute(drush.site_install)
    execute(behat.init)
54

55
56
57
58
59
60
61
62
63
64
65
66


@task
def update():

    """
    Update the full codebase and run the availabe database updates.
    """

    execute(drush.make, 'update')
    execute(drush.updatedb)
    execute(behat.init)
67

68
69
70
71
72
73
74

@task
def release():

    """
    Generate all artefacts related to a release process or a deployment process.
    """
75

76
    execute(drush.archive_dump)
77
    execute(drush.gen_doc)
Emmanuel Milou's avatar
Emmanuel Milou committed
78
79
80
81
82
83
84
85


@task
def deploy(environment):
    """Deploy code and run database updates on a target Drupal environment.
    """

    execute(provision, environment)
86
87
    execute(push, environment, hosts=env.hosts)
    execute(migrate, environment, hosts=env.hosts)