Completed
Push — master ( 680841...415925 )
by Antoine
55s
created

module.exports   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 47
rs 9.0303
nop 1

5 Functions

Rating   Name   Duplication   Size   Complexity  
A 0 7 1
A 0 10 1
A 0 13 2
A 0 8 1
A 0 3 1
1
module.exports = function (shipit) {
2
  shipit.blTask('initVirtualenv', function() {
3
    return shipit.remote(
4
      "cd " + shipit.releasePath +
5
      " && virtualenv venv -p /usr/bin/python3" +
6
      " && source venv/bin/activate" +
7
      " && pip install --upgrade pip"
8
    );
9
  });
10
11
  shipit.blTask('installVendors', function() {
12
    return shipit.remote(
13
      "cd " + shipit.currentPath +
14
      " && source venv/bin/activate" +
15
      " && pip install --find-links=~/wheels -r requirements.txt --upgrade"
16
    );
17
  });
18
19
  shipit.blTask('upgradeDatabase', function() {
20
    return shipit.remote(
21
      "cd " + shipit.currentPath +
22
      " && source venv/bin/activate" +
23
      " && set -a && source " + shipit.config.deployTo + "/password.conf" +
24
      " && export PYTHONPATH=src" +
25
      " && cd " + shipit.currentPath +
26
      " && python3 src/manage.py db upgrade"
27
    );
28
  });
29
30
  shipit.blTask('install', function() {
31
    var tasks
32
    if(shipit.config.hasDatabase){
33
      tasks = ['installVendors', 'upgradeDatabase', 'restartServer']
34
    } else {
35
      tasks = ['installVendors', 'restartServer']
36
    }
37
    shipit.start(tasks, function(err) {
38
      if(!err){
39
        shipit.log('Install done!');
40
      }
41
    })
42
  });
43
44
  shipit.on('updated', function() {
45
      return shipit.start('initVirtualenv');
46
  });
47
};
48