This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpackage.py
52 lines (48 loc) · 1.54 KB
/
package.py
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
48
49
50
51
52
from Jumpscale import j
class Package(j.baseclasses.threebot_package):
"""
to start need to run
kosmos -p
JSX> cl = j.servers.threebot.local_start_zerobot_default()
JSX> cl.actors.package_manager.package_add(git_url="https://github.com/Incubaid/www_incubaid/")
"""
def _init(self, **kwargs):
self.branch = kwargs["package"].branch or "master"
self.incubaid = "https://github.com/Incubaid/www_incubaid"
def prepare(self):
"""
called when the 3bot starts
:return:
"""
server = self.openresty
server.install(reset=True)
server.configure()
website = server.get_from_port(8083)
locations = website.locations.get("incubaid_locations")
static_location = locations.locations_static.new()
static_location.name = "static"
static_location.path_url = "/"
path = j.clients.git.getContentPathFromURLorPath(self.incubaid, branch=self.branch, pull=True)
static_location.path_location = path
static_location.use_jumpscale_weblibs = True
website.path = path
locations.configure()
website.configure()
def start(self):
"""
called when the 3bot starts
:return:
"""
self.prepare()
def stop(self):
"""
called when the 3bot stops
:return:
"""
pass
def uninstall(self):
"""
called when the package is no longer needed and will be removed from the threebot
:return:
"""
pass