app-mgr 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/app-mgr.rb +56 -41
- data.tar.gz.sig +0 -0
- metadata +32 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3230c5bba90440fdeef08992f6f099f6d5fd452c05d907e9fbd42ab346f1355e
|
4
|
+
data.tar.gz: 01a8d05fcc809791b44492403ced88a59a22e4538fcf5d55c6d3c4d344505dab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8baeb4e49782dfe2764bdf124e04db1b7559276e73c41b0df73a6b1ed1e0ff9a3afc9e03156341193fe934bdd228713718feffd0771176025cc453ff304d23c
|
7
|
+
data.tar.gz: 1b5c292f4f4a7b688c96c2abdccb3c6c15c5e26cb06211f889825a91aaf516b1778b223bf3a32be876abbe74dfb48bf2efa44f0f43b773ffadc7a2daa805eca4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/app-mgr.rb
CHANGED
@@ -4,41 +4,49 @@
|
|
4
4
|
|
5
5
|
require 'rscript'
|
6
6
|
|
7
|
+
class Runner
|
8
|
+
def run(s)
|
9
|
+
eval(s)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
|
8
14
|
class AppMgr
|
9
15
|
|
10
|
-
|
16
|
+
def initialize(rsf: nil, type: 'app', debug: false)
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
@rsf, @reg, @rsc, @debug = rsf, reg, rsc, debug
|
15
|
-
@rscript = RScript.new(type: 'app', debug: debug)
|
18
|
+
@rsf, @type, @debug = rsf, type, debug
|
19
|
+
@rscript = RScript.new(type: type, cache: nil, debug: debug)
|
16
20
|
@app = {}
|
17
21
|
|
18
22
|
load_all(rsf)
|
19
|
-
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def [](name)
|
27
|
+
|
28
|
+
app = @app[name.to_sym]
|
29
|
+
|
30
|
+
return app[:running] if app and app[:running]
|
31
|
+
|
20
32
|
end
|
21
33
|
|
22
34
|
def available()
|
23
35
|
@app.keys
|
24
36
|
end
|
25
|
-
|
26
|
-
def call(app_name)
|
27
|
-
|
28
|
-
run(app_name) unless running? app_name
|
29
|
-
@app[app_name.to_sym][:running].call
|
30
|
-
|
31
|
-
end
|
32
37
|
|
33
|
-
def
|
34
|
-
|
38
|
+
def restart(name)
|
39
|
+
load_app(name)
|
40
|
+
run(name)
|
41
|
+
name.to_s + ' restarted'
|
35
42
|
end
|
36
43
|
|
37
44
|
def run(name)
|
38
45
|
|
39
46
|
app = @app[name.to_sym]
|
40
|
-
|
41
|
-
app[:running] = eval(
|
47
|
+
|
48
|
+
#app[:running] = eval(app[:code])
|
49
|
+
app[:running] = Runner.new.run(app[:code])
|
42
50
|
|
43
51
|
end
|
44
52
|
|
@@ -48,20 +56,9 @@ class AppMgr
|
|
48
56
|
|
49
57
|
def running?(name)
|
50
58
|
@app[name.to_sym][:running] ? true : false
|
51
|
-
end
|
52
|
-
|
53
|
-
def connect(name)
|
54
|
-
|
55
|
-
app = @app[name.to_sym]
|
56
|
-
|
57
|
-
if app and app[:running] then
|
58
|
-
yield(app[:running])
|
59
|
-
else
|
60
|
-
return "app %s not running" % name
|
61
|
-
end
|
62
|
-
|
63
59
|
end
|
64
60
|
|
61
|
+
|
65
62
|
def stop(name)
|
66
63
|
|
67
64
|
app = @app[name.to_sym]
|
@@ -71,21 +68,22 @@ class AppMgr
|
|
71
68
|
else
|
72
69
|
return "couldn't find app %s" % name
|
73
70
|
end
|
74
|
-
|
71
|
+
|
75
72
|
end
|
76
73
|
|
77
74
|
def unload(name)
|
78
75
|
|
79
|
-
|
80
|
-
|
76
|
+
app = @app[name.to_sym]
|
77
|
+
|
81
78
|
if class_name then
|
82
|
-
|
79
|
+
|
83
80
|
@app.delete name.to_sym
|
84
81
|
return "app %s unloaded" % name
|
82
|
+
|
85
83
|
else
|
86
84
|
return "couldn't find app %s" % name
|
87
85
|
end
|
88
|
-
|
86
|
+
|
89
87
|
end
|
90
88
|
|
91
89
|
private
|
@@ -95,15 +93,32 @@ class AppMgr
|
|
95
93
|
@rscript.jobs(rsf_package).each do |app_name|
|
96
94
|
|
97
95
|
puts 'app_name: ' + app_name.inspect if @debug
|
98
|
-
app = @app[app_name] = {}
|
99
96
|
|
100
|
-
|
97
|
+
@app[app_name] = {}
|
98
|
+
codeblock, _, attr = @rscript.read(["//#{@type}:" + app_name.to_s, @rsf])
|
99
|
+
|
100
|
+
next if attr[:disabled] == 'true'
|
101
|
+
|
102
|
+
puts 'codeblock: ' + codeblock.inspect if @debug
|
103
|
+
@app[app_name][:code] = codeblock
|
104
|
+
app = @app[app_name]
|
105
|
+
|
106
|
+
puts 'app: ' + app.inspect
|
107
|
+
next unless app
|
108
|
+
|
109
|
+
app[:running] = Runner.new.run(app[:code])
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
def load_app(name)
|
114
|
+
|
115
|
+
codeblock, _, attr = @rscript.read(["//#{@type}:" + name.to_s, @rsf])
|
116
|
+
|
117
|
+
return if attr[:disabled] == 'true'
|
118
|
+
|
101
119
|
puts 'codeblock: ' + codeblock.inspect if @debug
|
102
|
-
app[:code] = codeblock
|
103
|
-
|
104
|
-
reg, rsc = @reg, @rsc
|
105
|
-
eval codeblock
|
106
|
-
|
120
|
+
@app[name][:code] = codeblock
|
121
|
+
return @app[name]
|
107
122
|
end
|
108
123
|
|
109
124
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app-mgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwNDI0MTg0NTMyWhcN
|
15
|
+
MjMwNDI0MTg0NTMyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCy/bQ6
|
17
|
+
+zlVxMZ2dkNjN6NXcSHGDXRkBUpQ15ARwQ7Nwe86H/I3ZXCsf91xZNn2oMbhXjSj
|
18
|
+
wJjbbORibZHQcnJxU7lIJuL0W0HuJEBVPNstUJhEkkXPGRxEDIPIUSrcdGkFdm5z
|
19
|
+
IWTmVskKJ9WKA3mc3vMnKIndtA1EI/9k4Pct1FVcJZ9lFy+MGlfc2NbpMwZfihnH
|
20
|
+
3NsbO80cBo4E1ub+fHnUyED2rHfKAAJJ1Uowaln+WyrKYgSSgCqOwYqsh5UtYm8Z
|
21
|
+
9w19nxDg8tq8J/+aifcjPsFna0JFh/aEeMnJiFVzTYIMdcIp9vEplveZgLHBCvtn
|
22
|
+
2N8Kj7cl92D3yvKupBK25UOmx4wj0dpz0NHJ0cKLJBybXgQhjEJ2cqRik3yWJK3J
|
23
|
+
XzugEbXBhldh4snctFFfBQj2+pNcxkoX3/64LRgrn1E8UDGIssTfsS91+rYQaOpu
|
24
|
+
oTenkdBjj43qszBmsgn5MLXO5vsu6NUCcZPWFSgCPR0/vYo+WEmDFsBoRIMCAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU8sSS1sEw
|
26
|
+
5ZV4fz5YY66FFiqV4lkwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAsfATj4aER/l+5WpvQRcLkEHBSrlcRvgDkK7geiP5
|
29
|
+
lzDVU06ndUwBszXoiGbO1oqvSPQYlGY9B5ITqsUY/pEcvSXw6sJ0IrUrGgze25Ha
|
30
|
+
sMc5EKYXjTD01FTGyzbsEeijUKT3AMKREOv+htuPxtorHjvZFqG/XQVKITb0SjF9
|
31
|
+
Eu8CSq9tXwpS/H7g2NPR3BWOgpRtaBmqtmN6u5Xpx53YX7EfUIOCAEdjbLH83ewU
|
32
|
+
o1qWubtMwnFvZzEd7AhASE6zMevhN/x6Y+e8D6YDzIgEmh0N8BD6IjYggzq2T8iE
|
33
|
+
Z1siRlr4sgUZd8mLi0o2nG+zqq/9DkV3S7rygERkGccM+tAsakwl0wKIyHJYibNM
|
34
|
+
F0SeCKO+Jsn433fz0woyhqdSpuOEEL88twKvwzHS1gzV2RRIy/db8PRsrjsaNhy3
|
35
|
+
8W1C1GMiIJ0XiC7HJfZ9gdjiGK6QbbiqPhA0yRtNjQJWU1id4Nn7ZkaMvjc56Zto
|
36
|
+
wgl6kIb23YwRPlLR4VAcERqL
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2022-04-24 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: rscript
|
@@ -38,22 +43,22 @@ dependencies:
|
|
38
43
|
requirements:
|
39
44
|
- - "~>"
|
40
45
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0.
|
46
|
+
version: '0.9'
|
42
47
|
- - ">="
|
43
48
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.
|
49
|
+
version: 0.9.0
|
45
50
|
type: :runtime
|
46
51
|
prerelease: false
|
47
52
|
version_requirements: !ruby/object:Gem::Requirement
|
48
53
|
requirements:
|
49
54
|
- - "~>"
|
50
55
|
- !ruby/object:Gem::Version
|
51
|
-
version: '0.
|
56
|
+
version: '0.9'
|
52
57
|
- - ">="
|
53
58
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
59
|
+
version: 0.9.0
|
55
60
|
description:
|
56
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
57
62
|
executables: []
|
58
63
|
extensions: []
|
59
64
|
extra_rdoc_files: []
|
@@ -78,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
83
|
- !ruby/object:Gem::Version
|
79
84
|
version: '0'
|
80
85
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.6.13
|
86
|
+
rubygems_version: 3.2.22
|
83
87
|
signing_key:
|
84
88
|
specification_version: 4
|
85
89
|
summary: Runs 1 or more headless apps from a kind of XML file for use in a back-end
|
metadata.gz.sig
CHANGED
Binary file
|