Skip to content

Commit 3fc0472

Browse files
author
Niall O'Higgins
committed
update for strider 1.4.x compatibility.
now depends on strider-detection-rules module.
1 parent 8ba6ef4 commit 3fc0472

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strider-python",
3-
"version": "0.0.3",
3+
"version": "0.1.0",
44
"description": "Python/Pyramid/Django support for Strider Continuous Deployment",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1"
@@ -14,5 +14,8 @@
1414
"python"
1515
],
1616
"author": "Niall O'Higgins",
17-
"license": "BSD"
17+
"license": "BSD",
18+
"dependencies": {
19+
"strider-detection-rules": "0.0.1"
20+
}
1821
}

worker.js

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var detect = require('strider-detection-rules')
12
var path = require('path')
23

34
// We include a copy of the virtualenv script
@@ -8,30 +9,40 @@ var VIRTUAL_ENV_DIR = "venv"
89
var VIRTUAL_ENV_CMD = "python " + VIRTUAL_ENV_PY + " " + VIRTUAL_ENV_DIR
910
var VIRTUAL_PYTHON = path.join(VIRTUAL_ENV_DIR, "bin", "python")
1011
var VIRTUAL_PIP = path.join(VIRTUAL_ENV_DIR, "bin", "pip")
12+
var CREATE_VIRTUAL_ENV = VIRTUAL_ENV_CMD + " && " + VIRTUAL_PIP + " install -r requirements.txt"
13+
14+
var RULES = [{
15+
filename:"manage.py",
16+
grep:/django/i,
17+
language:"python",
18+
framework:"django",
19+
prepare:CREATE_VIRTUAL_ENV,
20+
test:VIRTUAL_PYTHON + " manage.py test",
21+
}, {
22+
filename:"setup.py",
23+
exists:true,
24+
language:"python",
25+
framework:null,
26+
prepare:CREATE_VIRTUAL_ENV,
27+
test:VIRTUAL_PYTHON + " setup.py test",
28+
}]
29+
1130

1231
module.exports = function(ctx, cb) {
1332

14-
var CREATE_VIRTUAL_ENV = VIRTUAL_ENV_CMD + " && " + VIRTUAL_PIP + " install -r requirements.txt"
33+
function doTest(ctx , cb){
34+
detect(RULES, "test", ctx, cb)
35+
}
1536

16-
ctx.addDetectionRule({
17-
filename:"manage.py",
18-
grep:/django/i,
19-
language:"python",
20-
framework:"django",
21-
prepare:CREATE_VIRTUAL_ENV,
22-
test:VIRTUAL_PYTHON + " manage.py test",
23-
})
37+
function doPrepare(ctx, cb) {
38+
detect(RULES, "prepare", ctx, cb)
39+
}
2440

25-
ctx.addDetectionRule({
26-
filename:"setup.py",
27-
exists:true,
28-
language:"python",
29-
framework:null,
30-
prepare:CREATE_VIRTUAL_ENV,
31-
test:VIRTUAL_PYTHON + " setup.py test",
41+
ctx.addBuildHook({
42+
test: doTest,
43+
prepare: doPrepare,
3244
})
3345

34-
3546
console.log("strider-python extension loaded")
3647
cb(null, null)
3748

0 commit comments

Comments
 (0)