aro 0.2.6 → 0.2.8
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 +6 -3
- data/bin/oss_om +2 -0
- data/checksums/aro-0.2.7.gem.sha512 +1 -0
- data/checksums/aro-0.2.8.gem.sha512 +1 -0
- data/listen.rb +1 -1
- data/locale/en.cor.yml +28 -35
- data/locale/en.yml +23 -60
- data/sys/aro/action.rb +132 -0
- data/sys/aro/book.rb +150 -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 +291 -102
- data/sys/aro/imports.rb +78 -0
- data/sys/aro/library.rb +202 -0
- 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 +34 -0
- data/sys/aro/models/concerns/uuid.rb +2 -0
- data/sys/aro/models/data_base.rb +73 -11
- data/sys/aro/models/directory.rb +3 -5
- data/sys/aro/models/file.rb +3 -1
- data/sys/aro/models/menu.rb +65 -1
- data/sys/aro/models/menu_item.rb +68 -4
- data/sys/aro/oss_open_menu.rb +307 -0
- data/sys/aro/p.rb +15 -9
- data/sys/aro/plugins.rb +104 -0
- data/sys/aro/r.rb +2 -0
- data/sys/aro/{cor.rb → settings/cor.rb} +163 -220
- data/sys/aro/settings/git.rb +44 -0
- data/sys/aro/settings/ssh.rb +108 -0
- data/sys/aro/store.rb +111 -37
- data/sys/aro/v.rb +3 -1
- data/sys/aro.rb +2 -0
- data/sys/ma_ain.rb +271 -0
- data/sys/reiquire.rb +41 -54
- data/sys/shr/prompt.rb +6 -1
- data/sys/shr/version.rb +8 -8
- data/tasks/make.rake +2 -3
- metadata +39 -24
- 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,113 @@
|
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
EXEC_METHODS = [
|
|
20
|
+
:print_env,
|
|
21
|
+
:print_cor_def,
|
|
22
|
+
:edit_ivars
|
|
23
|
+
]
|
|
24
|
+
|
|
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
|
|
34
|
+
|
|
35
|
+
def self.print_cor_def
|
|
36
|
+
self.instance.source_config
|
|
37
|
+
Aro::P.less(JSON.pretty_generate(Aro::Cor::DEF))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.edit_ivars
|
|
41
|
+
|
|
42
|
+
Aro::P.say("#{self.name}.#{__method__}")
|
|
43
|
+
selected_def_key = Aro::P.default_select(
|
|
44
|
+
I18n.t("open_menu.edit_ivars_select"),
|
|
45
|
+
[{name: :back, value: :back}] + Aro::Cor::DEF.select{|k, v|
|
|
46
|
+
# do not allow writing to OSS_OM_HOME from oss_om
|
|
47
|
+
v[:access] == Aro::Cor::DEF_ACCESS[:WRITE] && k != :OSS_OM_HOME
|
|
48
|
+
}.map{|k, v|
|
|
49
|
+
{name: "#{k} (#{ivar(k)})", value: k}
|
|
50
|
+
}
|
|
51
|
+
)
|
|
37
52
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
self.instance.display_lines = Aro::Cor.base_lines(args)
|
|
53
|
+
if selected_def_key == :back
|
|
54
|
+
Aro::Dom::Ma_ain.open!(:cor)
|
|
55
|
+
return
|
|
42
56
|
end
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
Aro::P.say("'#{selected_def_key}' selected")
|
|
59
|
+
|
|
60
|
+
new_value = nil
|
|
61
|
+
while new_value.nil? ||
|
|
62
|
+
!self.instance.valid_var?(
|
|
63
|
+
new_value,
|
|
64
|
+
selected_def_key,
|
|
65
|
+
Aro::Cor::DEF[selected_def_key]
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
case Aro::Cor::DEF[selected_def_key][:type]
|
|
69
|
+
when :bool
|
|
70
|
+
new_value = !(ivar(selected_def_key) == :true.to_s)
|
|
71
|
+
when :int, :string
|
|
72
|
+
new_value = Aro::P.p.ask(
|
|
73
|
+
I18n.t(
|
|
74
|
+
"open_menu.new_ivar_value_prompt",
|
|
75
|
+
def_key: selected_def_key,
|
|
76
|
+
current_value: ivar(selected_def_key),
|
|
77
|
+
value_type: Aro::Cor::DEF[selected_def_key][:type]
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
when :values
|
|
81
|
+
new_value = Aro::P.default_select(
|
|
82
|
+
I18n.t("open_menu.edit_ivars_possible_values_select", def_key: selected_def_key),
|
|
83
|
+
[
|
|
84
|
+
{name: :back, value: :back}
|
|
85
|
+
] + Aro::Cor::DEF[
|
|
86
|
+
selected_def_key
|
|
87
|
+
][:possible_values].map{|k, v|
|
|
88
|
+
Aro::P.say("#{k}_desc: #{v}") # v is description localized text
|
|
89
|
+
|
|
90
|
+
{name: k, value: k}
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return if new_value == :back
|
|
49
95
|
end
|
|
96
|
+
|
|
50
97
|
end
|
|
51
98
|
|
|
52
|
-
|
|
99
|
+
set_ivar(selected_def_key, new_value)
|
|
100
|
+
Aro::Dom::Ma_ain.open!(:cor)
|
|
53
101
|
end
|
|
54
102
|
|
|
55
103
|
ARO_IVA_PREFIX = :ARO_IVA_
|
|
56
104
|
ARO_OVA_PREFIX = :ARO_OVA_
|
|
57
105
|
|
|
58
|
-
COR_FILE = :".
|
|
106
|
+
COR_FILE = :".om_cor"
|
|
59
107
|
|
|
60
108
|
DATE_FORMAT = "%Y:%m:%d:%H:%M:%S"
|
|
61
109
|
|
|
62
|
-
|
|
110
|
+
DEBUG_MODES = [:development, :test]
|
|
63
111
|
|
|
64
112
|
# possible envs
|
|
65
113
|
#
|
|
@@ -71,24 +119,6 @@ module Aro
|
|
|
71
119
|
TEST: :test
|
|
72
120
|
}
|
|
73
121
|
|
|
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
122
|
# ovar and ivar access
|
|
93
123
|
#
|
|
94
124
|
# example usage:
|
|
@@ -113,11 +143,11 @@ module Aro
|
|
|
113
143
|
# types used in definition
|
|
114
144
|
#
|
|
115
145
|
# example usage:
|
|
116
|
-
# Aro::Cor::DEF_TYPES[:INT][:validator].call(unvalid, Aro::Cor::DEF[:
|
|
146
|
+
# Aro::Cor::DEF_TYPES[:INT][:validator].call(unvalid, Aro::Cor::DEF[:])
|
|
117
147
|
DEF_TYPES = {
|
|
118
148
|
BOOL: {
|
|
119
149
|
name: Aro::Cor::TYPES[:BOOL],
|
|
120
|
-
description: I18n.t("cor.
|
|
150
|
+
description: I18n.t("cor.types.bool_description"),
|
|
121
151
|
converter: Proc.new{|v| v.kind_of?(TrueClass) ? true : false},
|
|
122
152
|
validator: Proc.new{|unvalid, k, v|
|
|
123
153
|
Aro::Cor.def_valid?(k, v) &&
|
|
@@ -126,7 +156,7 @@ module Aro
|
|
|
126
156
|
},
|
|
127
157
|
INT: {
|
|
128
158
|
name: Aro::Cor::TYPES[:INT],
|
|
129
|
-
description: I18n.t("cor.
|
|
159
|
+
description: I18n.t("cor.types.int_description"),
|
|
130
160
|
converter: Proc.new{|v| v.to_i},
|
|
131
161
|
validator: Proc.new{|unvalid, k, v|
|
|
132
162
|
Aro::V.say("validating #{k} (#{Aro::Cor::DEF_TYPES[:INT][:name]})")
|
|
@@ -142,7 +172,7 @@ module Aro
|
|
|
142
172
|
},
|
|
143
173
|
STRING: {
|
|
144
174
|
name: Aro::Cor::TYPES[:STRING],
|
|
145
|
-
description: I18n.t("cor.
|
|
175
|
+
description: I18n.t("cor.types.string_description"),
|
|
146
176
|
converter: Proc.new{|v| v.to_s},
|
|
147
177
|
validator: Proc.new{|unvalid, k, v|
|
|
148
178
|
Aro::Cor.def_valid?(k, v) &&
|
|
@@ -151,7 +181,7 @@ module Aro
|
|
|
151
181
|
},
|
|
152
182
|
VALUES: {
|
|
153
183
|
name: Aro::Cor::TYPES[:VALUES],
|
|
154
|
-
description: I18n.t("cor.
|
|
184
|
+
description: I18n.t("cor.types.values_description"),
|
|
155
185
|
converter: Proc.new{|v| v.to_s},
|
|
156
186
|
validator: Proc.new{|unvalid, k, v|
|
|
157
187
|
Aro::Cor.def_valid?(k, v) &&
|
|
@@ -211,7 +241,7 @@ module Aro
|
|
|
211
241
|
# adapts I18n translations to generate bash environment vars.
|
|
212
242
|
#
|
|
213
243
|
# example usage:
|
|
214
|
-
# Aro::Cor::DEF[:
|
|
244
|
+
# Aro::Cor::DEF[:ENV]
|
|
215
245
|
DEF = {
|
|
216
246
|
#
|
|
217
247
|
# => ivars
|
|
@@ -220,201 +250,100 @@ module Aro
|
|
|
220
250
|
type: Aro::Cor::TYPES[:VALUES],
|
|
221
251
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
222
252
|
value: Aro::Cor::ENVS[:PRODUCTION],
|
|
223
|
-
description: I18n.t("cor.env.description"),
|
|
253
|
+
description: I18n.t("cor.ivars.env.description"),
|
|
224
254
|
possible_values: {
|
|
225
|
-
development: I18n.t("cor.env.development_description"),
|
|
226
|
-
production: I18n.t("cor.env.production_description"),
|
|
227
|
-
test: I18n.t("cor.env.test_description"),
|
|
255
|
+
development: I18n.t("cor.ivars.env.development_description"),
|
|
256
|
+
production: I18n.t("cor.ivars.env.production_description"),
|
|
257
|
+
test: I18n.t("cor.ivars.env.test_description"),
|
|
228
258
|
}
|
|
229
259
|
},
|
|
230
260
|
VERBOSE: {
|
|
231
261
|
type: Aro::Cor::TYPES[:BOOL],
|
|
232
262
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
233
263
|
value: Aro::Cor::BOOLS[:FALSE],
|
|
234
|
-
description: I18n.t("cor.verbose_description"),
|
|
235
|
-
},
|
|
236
|
-
LOG_DATABASE: {
|
|
237
|
-
type: Aro::Cor::TYPES[:BOOL],
|
|
238
|
-
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
239
|
-
value: Aro::Cor::BOOLS[:FALSE],
|
|
240
|
-
description: I18n.t("cor.log_aro_db_description"),
|
|
264
|
+
description: I18n.t("cor.ivars.verbose_description"),
|
|
241
265
|
},
|
|
242
266
|
OSS_OM_HOME: {
|
|
243
267
|
type: Aro::Cor::TYPES[:STRING],
|
|
244
268
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
245
269
|
value: nil,
|
|
246
|
-
description: I18n.t("cor.oss_om_home.description"),
|
|
247
|
-
possible_values: {
|
|
248
|
-
any_valid_path: I18n.t("cor.oss_om_home.any_valid_path_description"),
|
|
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"),
|
|
270
|
+
description: I18n.t("cor.ivars.oss_om_home.description"),
|
|
257
271
|
possible_values: {
|
|
258
|
-
|
|
259
|
-
lanimret: I18n.t("cor.interface.lanimret_description")
|
|
272
|
+
path: I18n.t("cor.ivars.oss_om_home.path_description"),
|
|
260
273
|
}
|
|
261
274
|
},
|
|
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],
|
|
275
|
+
HIDE_F_OSS_OM_MENU: {
|
|
276
|
+
type: Aro::Cor::TYPES[:BOOL],
|
|
298
277
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
299
|
-
value: Aro::
|
|
300
|
-
|
|
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
|
-
),
|
|
278
|
+
value: Aro::Cor::BOOLS[:TRUE],
|
|
279
|
+
description: I18n.t("cor.ivars.hide_f_oss_om_description"),
|
|
307
280
|
},
|
|
308
|
-
|
|
309
|
-
type: Aro::Cor::TYPES[:
|
|
281
|
+
LOG_DATABASE: {
|
|
282
|
+
type: Aro::Cor::TYPES[:BOOL],
|
|
310
283
|
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
|
-
),
|
|
284
|
+
value: Aro::Cor::BOOLS[:FALSE],
|
|
285
|
+
description: I18n.t("cor.ivars.log_db_description"),
|
|
319
286
|
},
|
|
320
287
|
|
|
321
288
|
#
|
|
322
289
|
# => ovars
|
|
323
290
|
#
|
|
291
|
+
OSS_OM_FILE: {
|
|
292
|
+
type: Aro::Cor::TYPES[:STRING],
|
|
293
|
+
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
294
|
+
value: Aro::Mancy::NAME_FILE,
|
|
295
|
+
description: I18n.t("cor.ovars.OSS_OM_FILE_description"),
|
|
296
|
+
},
|
|
324
297
|
O: {
|
|
325
298
|
type: Aro::Cor::TYPES[:INT],
|
|
326
299
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
327
300
|
value: Aro::Mancy::O,
|
|
328
|
-
description: I18n.t("cor.
|
|
301
|
+
description: I18n.t("cor.ovars.O_description"),
|
|
329
302
|
},
|
|
330
303
|
S: {
|
|
331
304
|
type: Aro::Cor::TYPES[:INT],
|
|
332
305
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
333
306
|
value: Aro::Mancy::S,
|
|
334
|
-
description: I18n.t("cor.
|
|
307
|
+
description: I18n.t("cor.ovars.S_description"),
|
|
335
308
|
},
|
|
336
309
|
OS: {
|
|
337
310
|
type: Aro::Cor::TYPES[:INT],
|
|
338
311
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
339
312
|
value: Aro::Mancy::OS,
|
|
340
|
-
description: I18n.t("cor.
|
|
313
|
+
description: I18n.t("cor.ovars.OS_description"),
|
|
341
314
|
},
|
|
342
315
|
E: {
|
|
343
316
|
type: Aro::Cor::TYPES[:INT],
|
|
344
317
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
345
318
|
value: Aro::Mancy::E,
|
|
346
|
-
description: I18n.t("cor.
|
|
319
|
+
description: I18n.t("cor.ovars.E_description"),
|
|
347
320
|
},
|
|
348
321
|
N: {
|
|
349
322
|
type: Aro::Cor::TYPES[:INT],
|
|
350
323
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
351
324
|
value: Aro::Mancy::N,
|
|
352
|
-
description: I18n.t("cor.
|
|
353
|
-
},
|
|
354
|
-
NAME_FILE: {
|
|
355
|
-
type: Aro::Cor::TYPES[:STRING],
|
|
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"),
|
|
325
|
+
description: I18n.t("cor.ovars.N_description"),
|
|
371
326
|
},
|
|
372
|
-
|
|
373
|
-
type: Aro::Cor::TYPES[:
|
|
327
|
+
V: {
|
|
328
|
+
type: Aro::Cor::TYPES[:INT],
|
|
374
329
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
375
|
-
value: Aro::Mancy::
|
|
376
|
-
description: I18n.t("cor.
|
|
330
|
+
value: Aro::Mancy::V,
|
|
331
|
+
description: I18n.t("cor.ovars.V_description"),
|
|
377
332
|
},
|
|
378
333
|
}
|
|
379
334
|
|
|
380
|
-
def
|
|
381
|
-
|
|
335
|
+
def self.open!
|
|
336
|
+
cor_menu = Aro::Dom::DataBase.open_menu(:cor)
|
|
337
|
+
generate_cor_menu_items! if Aro::Mancy::S == cor_menu.menu_items.count
|
|
338
|
+
Aro::Dom::Ma_ain.open!(:cor)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def load_env!
|
|
382
342
|
unless File.exist?(Aro::Cor.cor_filepath)
|
|
383
343
|
generate_config
|
|
384
344
|
end
|
|
385
345
|
|
|
386
346
|
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
347
|
end
|
|
419
348
|
|
|
420
349
|
def self.cor_filepath
|
|
@@ -428,17 +357,12 @@ module Aro
|
|
|
428
357
|
Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:TEST].to_s
|
|
429
358
|
end
|
|
430
359
|
|
|
431
|
-
def self.
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
result = {
|
|
436
|
-
HEIGHT: height,
|
|
437
|
-
WIDTH: width,
|
|
438
|
-
DIVIDER: :".".to_s
|
|
439
|
-
}
|
|
360
|
+
def self.is_development?
|
|
361
|
+
Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:DEVELOPMENT].to_s
|
|
362
|
+
end
|
|
440
363
|
|
|
441
|
-
|
|
364
|
+
def self.is_production?
|
|
365
|
+
Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:PRODUCTION].to_s
|
|
442
366
|
end
|
|
443
367
|
|
|
444
368
|
# out vars
|
|
@@ -469,7 +393,7 @@ module Aro
|
|
|
469
393
|
# set ruby ENV key value
|
|
470
394
|
# only write to ruby ENV from here
|
|
471
395
|
ENV[Aro::Cor.ivar_k(k.to_s)] = converted
|
|
472
|
-
Aro::
|
|
396
|
+
Aro::D.say("#{k} set to #{converted}") unless converted.nil? || converted.empty?
|
|
473
397
|
return true
|
|
474
398
|
end
|
|
475
399
|
|
|
@@ -477,12 +401,7 @@ module Aro
|
|
|
477
401
|
k = k.upcase.to_sym
|
|
478
402
|
|
|
479
403
|
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
|
|
404
|
+
if k == :OSS_OM_HOME
|
|
486
405
|
unless Dir.exist?(new_value)
|
|
487
406
|
Aro::P.say("cannot set #{k} to #{new_value}. the directory does not exist.")
|
|
488
407
|
end
|
|
@@ -514,7 +433,6 @@ module Aro
|
|
|
514
433
|
end
|
|
515
434
|
end
|
|
516
435
|
|
|
517
|
-
# todo: add_to_docs
|
|
518
436
|
def self.ivars_dump
|
|
519
437
|
dump = []
|
|
520
438
|
Aro::Cor::DEF.select{|k, v|
|
|
@@ -539,6 +457,7 @@ module Aro
|
|
|
539
457
|
end
|
|
540
458
|
|
|
541
459
|
def source_config
|
|
460
|
+
return unless File.exist?(Aro::Cor.cor_filepath)
|
|
542
461
|
Aro::D.say(I18n.t("cor.source", name: Aro::Cor.cor_filepath))
|
|
543
462
|
File.read(Aro::Cor.cor_filepath).split("\n").select{|line|
|
|
544
463
|
line.match?(/export #{Aro::Cor::ARO_IVA_PREFIX}/)
|
|
@@ -547,7 +466,7 @@ module Aro
|
|
|
547
466
|
}.each{|kv|
|
|
548
467
|
Aro::D.say("variable_to_set: #{kv}")
|
|
549
468
|
result = Aro::Cor.instance.cor_set_ruby_env!(kv[0].gsub(Aro::Cor::ARO_IVA_PREFIX.to_s, ""), kv[1])
|
|
550
|
-
Aro::D.say("
|
|
469
|
+
Aro::D.say("ENV[#{kv[0]}] set successfully: #{result}")
|
|
551
470
|
}
|
|
552
471
|
|
|
553
472
|
invalid_defs = validate_config
|
|
@@ -565,7 +484,7 @@ module Aro
|
|
|
565
484
|
}
|
|
566
485
|
end
|
|
567
486
|
|
|
568
|
-
|
|
487
|
+
# from_memory true means write current config to file
|
|
569
488
|
def generate_config(from_memory = false)
|
|
570
489
|
# todo: localize generated config text
|
|
571
490
|
Aro::D.say(I18n.t("cor.generate", name: Aro::Cor.cor_filepath))
|
|
@@ -626,6 +545,30 @@ module Aro
|
|
|
626
545
|
write_config(lines)
|
|
627
546
|
end
|
|
628
547
|
|
|
548
|
+
private
|
|
549
|
+
|
|
550
|
+
def self.generate_cor_menu_items!
|
|
551
|
+
cor_menu = Aro::Dom::DataBase.open_menu(:cor)
|
|
552
|
+
return unless Aro::Mancy::S == cor_menu.menu_items.count
|
|
553
|
+
|
|
554
|
+
existing_item = cor_menu.menu_items.first
|
|
555
|
+
raise "missing existing item in #{self.name}.#{__method__}!" if existing_item.nil?
|
|
556
|
+
EXEC_METHODS.each{|method_name|
|
|
557
|
+
menu_item = existing_item || cor_menu.generate_new_item(method_name, for_type: :system)
|
|
558
|
+
|
|
559
|
+
cor_menu.rename_item(menu_item, method_name) unless existing_item.nil?
|
|
560
|
+
menu_item.aro_file.write!(
|
|
561
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
562
|
+
"#{:cor} #{method_name}",
|
|
563
|
+
self,
|
|
564
|
+
method_name
|
|
565
|
+
)
|
|
566
|
+
)
|
|
567
|
+
# clear existing item var
|
|
568
|
+
existing_item = nil unless existing_item.nil?
|
|
569
|
+
}
|
|
570
|
+
end
|
|
571
|
+
|
|
629
572
|
def write_config(lines)
|
|
630
573
|
File.open(Aro::Cor.cor_filepath, "w+") do |file|
|
|
631
574
|
file.write(lines.join("\n"))
|
|
@@ -691,16 +634,16 @@ module Aro
|
|
|
691
634
|
lines << "# => Aro::Cor::DEF_TYPES: #{v[:type]}"
|
|
692
635
|
case v[:type]
|
|
693
636
|
when Aro::Cor::DEF_TYPES[:BOOL][:name]
|
|
694
|
-
lines << "# => #{I18n.t("cor.
|
|
637
|
+
lines << "# => #{I18n.t("cor.types.bool_description")}"
|
|
695
638
|
when Aro::Cor::DEF_TYPES[:INT][:name]
|
|
696
|
-
lines << "# => #{I18n.t("cor.
|
|
639
|
+
lines << "# => #{I18n.t("cor.types.int_description")}"
|
|
697
640
|
lines << "# => #{I18n.t("cor.minimum")}: #{v[:min]}"
|
|
698
641
|
lines << "# => #{I18n.t("cor.maximum")}: #{v[:max]}"
|
|
699
642
|
when Aro::Cor::DEF_TYPES[:STRING][:name]
|
|
700
|
-
lines << "# => #{I18n.t("cor.
|
|
643
|
+
lines << "# => #{I18n.t("cor.types.string_description")}"
|
|
701
644
|
lines << "# => use \"double quotes\" if there are any spaces."
|
|
702
645
|
when Aro::Cor::DEF_TYPES[:VALUES][:name]
|
|
703
|
-
lines << "# => #{I18n.t("cor.
|
|
646
|
+
lines << "# => #{I18n.t("cor.types.values_description")}"
|
|
704
647
|
lines << "# => #{I18n.t("cor.possible_values")}:"
|
|
705
648
|
lines += lines_newline_comment
|
|
706
649
|
v[:possible_values].each{|name, description|
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
Aro::Dom::Ma_ain.open!(:git)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.status
|
|
28
|
+
Aro::P.say("system(git status)")
|
|
29
|
+
system(:"git status".to_s)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.log
|
|
33
|
+
Aro::P.say("system(git log)")
|
|
34
|
+
system(:"git log".to_s)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.config
|
|
38
|
+
Aro::P.say("system(git config list --local)")
|
|
39
|
+
system(:"git config list --local".to_s)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|