app-mgr 0.2.6 → 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 +86 -82
- data.tar.gz.sig +0 -0
- metadata +54 -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
@@ -1,122 +1,126 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
# file: app-mgr.rb
|
4
|
+
|
5
|
+
require 'rscript'
|
6
|
+
|
7
|
+
class Runner
|
8
|
+
def run(s)
|
9
|
+
eval(s)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
4
14
|
class AppMgr
|
5
|
-
|
15
|
+
|
16
|
+
def initialize(rsf: nil, type: 'app', debug: false)
|
17
|
+
|
18
|
+
@rsf, @type, @debug = rsf, type, debug
|
19
|
+
@rscript = RScript.new(type: type, cache: nil, debug: debug)
|
6
20
|
@app = {}
|
7
|
-
@content_type = 'text/xml'
|
8
|
-
super()
|
9
|
-
end
|
10
21
|
|
11
|
-
|
12
|
-
o = {name: '', object: nil, config: {}, public: {}}.merge!(opt)
|
22
|
+
load_all(rsf)
|
13
23
|
|
14
|
-
key, name = o.shift
|
15
|
-
@app[name] = o
|
16
|
-
"'%s' loaded" % name
|
17
24
|
end
|
18
25
|
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
app[:running] = app[:object].new(options, self)
|
26
|
+
def [](name)
|
27
|
+
|
28
|
+
app = @app[name.to_sym]
|
29
|
+
|
30
|
+
return app[:running] if app and app[:running]
|
25
31
|
|
26
|
-
return "'%s' running ..." % app_name
|
27
|
-
else
|
28
|
-
return "app %s not available" % app_name
|
29
|
-
end
|
30
32
|
end
|
31
|
-
|
32
|
-
def
|
33
|
-
|
34
|
-
if app and app[:running] then
|
35
|
-
yield(app[:public])
|
36
|
-
else
|
37
|
-
return "app %s not running" % app_name
|
38
|
-
end
|
33
|
+
|
34
|
+
def available()
|
35
|
+
@app.keys
|
39
36
|
end
|
40
|
-
|
41
|
-
def
|
42
|
-
|
37
|
+
|
38
|
+
def restart(name)
|
39
|
+
load_app(name)
|
40
|
+
run(name)
|
41
|
+
name.to_s + ' restarted'
|
43
42
|
end
|
44
43
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
def run(name)
|
45
|
+
|
46
|
+
app = @app[name.to_sym]
|
47
|
+
|
48
|
+
#app[:running] = eval(app[:code])
|
49
|
+
app[:running] = Runner.new.run(app[:code])
|
50
|
+
|
51
51
|
end
|
52
52
|
|
53
53
|
def running()
|
54
54
|
@app.select {|k,v| v[:running]}.keys
|
55
55
|
end
|
56
56
|
|
57
|
-
def running?(
|
58
|
-
@app[
|
59
|
-
end
|
60
|
-
|
61
|
-
def available()
|
62
|
-
@app.select {|k,v| v[:available] == true}.keys
|
57
|
+
def running?(name)
|
58
|
+
@app[name.to_sym][:running] ? true : false
|
63
59
|
end
|
64
60
|
|
65
|
-
def unload(app_name)
|
66
61
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
return "app %s
|
62
|
+
def stop(name)
|
63
|
+
|
64
|
+
app = @app[name.to_sym]
|
65
|
+
|
66
|
+
if app.delete(:running) then
|
67
|
+
return "app %s stopped" % name
|
73
68
|
else
|
74
|
-
return "couldn't find app %s" %
|
69
|
+
return "couldn't find app %s" % name
|
75
70
|
end
|
71
|
+
|
76
72
|
end
|
77
73
|
|
78
|
-
def
|
79
|
-
|
80
|
-
|
81
|
-
|
74
|
+
def unload(name)
|
75
|
+
|
76
|
+
app = @app[name.to_sym]
|
77
|
+
|
78
|
+
if class_name then
|
79
|
+
|
80
|
+
@app.delete name.to_sym
|
81
|
+
return "app %s unloaded" % name
|
82
|
+
|
82
83
|
else
|
83
|
-
return "app %s
|
84
|
+
return "couldn't find app %s" % name
|
84
85
|
end
|
86
|
+
|
85
87
|
end
|
86
88
|
|
87
|
-
|
88
|
-
def run_projectx(project_name, method_name, qparams=[])
|
89
|
+
private
|
89
90
|
|
90
|
-
|
91
|
-
xml_project = project = "<project name='%s'><methods><method name='%s'>%s</method></methods></project>" % [project_name, method_name, params]
|
92
|
-
projectx_handler(xml_project)
|
93
|
-
end
|
94
|
-
|
95
|
-
def projectx_handler(xml_project)
|
96
|
-
out = ''
|
97
|
-
doc = Document.new(xml_project)
|
98
|
-
project_name = doc.root.attribute('name').to_s
|
91
|
+
def load_all(rsf_package)
|
99
92
|
|
100
|
-
|
93
|
+
@rscript.jobs(rsf_package).each do |app_name|
|
101
94
|
|
102
|
-
|
103
|
-
methodx = node_method.attributes.get_attribute('name').to_s
|
104
|
-
params = node_method.elements['params'].to_s
|
95
|
+
puts 'app_name: ' + app_name.inspect if @debug
|
105
96
|
|
106
|
-
|
107
|
-
|
108
|
-
|
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])
|
109
110
|
|
110
|
-
out = out.first if out.length == 1
|
111
|
-
else
|
112
|
-
out = "that project doesn't exist"
|
113
111
|
end
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
+
|
119
|
+
puts 'codeblock: ' + codeblock.inspect if @debug
|
120
|
+
@app[name][:code] = codeblock
|
121
|
+
return @app[name]
|
122
|
+
end
|
123
|
+
|
118
124
|
end
|
119
125
|
|
120
|
-
|
121
126
|
end
|
122
|
-
|
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,29 +10,55 @@ 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
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
Y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ER/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
|
31
37
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
33
|
-
dependencies:
|
38
|
+
date: 2022-04-24 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: rscript
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.9'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.9.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.9'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.9.0
|
34
60
|
description:
|
35
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
36
62
|
executables: []
|
37
63
|
extensions: []
|
38
64
|
extra_rdoc_files: []
|
@@ -48,18 +74,18 @@ require_paths:
|
|
48
74
|
- lib
|
49
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
76
|
requirements:
|
51
|
-
- -
|
77
|
+
- - ">="
|
52
78
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
79
|
+
version: 2.1.2
|
54
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
81
|
requirements:
|
56
|
-
- -
|
82
|
+
- - ">="
|
57
83
|
- !ruby/object:Gem::Version
|
58
84
|
version: '0'
|
59
85
|
requirements: []
|
60
|
-
|
61
|
-
rubygems_version: 2.0.0.rc.2
|
86
|
+
rubygems_version: 3.2.22
|
62
87
|
signing_key:
|
63
88
|
specification_version: 4
|
64
|
-
summary:
|
89
|
+
summary: Runs 1 or more headless apps from a kind of XML file for use in a back-end
|
90
|
+
server
|
65
91
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|