Completed
Branch master (680841)
by Antoine
54s
created

devops/deploy/prod.js   A

Complexity

Total Complexity 9
Complexity/F 1.29

Size

Lines of Code 46
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 0
wmc 9
c 2
b 0
f 0
nc 1
mnd 1
bc 10
fnc 7
dl 0
loc 46
rs 10
bpm 1.4285
cpm 1.2857
noi 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
    if(shipit.config.hasDatabase){
32
      var tasks = ['installVendors', 'upgradeDatabase', 'restartServer']
33
    } else {
34
      var tasks = ['installVendors', 'restartServer']
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable tasks already seems to be declared on line 32. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
35
    }
36
    shipit.start(tasks, function(err) {
37
      if(!err){
38
        shipit.log('Install done!');
39
      }
40
    })
41
  });
42
43
  shipit.on('updated', function() {
44
      return shipit.start('initVirtualenv');
45
  });
46
};
47