blob: d95d62b43f3c2feba84e8d83611919c731a4f057 (
plain) (
blame)
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
|
import os
import shutil
from unit.applications.proto import TestApplicationProto
from unit.option import option
from unit.utils import public_dir
class TestApplicationRuby(TestApplicationProto):
application_type = "ruby"
def prepare_env(self, script):
shutil.copytree(
option.test_dir + '/ruby/' + script,
option.temp_dir + '/ruby/' + script
)
public_dir(option.temp_dir + '/ruby/' + script)
def load(self, script, name='config.ru', **kwargs):
self.prepare_env(script)
script_path = option.temp_dir + '/ruby/' + script
self._load_conf(
{
"listeners": {"*:7080": {"pass": "applications/" + script}},
"applications": {
script: {
"type": self.get_application_type(),
"processes": {"spare": 0},
"working_directory": script_path,
"script": script_path + '/' + name,
}
},
},
**kwargs
)
|