Skip to content

Commit 7dd0ddf

Browse files
committed
updating to new plugin api
1 parent 8ba6ef4 commit 7dd0ddf

File tree

8 files changed

+4624
-38
lines changed

8 files changed

+4624
-38
lines changed

config/config.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<select ng-model="config.test">
2+
<option value="py.test">py.test</option>
3+
<option value="make test">make test</option>
4+
<option value="./setup.py test">./setup.py test</option>
5+
<option value="none">No test command</option>
6+
</select>
7+
<p class="help-text">
8+
Select which command should be used to test your
9+
project. Alternatively, select "none" if you are going to test using
10+
some other plugin.
11+
</p>

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
"strider",
1414
"python"
1515
],
16+
"strider": {
17+
"type": "job",
18+
"id": "python",
19+
"title": "Python",
20+
"webapp": "webapp.js",
21+
"worker":"worker.js",
22+
"icon": "icon.png",
23+
"config": true
24+
},
1625
"author": "Niall O'Higgins",
1726
"license": "BSD"
1827
}

static/icon.png

1.7 KB
Loading

static/python-powered-w.svg

Lines changed: 4571 additions & 0 deletions
Loading

strider.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

thirdparty/virtualenv.py

100644100755
File mode changed.

webapp.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
module.exports = {
3+
config: {
4+
/* we don't support this yet
5+
runtime: {
6+
type: String,
7+
enum: ['2.6', '2.7', '3.3', 'whatever']
8+
},
9+
*/
10+
test: {
11+
type: String,
12+
enum: ['none', 'py.test', './setup.py test', 'make test'],
13+
default: 'py.test'
14+
}
15+
}
16+
}

worker.js

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
11
var path = require('path')
22

3-
// We include a copy of the virtualenv script
4-
var VIRTUAL_ENV_PY = path.join(__dirname, "thirdparty", "virtualenv.py")
5-
// Virtual environment will be under this directory name in the project dir
6-
var VIRTUAL_ENV_DIR = "venv"
7-
// Command to create the virtual env
8-
var VIRTUAL_ENV_CMD = "python " + VIRTUAL_ENV_PY + " " + VIRTUAL_ENV_DIR
9-
var VIRTUAL_PYTHON = path.join(VIRTUAL_ENV_DIR, "bin", "python")
10-
var VIRTUAL_PIP = path.join(VIRTUAL_ENV_DIR, "bin", "pip")
11-
12-
module.exports = function(ctx, cb) {
13-
14-
var CREATE_VIRTUAL_ENV = VIRTUAL_ENV_CMD + " && " + VIRTUAL_PIP + " install -r requirements.txt"
15-
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-
})
24-
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",
32-
})
33-
34-
35-
console.log("strider-python extension loaded")
36-
cb(null, null)
37-
3+
module.exports = {
4+
init: function (config, job, context, done) {
5+
var venvDir = path.join(context.dataDir, '.venv')
6+
done(null, {
7+
path: [path.join(__dirname, 'thirdparty'),
8+
path.join(venvDir, 'bin')],
9+
environment: 'virtualenv.py ' + venvDir,
10+
prepare: 'pip install -r requirements.txt',
11+
test: config.test !== 'none' ? config.test : undefined
12+
})
13+
},
14+
autodetect: {
15+
filename: 'requirements.txt',
16+
exists: true,
17+
language: 'python',
18+
framework: null
19+
}
3820
}

0 commit comments

Comments
 (0)