razorrisk-cassini-utilities-cassis 0.7.6
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 +7 -0
- data/bin/razorrisk-cassini-configure +743 -0
- data/lib/razor_risk/cassini/utilities/cassis/configuration_generator.rb +274 -0
- data/lib/razor_risk/cassini/utilities/cassis/constants.rb +41 -0
- data/lib/razor_risk/cassini/utilities/cassis/internal/require/pantheios.rb +16 -0
- data/lib/razor_risk/cassini/utilities/cassis/internal/require/xqsr3/quality/parameter_checking.rb +16 -0
- data/lib/razor_risk/cassini/utilities/cassis/program_utils.rb +86 -0
- data/lib/razor_risk/cassini/utilities/cassis/version.rb +57 -0
- data/lib/razor_risk/cassini/utilities/cassis/zip_utils.rb +236 -0
- data/lib/razor_risk/cassini/utilities/cassis.rb +6 -0
- data/lib/razor_risk/cassini/utilities/configuration/cli.rb +122 -0
- data/lib/razor_risk/cassini/utilities/configuration.rb +16 -0
- data/lib/razor_risk/cassini/utilities/extensions/hash.rb +44 -0
- data/lib/razor_risk/utilities/software/packaging/unzippers/mac_zip.rb +81 -0
- data/lib/razor_risk/utilities/software/packaging/unzippers/seven_zip.rb +82 -0
- data/lib/razor_risk/utilities/software/packaging/unzippers/win_rar.rb +82 -0
- data/lib/razor_risk/utilities/software/packaging/unzippers/win_zip.rb +83 -0
- metadata +116 -0
@@ -0,0 +1,274 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
# File: razor_risk/cassini/utilities/cassis/configuration_generator.rb
|
5
|
+
#
|
6
|
+
# Purpose: ::RazorRisk::Cassini::Utilities::CassIS::ConfigurationGenerator
|
7
|
+
#
|
8
|
+
# Created: 11th July 2018
|
9
|
+
# Updated: 7th November 2018
|
10
|
+
#
|
11
|
+
# Author: Matthew Wilson
|
12
|
+
#
|
13
|
+
# Copyright (c) 2018, Razor Risk Technologies Pty Ltd
|
14
|
+
# All rights reserved.
|
15
|
+
#
|
16
|
+
# ######################################################################## #
|
17
|
+
|
18
|
+
|
19
|
+
require 'razor_risk/cassini/utilities/cassis/internal/require/pantheios'
|
20
|
+
require 'razor_risk/cassini/utilities/cassis/internal/require/xqsr3/quality/parameter_checking'
|
21
|
+
|
22
|
+
=begin
|
23
|
+
=end
|
24
|
+
|
25
|
+
module RazorRisk
|
26
|
+
module Cassini
|
27
|
+
module Utilities
|
28
|
+
module CassIS
|
29
|
+
|
30
|
+
class ConfigurationGenerator
|
31
|
+
|
32
|
+
include ::Pantheios
|
33
|
+
|
34
|
+
include ::Xqsr3::Quality::ParameterChecking
|
35
|
+
|
36
|
+
module Constants
|
37
|
+
|
38
|
+
TOP_LEVEL_KEYS = %w{ properties cassini control diagnostics razor }
|
39
|
+
|
40
|
+
|
41
|
+
end # module Constants
|
42
|
+
|
43
|
+
class Microservice
|
44
|
+
|
45
|
+
include ::Pantheios
|
46
|
+
|
47
|
+
include ::Xqsr3::Quality::ParameterChecking
|
48
|
+
|
49
|
+
class Route
|
50
|
+
|
51
|
+
include ::Pantheios
|
52
|
+
|
53
|
+
include ::Xqsr3::Quality::ParameterChecking
|
54
|
+
|
55
|
+
def initialize internal, security, verbs
|
56
|
+
|
57
|
+
internal = check_parameter internal, 'internal', type: ::String
|
58
|
+
security = check_parameter security, 'security', types: [ :boolean, ::Symbol ], values: [ false, true, :insecure, :secure, nil ], allow_nil: true
|
59
|
+
verbs = check_parameter verbs, 'verbs', types: [ ::String, ::Symbol, [ ::String, ::Symbol ]]
|
60
|
+
|
61
|
+
verbs = [ verbs ] unless ::Array == verbs
|
62
|
+
|
63
|
+
security =
|
64
|
+
case security
|
65
|
+
when :secure, true
|
66
|
+
|
67
|
+
true
|
68
|
+
when :insecure, false, nil
|
69
|
+
|
70
|
+
false
|
71
|
+
else
|
72
|
+
|
73
|
+
$stderr.puts "unexpected value for security - '#{security}' (of type #{security.class})"
|
74
|
+
end
|
75
|
+
|
76
|
+
@internal = internal
|
77
|
+
@security = security
|
78
|
+
@verbs = verbs
|
79
|
+
end
|
80
|
+
|
81
|
+
attr_reader :internal
|
82
|
+
attr_reader :security
|
83
|
+
attr_reader :verbs
|
84
|
+
|
85
|
+
def to_h
|
86
|
+
|
87
|
+
h = {
|
88
|
+
|
89
|
+
'internal' => internal,
|
90
|
+
'security' => security,
|
91
|
+
'verbs' => verbs.map { |verb| verb.to_s },
|
92
|
+
}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def initialize name, external_route, service_path, routes, **options
|
97
|
+
|
98
|
+
@name = check_parameter name, 'name', type: ::String
|
99
|
+
@external_route = check_parameter external_route, 'external_route', type: ::String, allow_nil: true
|
100
|
+
@service_path = check_parameter service_path, 'service_path', type: ::String, allow_nil: true
|
101
|
+
@routes = check_parameter routes, 'routes', types: [ Route, [ Route ] ]
|
102
|
+
|
103
|
+
@external_route ||= options[:restful] ? "entities/#{@name}" : @name
|
104
|
+
@service_path ||= "bin/razorrisk-microservice-#{name.gsub('_', '-')}"
|
105
|
+
@routes = [ @routes ] if Route === @routes
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
attr_reader :name
|
110
|
+
attr_reader :external_route
|
111
|
+
attr_reader :routes
|
112
|
+
attr_reader :service_path
|
113
|
+
|
114
|
+
def to_h
|
115
|
+
|
116
|
+
routes_u = routes.uniq { |r| "#{r.internal}:#{r.verbs}" }
|
117
|
+
|
118
|
+
h = {
|
119
|
+
|
120
|
+
'external_route' => external_route,
|
121
|
+
'routes' => routes_u.map { |route| route.to_h },
|
122
|
+
'service_path' => service_path,
|
123
|
+
}
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
# === Signature
|
129
|
+
#
|
130
|
+
# * *Options:*
|
131
|
+
# @option +:stock+:: (::Hash) Specifications for *stock* microservices.
|
132
|
+
# May be +nil+
|
133
|
+
def initialize **options
|
134
|
+
|
135
|
+
restful = check_option(options, :restful, type: [ Microservice ], allow_nil: true)
|
136
|
+
stock = check_option(options, :stock, types: [ [ Microservice ] ], allow_nil: true)
|
137
|
+
|
138
|
+
@options = {}.merge(options)
|
139
|
+
end
|
140
|
+
|
141
|
+
def generate root_directory = nil, **options
|
142
|
+
|
143
|
+
check_option(options, :restful, type: [ Microservice ], allow_nil: true)
|
144
|
+
check_option(options, :stock, type: [ Microservice ], allow_nil: true)
|
145
|
+
|
146
|
+
options = @options.merge(options)
|
147
|
+
|
148
|
+
restful = options[:restful] || []
|
149
|
+
stock = options[:stock] || []
|
150
|
+
|
151
|
+
h = {}
|
152
|
+
|
153
|
+
Constants::TOP_LEVEL_KEYS.each { |k| h[k] = {} }
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
# properties
|
158
|
+
|
159
|
+
properties = h['properties']
|
160
|
+
|
161
|
+
properties['edit-history'] = [
|
162
|
+
|
163
|
+
"This file generated on #{Time.now.strftime('%Y/%m/%d %H:%M:%S.%L')}",
|
164
|
+
]
|
165
|
+
|
166
|
+
|
167
|
+
# cassini
|
168
|
+
|
169
|
+
cassini = h['cassini']
|
170
|
+
|
171
|
+
cassini['auth_mode'] = lookup_(options, :auth_mode) ||\
|
172
|
+
"*** ENTER THE AUTHORISATION MODE - ONE OF 'authorisation_only', 'basic' OR 'jwt' - WHICH THE INSTANCE WILL SUPPORT ***"
|
173
|
+
|
174
|
+
cassini['ces'] = {
|
175
|
+
|
176
|
+
'service_path' => 'bin/razorrisk-microservice-clientedgeservice',
|
177
|
+
}
|
178
|
+
|
179
|
+
cassini['first_port'] = lookup_(options, :first_port) ||\
|
180
|
+
'*** ENTER THE FIRST PORT, WHICH IS THE ONE BY WHICH YOU WILL CONNECT TO CASSINI ***'
|
181
|
+
|
182
|
+
cassini['host'] = lookup_(options, :host) ||\
|
183
|
+
'*** ENTER THE HOST IDENTIFIER BY WHICH YOU WILL CONNECT TO CASSINI ***'
|
184
|
+
|
185
|
+
cassini['microservices'] = {
|
186
|
+
|
187
|
+
'stock' => Hash[stock.map { |usvc| [ usvc.name, usvc.to_h ] }],
|
188
|
+
'restful' => Hash[restful.map { |usvc| [ usvc.name, usvc.to_h ] }],
|
189
|
+
}
|
190
|
+
|
191
|
+
cassini['tls'] = {
|
192
|
+
|
193
|
+
'cert' => '*** ENTER THE (RELATIVE/ABSOLUTE) PATH OF THE CERTIFICATE FILE ***',
|
194
|
+
'key' => '*** ENTER THE (RELATIVE/ABSOLUTE) PATH OF THE CERTIFICATE PUBLIC KEY FILE ***',
|
195
|
+
}
|
196
|
+
|
197
|
+
cassini['us_multiplier'] = lookup_(options, :us_multiplier) ||\
|
198
|
+
'*** ENTER A MULTIPLIER FOR THE NUMBER OF EACH INTERNAL MICROSERVICE TO USE ***'
|
199
|
+
|
200
|
+
cassini['root_dir'] = root_directory ||\
|
201
|
+
"*** ENTER THE ROOT DIRECTORY WHEN CONFIGURING THE INSTALLATION ***"
|
202
|
+
|
203
|
+
cassini['web_server'] = lookup_(options, :web_server) ||\
|
204
|
+
"*** ENTER THE WEB-SERVER TO USE - REMEMBER ONLY THE 'thin' WEB-SERVER SUPPORTS TLS/SSL ***"
|
205
|
+
|
206
|
+
cassini['web_ui_server'] = lookup_(options, :web_ui_server) ||\
|
207
|
+
"*** ENTER THE WEB-UI-SERVER TO USE - REMEMBER THAT THIS MAY INCLUDE WILDCARDS ***"
|
208
|
+
|
209
|
+
# control
|
210
|
+
|
211
|
+
control = h['control']
|
212
|
+
|
213
|
+
control['detach'] = false
|
214
|
+
|
215
|
+
control['ss_wait'] = 4
|
216
|
+
|
217
|
+
control['cassid_wait'] = 10
|
218
|
+
|
219
|
+
# diagnostics
|
220
|
+
|
221
|
+
diagnostics = h['diagnostics']
|
222
|
+
|
223
|
+
diagnostics['benchmark'] = false
|
224
|
+
diagnostics['console'] = {
|
225
|
+
|
226
|
+
'threshold' => 'informational',
|
227
|
+
}
|
228
|
+
diagnostics['main'] = {
|
229
|
+
|
230
|
+
'threshold' => 'informational',
|
231
|
+
}
|
232
|
+
|
233
|
+
# razor
|
234
|
+
|
235
|
+
razor = h['razor']
|
236
|
+
|
237
|
+
razor['clarite_config'] = lookup_(options, :clarite_config) ||\
|
238
|
+
'*** ENTER THE (RELATIVE/ABSOLUTE) PATH OF THE CLARITE CONFIG FILE ***'
|
239
|
+
|
240
|
+
razor['environment'] = lookup_(options, :environment) ||\
|
241
|
+
'*** ENTER THE (RELATIVE/ABSOLUTE) PATH OF THE RAZOR ENVIRONMENT ***'
|
242
|
+
|
243
|
+
razor['executable'] = lookup_(options, :executable) ||\
|
244
|
+
'*** ENTER THE (RELATIVE/ABSOLUTE) PATH OF THE RAZOR CONNECTIVITY ADAPTOR EXECUTABLE ***'
|
245
|
+
|
246
|
+
|
247
|
+
h
|
248
|
+
end
|
249
|
+
|
250
|
+
private
|
251
|
+
def lookup_(h, *name_strings)
|
252
|
+
|
253
|
+
names = name_strings.map { |n| n.to_s }.uniq
|
254
|
+
names = names + names.map { |s| s.to_sym }
|
255
|
+
|
256
|
+
names.each do |name|
|
257
|
+
|
258
|
+
return h[name] if h.has_key?(name)
|
259
|
+
end
|
260
|
+
|
261
|
+
h.default
|
262
|
+
end
|
263
|
+
public
|
264
|
+
|
265
|
+
end # class ConfigurationGenerator
|
266
|
+
|
267
|
+
end # module CassIS
|
268
|
+
end # module Utilities
|
269
|
+
end # module Cassini
|
270
|
+
end # module RazorRisk
|
271
|
+
|
272
|
+
# ############################## end of file ############################# #
|
273
|
+
|
274
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
# File: razor_risk/cassini/utilities/cassis/constants.rb
|
5
|
+
#
|
6
|
+
# Purpose: Constants
|
7
|
+
#
|
8
|
+
# Created: 27th October 2018
|
9
|
+
# Updated: 27th October 2018
|
10
|
+
#
|
11
|
+
# Author: Matthew Wilson
|
12
|
+
#
|
13
|
+
# Copyright (c) 2018, Razor Risk Technologies Pty Ltd
|
14
|
+
# All rights reserved.
|
15
|
+
#
|
16
|
+
# ######################################################################## #
|
17
|
+
|
18
|
+
|
19
|
+
=begin
|
20
|
+
=end
|
21
|
+
|
22
|
+
module RazorRisk
|
23
|
+
module Cassini
|
24
|
+
module Utilities
|
25
|
+
|
26
|
+
module CassIS
|
27
|
+
|
28
|
+
CASSIS_INFO_DESCRIPTION = 'CassIS - the Cassini Installation System'
|
29
|
+
CASSINI_INFO_DESCRIPTION = 'Cassini - the Razor Risk Web Services API'
|
30
|
+
CASSINI_INFO_COPYRIGHT_ = 'Copyright Razor Risk Technologies (c) '
|
31
|
+
|
32
|
+
end # module CassIS
|
33
|
+
|
34
|
+
end # module Utilities
|
35
|
+
end # module Cassini
|
36
|
+
end # module RazorRisk
|
37
|
+
|
38
|
+
# ############################## end of file ############################# #
|
39
|
+
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
|
4
|
+
require 'pantheios'
|
5
|
+
rescue LoadError
|
6
|
+
|
7
|
+
module Pantheios; end
|
8
|
+
|
9
|
+
class ParamNames; def self.[](*args); end; end
|
10
|
+
|
11
|
+
def trace(*args); end
|
12
|
+
end
|
13
|
+
|
14
|
+
# ############################## end of file ############################# #
|
15
|
+
|
16
|
+
|
data/lib/razor_risk/cassini/utilities/cassis/internal/require/xqsr3/quality/parameter_checking.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
|
4
|
+
require 'xqsr3/quality/parameter_checking'
|
5
|
+
rescue LoadError
|
6
|
+
|
7
|
+
module Xqsr3; module Quality; module ParameterChecking; end; end; end
|
8
|
+
|
9
|
+
def check_parameter(a0, *args); a0; end
|
10
|
+
|
11
|
+
def check_option(options, symbol, *args); options[symbol]; end
|
12
|
+
end
|
13
|
+
|
14
|
+
# ############################## end of file ############################# #
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
# File: razor_risk/cassini/utilities/cassis/program_utils.rb
|
5
|
+
#
|
6
|
+
# Purpose: Program utility functions
|
7
|
+
#
|
8
|
+
# Created: 26th June 2018
|
9
|
+
# Updated: 27th October 2018
|
10
|
+
#
|
11
|
+
# Author: Matthew Wilson
|
12
|
+
#
|
13
|
+
# Copyright (c) 2018, Razor Risk Technologies Pty Ltd
|
14
|
+
# All rights reserved.
|
15
|
+
#
|
16
|
+
# ######################################################################## #
|
17
|
+
|
18
|
+
|
19
|
+
require 'razor_risk/cassini/utilities/cassis/internal/require/pantheios'
|
20
|
+
require 'razor_risk/cassini/utilities/cassis/internal/require/xqsr3/quality/parameter_checking'
|
21
|
+
|
22
|
+
=begin
|
23
|
+
=end
|
24
|
+
|
25
|
+
module RazorRisk
|
26
|
+
module Cassini
|
27
|
+
module Utilities
|
28
|
+
module CassIS
|
29
|
+
|
30
|
+
module ProgramUtils
|
31
|
+
|
32
|
+
def basename
|
33
|
+
|
34
|
+
bn = File.basename $0
|
35
|
+
|
36
|
+
/\.rb$/ =~ bn ? "#$`(.rb)" : bn
|
37
|
+
end
|
38
|
+
|
39
|
+
def fo_help name, usage
|
40
|
+
|
41
|
+
"\t#{name}\n\t\t#{usage}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def make_windows_path dir, homedrive
|
45
|
+
|
46
|
+
return dir if dir =~ /^[A-Z]:/i
|
47
|
+
|
48
|
+
dir = "/#{dir}" unless [ '/', '\\' ].include? dir[0]
|
49
|
+
|
50
|
+
"#{homedrive}#{dir}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def quote_if s
|
54
|
+
|
55
|
+
return s if s !~ /\s/
|
56
|
+
|
57
|
+
%Q<"#{s}">
|
58
|
+
end
|
59
|
+
|
60
|
+
def ruby
|
61
|
+
|
62
|
+
return 'ruby.exe' if windows?
|
63
|
+
|
64
|
+
'ruby'
|
65
|
+
end
|
66
|
+
|
67
|
+
def windows?
|
68
|
+
|
69
|
+
w = false
|
70
|
+
|
71
|
+
w ||= ENV['OS'] == 'Windows_NT'
|
72
|
+
w ||= RUBY_PLATFORM =~ /mingw/
|
73
|
+
w ||= RUBY_PLATFORM =~ /mswin/
|
74
|
+
|
75
|
+
w
|
76
|
+
end
|
77
|
+
end # module ProgramUtils
|
78
|
+
|
79
|
+
end # module CassIS
|
80
|
+
end # module Utilities
|
81
|
+
end # module Cassini
|
82
|
+
end # module RazorRisk
|
83
|
+
|
84
|
+
# ############################## end of file ############################# #
|
85
|
+
|
86
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
# File: razor_risk/cassini/utilities/cassis/version.rb
|
5
|
+
#
|
6
|
+
# Purpose: Version for RazorRisk CassIS utility support library
|
7
|
+
#
|
8
|
+
# Created: 11th July 2018
|
9
|
+
# Updated: 25th January 2019
|
10
|
+
#
|
11
|
+
# Author: Matthew Wilson
|
12
|
+
#
|
13
|
+
# Copyright (c) 2018, Razor Risk Technologies Pty Ltd
|
14
|
+
# All rights reserved.
|
15
|
+
#
|
16
|
+
# ######################################################################## #
|
17
|
+
|
18
|
+
|
19
|
+
=begin
|
20
|
+
=end
|
21
|
+
|
22
|
+
module RazorRisk
|
23
|
+
module Cassini
|
24
|
+
module Utilities
|
25
|
+
|
26
|
+
module CassIS
|
27
|
+
|
28
|
+
# Current version of the RazorRisk.Cassini.Common library
|
29
|
+
VERSION = '0.7.6'
|
30
|
+
|
31
|
+
private
|
32
|
+
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
33
|
+
public
|
34
|
+
# Major version of the RazorRisk.Cassini.Common library
|
35
|
+
VERSION_MAJOR = VERSION_PARTS_[0] # :nodoc:
|
36
|
+
# Minor version of the RazorRisk.Cassini.Common library
|
37
|
+
VERSION_MINOR = VERSION_PARTS_[1] # :nodoc:
|
38
|
+
# Patch version of the RazorRisk.Cassini.Common library
|
39
|
+
VERSION_PATCH = VERSION_PARTS_[2] # :nodoc:
|
40
|
+
# Commit version of the RazorRisk.Cassini.Common library
|
41
|
+
VERSION_COMMIT = VERSION_PARTS_[3] || 0 # :nodoc:
|
42
|
+
|
43
|
+
|
44
|
+
# The description of the framework
|
45
|
+
DESCRIPTION = 'Cassini Web Service framework for Razor Risk Razor system'
|
46
|
+
|
47
|
+
# [DEPRECATED] Instead use +DESCRIPTION+
|
48
|
+
FRAMEWORK_DESCRIPTION = DESCRIPTION
|
49
|
+
|
50
|
+
end # module CassIS
|
51
|
+
end # module Utilities
|
52
|
+
end # module Cassini
|
53
|
+
end # module RazorRisk
|
54
|
+
|
55
|
+
# ############################## end of file ############################# #
|
56
|
+
|
57
|
+
|