greenservicemgr 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8091263fd3d05bde1a9fcd652fc2a09034a6efa55b660c467766fced7d93f8f1
4
+ data.tar.gz: 1879c8516bd05302a5236b211745acc5391d4bf5ad3a1edd962946359904a2ac
5
+ SHA512:
6
+ metadata.gz: 1b943c7956a08d52688380bcb1fafc66d5e1b983f2b6cca3db937acf611e5dcd37feb7cb190b03798bb60cd22a23b9d46c150d9cfa8cf2c0e18bb3210d0e76e9
7
+ data.tar.gz: 1ba6a47bca56d4484e5c80a718de6cf043ac592b3994311ea45ee9dac4733df3cfc738dbcc86fcd8bb079d6c2a440c135b200c3e95d896d7dbcf527115268db7
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ ���{�КjI�Ԩsof�����i���'������Mm�X�-��̉ bޥ�ܭ�ᓎ�6r���Sv~���5�a���€ �b�q�D�����{z�r��YU��$<�1h
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: greenservicemgr.rb
4
+ # description: Intended for running within a Docker container to control daemonised GoGreen services.
5
+
6
+ require 'onedrb'
7
+
8
+
9
+ class Server
10
+
11
+ def initialize(services=[])
12
+
13
+ @services = services
14
+
15
+ end
16
+
17
+ def services()
18
+ @services
19
+ end
20
+
21
+ def status_list()
22
+
23
+ h = @services.map do |x|
24
+
25
+ file = x + '_control.rb'
26
+ if File.exists? file
27
+ r = `ruby #{file} status`
28
+ [x.to_sym, r =~ /running \[pid/ ? :running : nil]
29
+ else
30
+ nil
31
+ end
32
+
33
+ end.compact.to_h
34
+ end
35
+
36
+ def run(service)
37
+
38
+ return unless @services.include? service.to_s
39
+ filename = service.to_s + '_control.rb'
40
+ if File.exists? filename then
41
+ `ruby #{filename} start`
42
+ 'running service ' + service
43
+ else
44
+ 'service not found'
45
+ end
46
+
47
+ end
48
+
49
+ alias start run
50
+
51
+ def status(service)
52
+
53
+ return unless @services.include? service.to_s
54
+ filename = service.to_s + '_control.rb'
55
+
56
+ if File.exists? filename then
57
+ `ruby #{filename} status`
58
+ else
59
+ 'service not found'
60
+ end
61
+
62
+ end
63
+
64
+ def stop(service)
65
+
66
+ return unless @services.include? service.to_s
67
+ filename = service.to_s + '_control.rb'
68
+
69
+ if File.exists? filename then
70
+ `ruby #{filename} stop`
71
+ 'stopping service ' + service
72
+ else
73
+ 'service not found'
74
+ end
75
+
76
+ end
77
+
78
+ end
79
+
80
+ class GreenServerMgr
81
+
82
+ def initialize(host: '127.0.0.1', port: '57900', services: [])
83
+ @server = OneDrb::Server.new host: host, port: port, obj: Server.new(services)
84
+ end
85
+
86
+ def start()
87
+ @server.start
88
+ end
89
+ end
90
+
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: greenservicemgr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEljCCAv6gAwIBAgIBATANBgkqhkiG9w0BAQsFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTIyMDYyMzE1MjA0NloXDTIzMDYyMzE1MjA0NlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoC
18
+ ggGBAMcWqFX2fbgXsxPUYzfI93YejL+aU9JwHfbhElZk/vc6cE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zymwxtmkSNJBJ/EsPuxTrcVUOg/BMbbA9lQz/675yvv
35
+ za+q4KbHKGUPUQ+Swp7Q8dUJCpp+ZzOABLyaDvE1L3gNiZhOOIFnCUWuAjMzyOKw
36
+ cwjKQ9T6d5Umg7aopLSqdMsnaWrQF41AaNV+Lcii/nWYlz2Y9hW7/6bkPni4OJ+p
37
+ UOaPG0I6jR1JSfsHvvnE3QTSyARAjc6o4X4=
38
+ -----END CERTIFICATE-----
39
+ date: 2022-06-23 00:00:00.000000000 Z
40
+ dependencies:
41
+ - !ruby/object:Gem::Dependency
42
+ name: onedrb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.4'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.4.1
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '0.4'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.4.1
61
+ description:
62
+ email: digital.robertson@gmail.com
63
+ executables: []
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - lib/greenservicemgr.rb
68
+ homepage: https://github.com/jrobertson/greenservicemgr
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubygems_version: 3.3.7
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: greenservicemgr
91
+ test_files: []
metadata.gz.sig ADDED
Binary file