forked from Strider-CD/strider-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
47 lines (38 loc) · 1.27 KB
/
worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var path = require('path')
// We include a copy of the virtualenv script
var VIRTUAL_ENV_PY = path.join(__dirname, "thirdparty", "virtualenv.py")
// Virtual environment will be under this directory name in the project dir
var VIRTUAL_ENV_DIR = "venv"
// Command to create the virtual env
var VIRTUAL_ENV_CMD = "python " + VIRTUAL_ENV_PY + " " + VIRTUAL_ENV_DIR
var VIRTUAL_PYTHON = path.join(VIRTUAL_ENV_DIR, "bin", "python")
var VIRTUAL_PIP = path.join(VIRTUAL_ENV_DIR, "bin", "pip")
module.exports = function(ctx, cb) {
var CREATE_VIRTUAL_ENV = VIRTUAL_ENV_CMD + " && " + VIRTUAL_PIP + " install -r requirements.txt"
ctx.addDetectionRule({
filename:"setup.py",
grep:/pyramid/i,
language:"python",
framework:"pyramid",
prepare:CREATE_VIRTUAL_ENV,
test:VIRTUAL_PYTHON + " setup.py test",
})
ctx.addDetectionRule({
filename:"manage.py",
grep:/django/i,
language:"python",
framework:"django",
prepare:CREATE_VIRTUAL_ENV,
test:VIRTUAL_PYTHON + " manage.py harvest --no-server",
})
ctx.addDetectionRule({
filename:"setup.py",
exists:true,
language:"python",
framework:null,
prepare:CREATE_VIRTUAL_ENV,
test:VIRTUAL_PYTHON + " setup.py test",
})
console.log("strider-python extension loaded")
cb(null, null)
}