aro 0.2.6 → 0.2.7
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 +4 -4
- data/Gemfile.lock +5 -2
- data/README.md +10 -54
- data/aro.gemspec +2 -1
- data/bin/oss_om +2 -0
- data/checksums/aro-0.2.7.gem.sha512 +1 -0
- data/listen.rb +1 -1
- data/locale/en.cor.yml +21 -32
- data/locale/en.yml +8 -60
- data/sys/aro/action.rb +153 -0
- data/sys/aro/d.rb +3 -1
- data/sys/aro/db/migrate/1793913747_create_data_bases.rb +2 -0
- data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +2 -0
- data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +2 -0
- data/sys/aro/db/migrate/1793913841_create_menus.rb +2 -0
- data/sys/aro/db/migrate/1793913861_create_menu_items.rb +3 -2
- data/sys/aro/db.rb +19 -33
- data/sys/aro/designer.rb +166 -97
- data/sys/aro/locale.rb +4 -2
- data/sys/aro/mancy.rb +6 -39
- data/sys/aro/models/concerns/tar_go_for_root_sec.rb +37 -0
- data/sys/aro/models/concerns/uuid.rb +2 -0
- data/sys/aro/models/data_base.rb +33 -8
- data/sys/aro/models/directory.rb +2 -0
- data/sys/aro/models/file.rb +3 -1
- data/sys/aro/models/menu.rb +64 -0
- data/sys/aro/models/menu_item.rb +70 -4
- data/sys/aro/oss_open_menu.rb +331 -0
- data/sys/aro/p.rb +15 -9
- data/sys/aro/r.rb +2 -0
- data/sys/aro/{cor.rb → settings/cor.rb} +91 -215
- data/sys/aro/settings/git.rb +69 -0
- data/sys/aro/settings/ssh.rb +123 -0
- data/sys/aro/store.rb +87 -36
- data/sys/aro/v.rb +2 -0
- data/sys/aro.rb +2 -0
- data/sys/ma_ain.rb +202 -0
- data/sys/reiquire.rb +41 -54
- data/sys/shr/prompt.rb +6 -1
- data/sys/shr/version.rb +7 -8
- metadata +31 -23
- data/locale/en.cards.yml +0 -519
- data/locale/en.cmd.yml +0 -34
- data/locale/en.usage.yml +0 -142
- data/sys/aro/cmd.rb +0 -96
- data/sys/aro/db/migrate/1763374647_create_tecks.rb +0 -20
- data/sys/aro/db/migrate/1763432541_create_tlogs.rb +0 -20
- data/sys/aro/ma_ain.rb +0 -54
- data/sys/aro/models/teck.rb +0 -251
- data/sys/aro/models/tlog.rb +0 -21
- data/sys/aro/views/base.rb +0 -25
- data/sys/aro/views/teck.rb +0 -30
- data/sys/cli/constants.rb +0 -45
- data/sys/cli/create.rb +0 -23
- data/sys/cli/nterface.rb +0 -37
- data/sys/cli/teck.rb +0 -107
- data/sys/cli/usage.rb +0 -25
- data/sys/cli.rb +0 -23
- data/sys/shr/t.rb +0 -74
|
@@ -1,65 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
=begin
|
|
2
4
|
|
|
3
5
|
cor.rb
|
|
4
6
|
|
|
5
|
-
cor
|
|
7
|
+
oss_om cor.
|
|
6
8
|
|
|
7
9
|
by i2097i
|
|
8
10
|
|
|
9
11
|
=end
|
|
10
12
|
|
|
11
|
-
require_relative :"./mancy".to_s
|
|
13
|
+
# require_relative :"./mancy".to_s
|
|
12
14
|
|
|
13
15
|
module Aro
|
|
14
|
-
# cli entrypoint
|
|
15
|
-
def self.cor
|
|
16
|
-
if CLI::FLAGS[:HELP].include?(CLI::ARGV1)
|
|
17
|
-
CLI.usage_cor
|
|
18
|
-
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
Aro::Cor.instance.load_env
|
|
22
|
-
Aro::Cor.process_command(ARGV)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
16
|
class Cor
|
|
26
17
|
include Singleton
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
EXEC_METHODS = [
|
|
20
|
+
:print_env,
|
|
21
|
+
:print_cor_def,
|
|
22
|
+
:edit_config
|
|
23
|
+
]
|
|
29
24
|
|
|
30
|
-
def self.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
self.instance.display_lines = self.instance.lines_var(k, Aro::Cor::DEF[k], ENV[Aro::Cor.ivar_k(k)])
|
|
40
|
-
else
|
|
41
|
-
self.instance.display_lines = Aro::Cor.base_lines(args)
|
|
42
|
-
end
|
|
25
|
+
def self.print_env
|
|
26
|
+
self.instance.source_config
|
|
27
|
+
Aro::P.say(:printing_ivars)
|
|
28
|
+
Aro::P.say("\n")
|
|
29
|
+
puts ivars_dump.join("\n")
|
|
30
|
+
Aro::P.say(:printing_ovars)
|
|
31
|
+
Aro::P.say("\n")
|
|
32
|
+
puts ovars_dump.join("\n")
|
|
33
|
+
end
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
def self.print_cor_def
|
|
36
|
+
self.instance.source_config
|
|
37
|
+
Aro::P.say("Aro::Cor::DEF")
|
|
38
|
+
Aro::P.say("\n" + Aro::Cor::DEF.map{|k, v|
|
|
39
|
+
"#{k}: " + JSON.pretty_generate(Aro::Cor::DEF[k])
|
|
40
|
+
}.join("\n"))
|
|
41
|
+
end
|
|
51
42
|
|
|
52
|
-
|
|
43
|
+
def self.edit_config
|
|
44
|
+
puts self.name
|
|
45
|
+
puts __method__
|
|
46
|
+
puts :todo_open_cor_editor
|
|
47
|
+
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
53
48
|
end
|
|
54
49
|
|
|
55
50
|
ARO_IVA_PREFIX = :ARO_IVA_
|
|
56
51
|
ARO_OVA_PREFIX = :ARO_OVA_
|
|
57
52
|
|
|
58
|
-
COR_FILE = :".
|
|
53
|
+
COR_FILE = :".om_cor"
|
|
59
54
|
|
|
60
55
|
DATE_FORMAT = "%Y:%m:%d:%H:%M:%S"
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
DEBUG_MODES = [:development, :test]
|
|
63
58
|
|
|
64
59
|
# possible envs
|
|
65
60
|
#
|
|
@@ -71,24 +66,6 @@ module Aro
|
|
|
71
66
|
TEST: :test
|
|
72
67
|
}
|
|
73
68
|
|
|
74
|
-
# possible interfaces
|
|
75
|
-
#
|
|
76
|
-
# example usage:
|
|
77
|
-
# Aro::Cor::INTERFACES[:TERMINAL]
|
|
78
|
-
INTERFACES = {
|
|
79
|
-
TERMINAL: :terminal,
|
|
80
|
-
LANIMRET: :lanimret,
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
# possible dimensions
|
|
84
|
-
#
|
|
85
|
-
# example usage:
|
|
86
|
-
# Aro::Cor::DMS[:DEV_TAROT]
|
|
87
|
-
DMS = {
|
|
88
|
-
DEV_TAROT: :dev_tarot,
|
|
89
|
-
RUBY_FACOT: :ruby_facot
|
|
90
|
-
}
|
|
91
|
-
|
|
92
69
|
# ovar and ivar access
|
|
93
70
|
#
|
|
94
71
|
# example usage:
|
|
@@ -113,11 +90,11 @@ module Aro
|
|
|
113
90
|
# types used in definition
|
|
114
91
|
#
|
|
115
92
|
# example usage:
|
|
116
|
-
# Aro::Cor::DEF_TYPES[:INT][:validator].call(unvalid, Aro::Cor::DEF[:
|
|
93
|
+
# Aro::Cor::DEF_TYPES[:INT][:validator].call(unvalid, Aro::Cor::DEF[:])
|
|
117
94
|
DEF_TYPES = {
|
|
118
95
|
BOOL: {
|
|
119
96
|
name: Aro::Cor::TYPES[:BOOL],
|
|
120
|
-
description: I18n.t("cor.
|
|
97
|
+
description: I18n.t("cor.types.bool_description"),
|
|
121
98
|
converter: Proc.new{|v| v.kind_of?(TrueClass) ? true : false},
|
|
122
99
|
validator: Proc.new{|unvalid, k, v|
|
|
123
100
|
Aro::Cor.def_valid?(k, v) &&
|
|
@@ -126,7 +103,7 @@ module Aro
|
|
|
126
103
|
},
|
|
127
104
|
INT: {
|
|
128
105
|
name: Aro::Cor::TYPES[:INT],
|
|
129
|
-
description: I18n.t("cor.
|
|
106
|
+
description: I18n.t("cor.types.int_description"),
|
|
130
107
|
converter: Proc.new{|v| v.to_i},
|
|
131
108
|
validator: Proc.new{|unvalid, k, v|
|
|
132
109
|
Aro::V.say("validating #{k} (#{Aro::Cor::DEF_TYPES[:INT][:name]})")
|
|
@@ -142,7 +119,7 @@ module Aro
|
|
|
142
119
|
},
|
|
143
120
|
STRING: {
|
|
144
121
|
name: Aro::Cor::TYPES[:STRING],
|
|
145
|
-
description: I18n.t("cor.
|
|
122
|
+
description: I18n.t("cor.types.string_description"),
|
|
146
123
|
converter: Proc.new{|v| v.to_s},
|
|
147
124
|
validator: Proc.new{|unvalid, k, v|
|
|
148
125
|
Aro::Cor.def_valid?(k, v) &&
|
|
@@ -151,7 +128,7 @@ module Aro
|
|
|
151
128
|
},
|
|
152
129
|
VALUES: {
|
|
153
130
|
name: Aro::Cor::TYPES[:VALUES],
|
|
154
|
-
description: I18n.t("cor.
|
|
131
|
+
description: I18n.t("cor.types.values_description"),
|
|
155
132
|
converter: Proc.new{|v| v.to_s},
|
|
156
133
|
validator: Proc.new{|unvalid, k, v|
|
|
157
134
|
Aro::Cor.def_valid?(k, v) &&
|
|
@@ -227,12 +204,6 @@ module Aro
|
|
|
227
204
|
test: I18n.t("cor.env.test_description"),
|
|
228
205
|
}
|
|
229
206
|
},
|
|
230
|
-
VERBOSE: {
|
|
231
|
-
type: Aro::Cor::TYPES[:BOOL],
|
|
232
|
-
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
233
|
-
value: Aro::Cor::BOOLS[:FALSE],
|
|
234
|
-
description: I18n.t("cor.verbose_description"),
|
|
235
|
-
},
|
|
236
207
|
LOG_DATABASE: {
|
|
237
208
|
type: Aro::Cor::TYPES[:BOOL],
|
|
238
209
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
@@ -245,82 +216,25 @@ module Aro
|
|
|
245
216
|
value: nil,
|
|
246
217
|
description: I18n.t("cor.oss_om_home.description"),
|
|
247
218
|
possible_values: {
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
INTERFACE: {
|
|
252
|
-
type: Aro::Cor::TYPES[:VALUES],
|
|
253
|
-
implemented: false,
|
|
254
|
-
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
255
|
-
value: Aro::Cor::INTERFACES[:TERMINAL],
|
|
256
|
-
description: I18n.t("cor.interface.description"),
|
|
257
|
-
possible_values: {
|
|
258
|
-
terminal: I18n.t("cor.interface.terminal_description"),
|
|
259
|
-
lanimret: I18n.t("cor.interface.lanimret_description")
|
|
219
|
+
path: I18n.t("cor.oss_om_home.path_description"),
|
|
260
220
|
}
|
|
261
221
|
},
|
|
262
|
-
|
|
263
|
-
type: Aro::Cor::TYPES[:
|
|
264
|
-
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
265
|
-
value: Aro::Cor::DMS[:DEV_TAROT],
|
|
266
|
-
description: I18n.t("cor.dimension.description"),
|
|
267
|
-
possible_values: {
|
|
268
|
-
dev_tarot: I18n.t("cor.dimension.dev_tarot_description"),
|
|
269
|
-
ruby_facot: I18n.t("cor.dimension.ruby_facot_description"),
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
HEIGHT: {
|
|
273
|
-
type: Aro::Cor::TYPES[:INT],
|
|
274
|
-
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
275
|
-
value: Aro::Mancy::NUMERALS[:XLII],
|
|
276
|
-
min: Aro::Mancy::NUMERALS[:I],
|
|
277
|
-
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
278
|
-
description: I18n.t(
|
|
279
|
-
"cor.height_description",
|
|
280
|
-
min: Aro::Mancy::NUMERALS[:I],
|
|
281
|
-
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
282
|
-
),
|
|
283
|
-
},
|
|
284
|
-
WIDTH: {
|
|
285
|
-
type: Aro::Cor::TYPES[:INT],
|
|
286
|
-
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
287
|
-
value: Aro::Mancy::NUMERALS[:C] + Aro::Mancy::NUMERALS[:XXXVII] - Aro::Mancy::S,
|
|
288
|
-
min: Aro::Mancy::NUMERALS[:I],
|
|
289
|
-
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
290
|
-
description: I18n.t(
|
|
291
|
-
"cor.width_description",
|
|
292
|
-
min: Aro::Mancy::NUMERALS[:I],
|
|
293
|
-
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
294
|
-
),
|
|
295
|
-
},
|
|
296
|
-
Z: {
|
|
297
|
-
type: Aro::Cor::TYPES[:INT],
|
|
298
|
-
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
299
|
-
value: Aro::Mancy::NUMERALS[:I],
|
|
300
|
-
min: Aro::Mancy::NUMERALS[:I],
|
|
301
|
-
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
302
|
-
description: I18n.t(
|
|
303
|
-
"cor.z_description",
|
|
304
|
-
min: Aro::Mancy::NUMERALS[:I],
|
|
305
|
-
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
306
|
-
),
|
|
307
|
-
},
|
|
308
|
-
Z_MAX: {
|
|
309
|
-
type: Aro::Cor::TYPES[:INT],
|
|
222
|
+
VERBOSE: {
|
|
223
|
+
type: Aro::Cor::TYPES[:BOOL],
|
|
310
224
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
311
|
-
value: Aro::
|
|
312
|
-
|
|
313
|
-
max: Aro::Mancy::NUMERALS[:XXII],
|
|
314
|
-
description: I18n.t(
|
|
315
|
-
"cor.z_max_description",
|
|
316
|
-
min: Aro::Mancy::NUMERALS[:I],
|
|
317
|
-
max: Aro::Mancy::NUMERALS[:XXII],
|
|
318
|
-
),
|
|
225
|
+
value: Aro::Cor::BOOLS[:FALSE],
|
|
226
|
+
description: I18n.t("cor.verbose_description"),
|
|
319
227
|
},
|
|
320
228
|
|
|
321
229
|
#
|
|
322
230
|
# => ovars
|
|
323
231
|
#
|
|
232
|
+
OSS_OM_FILE: {
|
|
233
|
+
type: Aro::Cor::TYPES[:STRING],
|
|
234
|
+
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
235
|
+
value: Aro::Mancy::NAME_FILE,
|
|
236
|
+
description: I18n.t("cor.aro_env.OSS_OM_FILE_description"),
|
|
237
|
+
},
|
|
324
238
|
O: {
|
|
325
239
|
type: Aro::Cor::TYPES[:INT],
|
|
326
240
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
@@ -351,70 +265,26 @@ module Aro
|
|
|
351
265
|
value: Aro::Mancy::N,
|
|
352
266
|
description: I18n.t("cor.aro_env.N_description"),
|
|
353
267
|
},
|
|
354
|
-
|
|
355
|
-
type: Aro::Cor::TYPES[:
|
|
356
|
-
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
357
|
-
value: Aro::Mancy::NAME_FILE,
|
|
358
|
-
description: I18n.t("cor.aro_env.NAME_FILE_description"),
|
|
359
|
-
},
|
|
360
|
-
I2097I: {
|
|
361
|
-
type: Aro::Cor::TYPES[:STRING],
|
|
362
|
-
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
363
|
-
value: Aro::Mancy::I2097I,
|
|
364
|
-
description: I18n.t("cor.aro_env.I2097I_description"),
|
|
365
|
-
},
|
|
366
|
-
YES: {
|
|
367
|
-
type: Aro::Cor::TYPES[:STRING],
|
|
368
|
-
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
369
|
-
value: Aro::Mancy::YES,
|
|
370
|
-
description: I18n.t("cor.aro_env.YES_description"),
|
|
371
|
-
},
|
|
372
|
-
ALL: {
|
|
373
|
-
type: Aro::Cor::TYPES[:STRING],
|
|
268
|
+
N: {
|
|
269
|
+
type: Aro::Cor::TYPES[:INT],
|
|
374
270
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
375
|
-
value: Aro::Mancy::
|
|
376
|
-
description: I18n.t("cor.aro_env.
|
|
271
|
+
value: Aro::Mancy::V,
|
|
272
|
+
description: I18n.t("cor.aro_env.V_description"),
|
|
377
273
|
},
|
|
378
274
|
}
|
|
379
275
|
|
|
380
|
-
def
|
|
381
|
-
|
|
276
|
+
def self.open!
|
|
277
|
+
cor_menu = Aro::Dom::DataBase.open_menu(:cor)
|
|
278
|
+
generate_cor_menu_items! if Aro::Mancy::S == cor_menu.menu_items.count
|
|
279
|
+
Aro::Dom::Ma_ain.open!(:cor)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def load_env!
|
|
382
283
|
unless File.exist?(Aro::Cor.cor_filepath)
|
|
383
284
|
generate_config
|
|
384
285
|
end
|
|
385
286
|
|
|
386
287
|
source_config
|
|
387
|
-
Aro::D.say("running in #{Aro::Cor.ivar(:ENV)} env.")
|
|
388
|
-
|
|
389
|
-
self.display_lines = Aro::Cor.base_lines
|
|
390
|
-
end
|
|
391
|
-
|
|
392
|
-
def self.base_lines(args = nil)
|
|
393
|
-
if self.instance.base_lines_def.nil? || args.present?
|
|
394
|
-
args = [] if args.nil?
|
|
395
|
-
# print Aro::Cor::DEF
|
|
396
|
-
lines = []
|
|
397
|
-
lines << "loaded config at: #{Aro::Cor.cor_filepath}"
|
|
398
|
-
lines << "<Aro::Cor::DEF>"
|
|
399
|
-
self.instance.use_less = false
|
|
400
|
-
case args[Aro::Mancy::S]&.to_sym
|
|
401
|
-
when :ivars
|
|
402
|
-
lines += Aro::Cor.ivars_dump
|
|
403
|
-
when :ovars
|
|
404
|
-
lines += Aro::Cor.ovars_dump
|
|
405
|
-
else
|
|
406
|
-
# print cor commands
|
|
407
|
-
self.instance.use_less = true
|
|
408
|
-
lines << ""
|
|
409
|
-
lines << I18n.t("constants.commands")
|
|
410
|
-
lines << ""
|
|
411
|
-
lines += Aro::Cmd.display_lines
|
|
412
|
-
end
|
|
413
|
-
|
|
414
|
-
self.instance.base_lines_def = lines
|
|
415
|
-
end
|
|
416
|
-
|
|
417
|
-
return self.instance.base_lines_def
|
|
418
288
|
end
|
|
419
289
|
|
|
420
290
|
def self.cor_filepath
|
|
@@ -428,19 +298,6 @@ module Aro
|
|
|
428
298
|
Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:TEST].to_s
|
|
429
299
|
end
|
|
430
300
|
|
|
431
|
-
def self.discon
|
|
432
|
-
height = Aro::Cor.ivar(:HEIGHT).to_i
|
|
433
|
-
width = Aro::Cor.ivar(:WIDTH).to_i
|
|
434
|
-
|
|
435
|
-
result = {
|
|
436
|
-
HEIGHT: height,
|
|
437
|
-
WIDTH: width,
|
|
438
|
-
DIVIDER: :".".to_s
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
result
|
|
442
|
-
end
|
|
443
|
-
|
|
444
301
|
# out vars
|
|
445
302
|
def self.ovar(suffix)
|
|
446
303
|
Aro::Cor::DEF[suffix][:value]
|
|
@@ -469,7 +326,7 @@ module Aro
|
|
|
469
326
|
# set ruby ENV key value
|
|
470
327
|
# only write to ruby ENV from here
|
|
471
328
|
ENV[Aro::Cor.ivar_k(k.to_s)] = converted
|
|
472
|
-
Aro::
|
|
329
|
+
Aro::D.say("#{k} set to #{converted}") unless converted.nil? || converted.empty?
|
|
473
330
|
return true
|
|
474
331
|
end
|
|
475
332
|
|
|
@@ -477,12 +334,7 @@ module Aro
|
|
|
477
334
|
k = k.upcase.to_sym
|
|
478
335
|
|
|
479
336
|
current_value = Aro::Cor.ivar(k)
|
|
480
|
-
if k == :
|
|
481
|
-
new_value == Aro::Cor::DMS[:DEV_TAROT].to_s &&
|
|
482
|
-
!Aro::T.is_dev_tarot_avail?
|
|
483
|
-
Aro::P.say("unable to set dimension dev_tarot. device not present.")
|
|
484
|
-
return
|
|
485
|
-
elsif k == :OSS_OM_HOME
|
|
337
|
+
if k == :OSS_OM_HOME
|
|
486
338
|
unless Dir.exist?(new_value)
|
|
487
339
|
Aro::P.say("cannot set #{k} to #{new_value}. the directory does not exist.")
|
|
488
340
|
end
|
|
@@ -514,7 +366,6 @@ module Aro
|
|
|
514
366
|
end
|
|
515
367
|
end
|
|
516
368
|
|
|
517
|
-
# todo: add_to_docs
|
|
518
369
|
def self.ivars_dump
|
|
519
370
|
dump = []
|
|
520
371
|
Aro::Cor::DEF.select{|k, v|
|
|
@@ -539,6 +390,7 @@ module Aro
|
|
|
539
390
|
end
|
|
540
391
|
|
|
541
392
|
def source_config
|
|
393
|
+
return unless File.exist?(Aro::Cor.cor_filepath)
|
|
542
394
|
Aro::D.say(I18n.t("cor.source", name: Aro::Cor.cor_filepath))
|
|
543
395
|
File.read(Aro::Cor.cor_filepath).split("\n").select{|line|
|
|
544
396
|
line.match?(/export #{Aro::Cor::ARO_IVA_PREFIX}/)
|
|
@@ -565,7 +417,7 @@ module Aro
|
|
|
565
417
|
}
|
|
566
418
|
end
|
|
567
419
|
|
|
568
|
-
|
|
420
|
+
# from_memory true means write current config to file
|
|
569
421
|
def generate_config(from_memory = false)
|
|
570
422
|
# todo: localize generated config text
|
|
571
423
|
Aro::D.say(I18n.t("cor.generate", name: Aro::Cor.cor_filepath))
|
|
@@ -626,6 +478,30 @@ module Aro
|
|
|
626
478
|
write_config(lines)
|
|
627
479
|
end
|
|
628
480
|
|
|
481
|
+
private
|
|
482
|
+
|
|
483
|
+
def self.generate_cor_menu_items!
|
|
484
|
+
cor_menu = Aro::Dom::DataBase.open_menu(:cor)
|
|
485
|
+
return unless Aro::Mancy::S == cor_menu.menu_items.count
|
|
486
|
+
|
|
487
|
+
existing_item = cor_menu.menu_items.first
|
|
488
|
+
raise "missing existing item in #{self.name}.#{__method__}!" if existing_item.nil?
|
|
489
|
+
EXEC_METHODS.each{|method_name|
|
|
490
|
+
menu_item = existing_item || cor_menu.generate_new_item(method_name, for_type: :system)
|
|
491
|
+
|
|
492
|
+
cor_menu.rename_item(menu_item, method_name) unless existing_item.nil?
|
|
493
|
+
menu_item.aro_file.write!(
|
|
494
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
495
|
+
self,
|
|
496
|
+
method_name,
|
|
497
|
+
"#{:cor} #{method_name}"
|
|
498
|
+
)
|
|
499
|
+
)
|
|
500
|
+
# clear existing item var
|
|
501
|
+
existing_item = nil unless existing_item.nil?
|
|
502
|
+
}
|
|
503
|
+
end
|
|
504
|
+
|
|
629
505
|
def write_config(lines)
|
|
630
506
|
File.open(Aro::Cor.cor_filepath, "w+") do |file|
|
|
631
507
|
file.write(lines.join("\n"))
|
|
@@ -691,16 +567,16 @@ module Aro
|
|
|
691
567
|
lines << "# => Aro::Cor::DEF_TYPES: #{v[:type]}"
|
|
692
568
|
case v[:type]
|
|
693
569
|
when Aro::Cor::DEF_TYPES[:BOOL][:name]
|
|
694
|
-
lines << "# => #{I18n.t("cor.
|
|
570
|
+
lines << "# => #{I18n.t("cor.types.bool_description")}"
|
|
695
571
|
when Aro::Cor::DEF_TYPES[:INT][:name]
|
|
696
|
-
lines << "# => #{I18n.t("cor.
|
|
572
|
+
lines << "# => #{I18n.t("cor.types.int_description")}"
|
|
697
573
|
lines << "# => #{I18n.t("cor.minimum")}: #{v[:min]}"
|
|
698
574
|
lines << "# => #{I18n.t("cor.maximum")}: #{v[:max]}"
|
|
699
575
|
when Aro::Cor::DEF_TYPES[:STRING][:name]
|
|
700
|
-
lines << "# => #{I18n.t("cor.
|
|
576
|
+
lines << "# => #{I18n.t("cor.types.string_description")}"
|
|
701
577
|
lines << "# => use \"double quotes\" if there are any spaces."
|
|
702
578
|
when Aro::Cor::DEF_TYPES[:VALUES][:name]
|
|
703
|
-
lines << "# => #{I18n.t("cor.
|
|
579
|
+
lines << "# => #{I18n.t("cor.types.values_description")}"
|
|
704
580
|
lines << "# => #{I18n.t("cor.possible_values")}:"
|
|
705
581
|
lines += lines_newline_comment
|
|
706
582
|
v[:possible_values].each{|name, description|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
git.rb
|
|
6
|
+
|
|
7
|
+
aro dom git.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module Aro
|
|
14
|
+
module Dom
|
|
15
|
+
class Git
|
|
16
|
+
|
|
17
|
+
EXEC_METHODS = [
|
|
18
|
+
:status,
|
|
19
|
+
:log,
|
|
20
|
+
:config
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
def self.open!
|
|
24
|
+
generate_git_menu_items!
|
|
25
|
+
Aro::Dom::Ma_ain.open!(:git)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.status
|
|
29
|
+
Aro::P.say("system(git status)")
|
|
30
|
+
system(:"git status".to_s)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.log
|
|
34
|
+
Aro::P.say("system(git log)")
|
|
35
|
+
system(:"git log".to_s)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.config
|
|
39
|
+
Aro::P.say("system(git config list --local)")
|
|
40
|
+
system(:"git config list --local".to_s)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def self.generate_git_menu_items!
|
|
46
|
+
git_menu = Aro::Dom::DataBase.open_menu(:git)
|
|
47
|
+
return unless Aro::Mancy::S == git_menu.menu_items.count
|
|
48
|
+
|
|
49
|
+
existing_item = git_menu.menu_items.first
|
|
50
|
+
raise "missing existing item in #{self.name}.#{__method__}!" if existing_item.nil?
|
|
51
|
+
EXEC_METHODS.each{|method_name|
|
|
52
|
+
menu_item = existing_item || git_menu.generate_new_item(method_name, for_type: :system)
|
|
53
|
+
|
|
54
|
+
git_menu.rename_item(menu_item, method_name) unless existing_item.nil?
|
|
55
|
+
menu_item.aro_file.write!(
|
|
56
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
57
|
+
self,
|
|
58
|
+
method_name,
|
|
59
|
+
"#{:git} #{method_name}"
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
# clear existing item var
|
|
63
|
+
existing_item = nil unless existing_item.nil?
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
ssh.rb
|
|
6
|
+
|
|
7
|
+
aro dom ssh.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module Aro
|
|
14
|
+
module Dom
|
|
15
|
+
class Ssh
|
|
16
|
+
EXEC_METHODS = [
|
|
17
|
+
:print_public_key,
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
ID_KEY_BASE = :id_oss_om
|
|
21
|
+
|
|
22
|
+
def self.open!
|
|
23
|
+
generate_ssh_menu_items!
|
|
24
|
+
Aro::Dom::Ma_ain.open!(:ssh)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.print_public_key
|
|
28
|
+
Aro::P.less(::File.read("#{id_key_path}.pub"))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.write_encrypted_file!(file_path, decrypted_json)
|
|
32
|
+
# todo: validations
|
|
33
|
+
#
|
|
34
|
+
# 1) encrypt decrypted_json
|
|
35
|
+
# 2) write encrypted contents
|
|
36
|
+
# 3) return success/failure
|
|
37
|
+
begin
|
|
38
|
+
# open and write
|
|
39
|
+
::File.open(file_path, "w+") do |f|
|
|
40
|
+
f.write(
|
|
41
|
+
encrypt!(decrypted_json)
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
rescue StandardError => e
|
|
45
|
+
Aro::P.say("#{self.name}:#{__method__}")
|
|
46
|
+
Aro::P.say(e.inspect)
|
|
47
|
+
return e
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
return true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.decrypt_file!(file_path)
|
|
54
|
+
# 1) open file
|
|
55
|
+
# 2) decrypt contents
|
|
56
|
+
# 3) return decrypted contents
|
|
57
|
+
begin
|
|
58
|
+
# read and decrypt
|
|
59
|
+
decrypted_json = decrypt!(
|
|
60
|
+
JSON.parse(
|
|
61
|
+
::File.read(file_path, encoding: "UTF-8")
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
rescue JSON::ParserError => e
|
|
65
|
+
Aro::P.say("#{self.name}:#{__method__}")
|
|
66
|
+
Aro::P.say(e.inspect)
|
|
67
|
+
return e
|
|
68
|
+
rescue StandardError => e
|
|
69
|
+
Aro::P.say("#{self.name}:#{__method__}")
|
|
70
|
+
Aro::P.say(e.inspect)
|
|
71
|
+
return e
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
decrypted_json
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def self.id_key_path
|
|
78
|
+
::File.join(Aro::Cor.ivar(:OSS_OM_HOME), ID_KEY_BASE.to_s)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
|
|
83
|
+
def self.generate_ssh_menu_items!
|
|
84
|
+
ssh_menu = Aro::Dom::DataBase.open_menu(:ssh)
|
|
85
|
+
return unless Aro::Mancy::S == ssh_menu.menu_items.count
|
|
86
|
+
# todo: generate ssh menu items if needed here
|
|
87
|
+
existing_item = ssh_menu.menu_items.first
|
|
88
|
+
raise "missing existing item in #{self.name}.#{__method__}!" if existing_item.nil?
|
|
89
|
+
EXEC_METHODS.each{|method_name|
|
|
90
|
+
menu_item = existing_item || ssh_menu.generate_new_item(method_name, for_type: :system)
|
|
91
|
+
|
|
92
|
+
ssh_menu.rename_item(menu_item, method_name) unless existing_item.nil?
|
|
93
|
+
menu_item.aro_file.write!(
|
|
94
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
95
|
+
self,
|
|
96
|
+
method_name,
|
|
97
|
+
"#{:ssh} #{method_name}"
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
# clear existing item var
|
|
101
|
+
existing_item = nil unless existing_item.nil?
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def self.encrypt!(decrypted_json)
|
|
106
|
+
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
107
|
+
puts __method__
|
|
108
|
+
puts :expects_decrypted_json
|
|
109
|
+
|
|
110
|
+
return decrypted_json
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def self.decrypt!(encrypted_json)
|
|
114
|
+
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
115
|
+
puts __method__
|
|
116
|
+
puts :expects_encrypted_json
|
|
117
|
+
|
|
118
|
+
return encrypted_json
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|