Skip to content

Commit 41ad901

Browse files
author
Ilya Radchenko
committed
Remove unused require, cleanup
1 parent abfd8e0 commit 41ad901

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

worker.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,57 @@
1-
var detect = require('strider-detection-rules')
2-
var fs = require('fs')
3-
var path = require('path')
1+
'use strict';
2+
3+
var fs = require('fs');
4+
var path = require('path');
45

56
function shellCommand(command) {
6-
if (!command || !command.replace(/#[^\n]*/g, '').trim().length) return
7+
if (!command || !command.replace(/#[^\n]*/g, '').trim().length) {
8+
return;
9+
}
10+
711
return {
812
command: 'sh',
913
args: ['-x', '-c', command]
10-
}
14+
};
1115
}
1216

1317
module.exports = {
1418
init: function (config, job, context, done) {
15-
var venvDir = path.join(context.baseDir, '.venv')
16-
var test = undefined
19+
var venvDir = path.join(context.baseDir, '.venv');
20+
var test;
21+
1722
if (config && config.test !== 'none') {
1823
test = config.test
1924
}
25+
2026
var defaultPrepare = function (context, done) {
2127
if (!fs.existsSync(path.join(context.dataDir, 'requirements.txt'))) {
2228
// skip if default and no requirements.txt exists
2329
// we assume that if you're configuring your own, you'll ensure the file exists
24-
return done(null, true)
30+
return done(null, true);
2531
}
26-
context.cmd("pip install -r requirements.txt", function (err) {
27-
done(err, true)
28-
})
32+
33+
context.cmd('pip install -r requirements.txt', function (err) {
34+
done(err, true);
35+
});
2936
}
30-
var prepare = defaultPrepare
37+
38+
var prepare = defaultPrepare;
39+
3140
if (config && config.prepare) {
32-
prepare = shellCommand(config.prepare)
41+
prepare = shellCommand(config.prepare);
3342
}
43+
3444
done(null, {
3545
path: [path.join(venvDir, 'bin')],
3646
environment: 'virtualenv ' + venvDir,
3747
prepare: prepare,
3848
test: test
39-
})
49+
});
4050
},
4151
autodetect: {
4252
filename: 'requirements.txt',
4353
exists: true,
4454
language: 'python',
4555
framework: null
4656
}
47-
}
57+
};

0 commit comments

Comments
 (0)