aro 0.2.7 → 0.2.9
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 +7 -2
- data/README.md +8 -7
- data/aro.gemspec +6 -3
- data/bin/oss_om +14 -1
- data/checksums/aro-0.2.8.gem.sha512 +1 -0
- data/checksums/aro-0.2.9.gem.sha512 +1 -0
- data/craft_docker-compose.template +59 -0
- data/locale/en.cor.yml +15 -11
- data/locale/en.yml +25 -1
- data/sys/aro/action.rb +35 -56
- data/sys/aro/book.rb +150 -0
- data/sys/aro/db/migrate/1793913841_create_menus.rb +1 -0
- data/sys/aro/db/migrate/1793913861_create_menu_items.rb +1 -0
- data/sys/aro/designer.rb +157 -37
- data/sys/aro/imports.rb +78 -0
- data/sys/aro/library.rb +202 -0
- data/sys/aro/locale.rb +4 -4
- data/sys/aro/mancy.rb +2 -2
- data/sys/aro/models/concerns/tar_go_for_root_sec.rb +1 -4
- data/sys/aro/models/cubicus.rb +39 -0
- data/sys/aro/models/data_base.rb +60 -13
- data/sys/aro/models/directory.rb +1 -5
- data/sys/aro/models/file.rb +1 -1
- data/sys/aro/models/glyph.rb +69 -0
- data/sys/aro/models/menu.rb +43 -14
- data/sys/aro/models/menu_item.rb +6 -10
- data/sys/aro/models/objecticus.rb +28 -0
- data/sys/aro/models/perspecticus.rb +28 -0
- data/sys/aro/open_system/projector.rb +103 -0
- data/sys/aro/oss_open_menu.rb +29 -48
- data/sys/aro/oss_open_system.rb +117 -0
- data/sys/aro/p.rb +0 -11
- data/sys/aro/plugins.rb +106 -0
- data/sys/aro/settings/cor.rb +97 -54
- data/sys/aro/settings/git.rb +0 -25
- data/sys/aro/settings/ssh.rb +15 -30
- data/sys/aro/store.rb +34 -15
- data/sys/aro/v.rb +1 -1
- data/sys/ma_ain.rb +115 -36
- data/sys/reiquire.rb +1 -0
- data/sys/shr/prompt.rb +14 -3
- data/sys/shr/version.rb +1 -4
- data/tasks/make.rake +2 -3
- metadata +38 -5
- data/sys/aro/r.rb +0 -22
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
oss_open_system.rb
|
|
6
|
+
|
|
7
|
+
aro dom oss_open_system.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module Aro
|
|
14
|
+
module Dom
|
|
15
|
+
class Oss_OpenSystem
|
|
16
|
+
include Singleton
|
|
17
|
+
|
|
18
|
+
attr_accessor :menu_item_uuid
|
|
19
|
+
attr_accessor :runtime_data
|
|
20
|
+
attr_accessor :access_validated
|
|
21
|
+
attr_accessor :f_dot_mutex
|
|
22
|
+
|
|
23
|
+
EXEC_METHODS = [
|
|
24
|
+
:start!
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
DEFAULT_RUNTIME = {
|
|
28
|
+
f_dot_action_data: nil
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
def initialize
|
|
32
|
+
self.menu_item_uuid = nil
|
|
33
|
+
self.runtime_data = Aro::Dom::Oss_OpenSystem::DEFAULT_RUNTIME.dup.stringify_keys
|
|
34
|
+
self.f_dot_mutex = Mutex.new
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.start!(menu_item_uuid = nil, action_data = {})
|
|
38
|
+
self.instance.access_validated = false
|
|
39
|
+
self.instance.menu_item_uuid = menu_item_uuid
|
|
40
|
+
menu_item = self.instance.get_menu_item
|
|
41
|
+
|
|
42
|
+
raise "invalid menu_item! #{self.instance.menu_item_uuid}" if menu_item.nil?
|
|
43
|
+
|
|
44
|
+
self.instance.runtime_data = action_data.dup
|
|
45
|
+
|
|
46
|
+
puts TTY::Font.new(:standard).write(
|
|
47
|
+
:open_system.to_s,
|
|
48
|
+
letter_spacing: 1
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
raise "invalid action data for #{menu_item.inspect}!" if action_data.nil? ||
|
|
52
|
+
!action_data.kind_of?(Hash)
|
|
53
|
+
|
|
54
|
+
run_f_dot_authentication!
|
|
55
|
+
|
|
56
|
+
Aro::P.say("#{self.name} f_dot access validated: #{self.instance.access_validated}")
|
|
57
|
+
return unless self.instance.access_validated
|
|
58
|
+
|
|
59
|
+
Aro::Dom::Ma_ain.open!(:open_system)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def write_runtime!
|
|
63
|
+
get_menu_item.aro_file.write!({
|
|
64
|
+
action_data: self.runtime_data
|
|
65
|
+
})
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.run_f_dot_authentication!
|
|
69
|
+
write_state_callback = Proc.new{|incoming_data, validated = false|
|
|
70
|
+
Aro::Dom::Oss_OpenSystem.instance.f_dot_mutex.synchronize do
|
|
71
|
+
Aro::Dom::Oss_OpenSystem.instance.access_validated = true if validated
|
|
72
|
+
Aro::Dom::Oss_OpenSystem.instance.update_runtime_f_dot(incoming_data)
|
|
73
|
+
end
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
FDot::Based::Processor.initialize_with_data(
|
|
77
|
+
Aro::Mancy.root_dir,
|
|
78
|
+
write_state_callback,
|
|
79
|
+
self.instance.runtime_data["f_dot_action_data"],
|
|
80
|
+
true # one_move_mode
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def update_runtime_f_dot(action_data)
|
|
85
|
+
if action_data.nil? ||
|
|
86
|
+
!action_data.kind_of?(Hash)
|
|
87
|
+
|
|
88
|
+
raise "invalid action data for #{action_data.inspect} in #{__method__}!"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
self.runtime_data["f_dot_action_data"] = action_data
|
|
92
|
+
|
|
93
|
+
self.write_runtime!
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def get_menu_item
|
|
97
|
+
Aro::Dom::MenuItem.find_by(uuid: self.menu_item_uuid)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def self.open_projector!(glyph)
|
|
101
|
+
cubicus_menu = glyph.menu
|
|
102
|
+
raise "invalid cubicus for glyph!: #{glyph}" if cubicus_menu.nil? ||
|
|
103
|
+
!cubicus_menu.kind_of?(Aro::Dom::Cubicus)
|
|
104
|
+
|
|
105
|
+
action_data = glyph.store.safe_get_key("action_data") || {}
|
|
106
|
+
|
|
107
|
+
raise "invalid action data! #{action_data}" unless action_data.kind_of?(Hash)
|
|
108
|
+
|
|
109
|
+
projector = Aro::Dom::Projector.new(cubicus_menu, glyph, action_data)
|
|
110
|
+
projector.project!
|
|
111
|
+
|
|
112
|
+
Aro::P.less(projector.inspect)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
data/sys/aro/p.rb
CHANGED
|
@@ -18,17 +18,6 @@ module Aro
|
|
|
18
18
|
def self.say(message)
|
|
19
19
|
super("#{Aro::Dom::Ma_ain.ps1_display || Aro::Mancy.ps1_display}#{normalize_message(message)}")
|
|
20
20
|
end
|
|
21
|
-
|
|
22
|
-
def self.default_select(display_text, options)
|
|
23
|
-
Aro::P.p.select(
|
|
24
|
-
Aro::Dom::Ma_ain.mini_hud_for(display_text),
|
|
25
|
-
options,
|
|
26
|
-
show_help: :always,
|
|
27
|
-
cycle: true,
|
|
28
|
-
per_page: 11
|
|
29
|
-
)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
21
|
end
|
|
33
22
|
end
|
|
34
23
|
|
data/sys/aro/plugins.rb
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
plugins.rb
|
|
6
|
+
|
|
7
|
+
aro dom plugins.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module Aro
|
|
14
|
+
module Dom
|
|
15
|
+
class Plugins
|
|
16
|
+
|
|
17
|
+
def self.choose_plugin
|
|
18
|
+
ensure_plugins_dir_exists!
|
|
19
|
+
Aro::P.say(I18n.t("open_menu.plugins.choose_plugin_description"))
|
|
20
|
+
Aro::P.say(I18n.t("open_menu.plugins.choose_plugin_sample_info"))
|
|
21
|
+
|
|
22
|
+
options = [
|
|
23
|
+
{name: :back, value: :back}
|
|
24
|
+
] + Dir[::File.join(plugins_dir, "*")].map{|f|
|
|
25
|
+
{name: ::File.basename(f), value: f}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
selected_option = Aro::P.default_select(
|
|
29
|
+
I18n.t("open_menu.plugins.select_plugin"),
|
|
30
|
+
options
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return false if selected_option.kind_of?(Symbol) &&
|
|
34
|
+
selected_option == :back
|
|
35
|
+
|
|
36
|
+
raise "invalid file path! #{selected_option}" unless File.exist?(selected_option)
|
|
37
|
+
|
|
38
|
+
Aro::P.say("selected plugin: #{selected_option}")
|
|
39
|
+
confirmed = Aro::P.p.ask(
|
|
40
|
+
I18n.t(
|
|
41
|
+
"open_menu.plugins.confirm_plugin",
|
|
42
|
+
file_name: File.basename(selected_option)
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
if :y.to_s != confirmed
|
|
47
|
+
Aro::P.say(I18n.t("open_menu.plugins.user_cancelled"))
|
|
48
|
+
return false
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# todo: validate_plugin_here
|
|
52
|
+
|
|
53
|
+
# ready to read plugin
|
|
54
|
+
selected_option
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.plugins_dir
|
|
58
|
+
::File.join(Aro::Cor.ivar(:OSS_OM_HOME), :plugins.to_s)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
def self.ensure_plugins_dir_exists!
|
|
64
|
+
FileUtils.mkdir_p(plugins_dir) unless Dir.exist?(plugins_dir)
|
|
65
|
+
ensure_plugin_default_files_exists!
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.sample_plugin_raw
|
|
69
|
+
[
|
|
70
|
+
"# frozen_string_literal: true\n",
|
|
71
|
+
"=begin\n",
|
|
72
|
+
" sample_plugin.rb\n",
|
|
73
|
+
" aro dom sample plugin\n",
|
|
74
|
+
" by #{`whoami`.strip}\n",
|
|
75
|
+
"=end\n",
|
|
76
|
+
"module Aro",
|
|
77
|
+
" module Dom",
|
|
78
|
+
" class SamplePlugin",
|
|
79
|
+
" def self.oss_om_start!(plugin_data = {})",
|
|
80
|
+
" Aro::P.say(self.name)",
|
|
81
|
+
" Aro::P.say(__method__)",
|
|
82
|
+
" Aro::P.say(\"running oss_om sample plugin...\")",
|
|
83
|
+
" plugin_data[\"sample_plugin_key\"] = \"hello_from_oss_om_plugin\"",
|
|
84
|
+
" plugin_data",
|
|
85
|
+
" end",
|
|
86
|
+
" end",
|
|
87
|
+
" end",
|
|
88
|
+
"end",
|
|
89
|
+
"\n",
|
|
90
|
+
].join("\n")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def self.ensure_plugin_default_files_exists!
|
|
94
|
+
[
|
|
95
|
+
[".keep", ""],
|
|
96
|
+
["sample_plugin.rb", sample_plugin_raw]
|
|
97
|
+
].each{|a|
|
|
98
|
+
file_path = ::File.join(plugins_dir, a[Aro::Mancy::O])
|
|
99
|
+
::File.open(file_path, "w+") {|f|
|
|
100
|
+
f.write(a[Aro::Mancy::S])
|
|
101
|
+
} unless ::File.exist?(file_path)
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
data/sys/aro/settings/cor.rb
CHANGED
|
@@ -19,7 +19,7 @@ module Aro
|
|
|
19
19
|
EXEC_METHODS = [
|
|
20
20
|
:print_env,
|
|
21
21
|
:print_cor_def,
|
|
22
|
-
:
|
|
22
|
+
:edit_ivars
|
|
23
23
|
]
|
|
24
24
|
|
|
25
25
|
def self.print_env
|
|
@@ -34,17 +34,70 @@ module Aro
|
|
|
34
34
|
|
|
35
35
|
def self.print_cor_def
|
|
36
36
|
self.instance.source_config
|
|
37
|
-
Aro::P.
|
|
38
|
-
Aro::P.say("\n" + Aro::Cor::DEF.map{|k, v|
|
|
39
|
-
"#{k}: " + JSON.pretty_generate(Aro::Cor::DEF[k])
|
|
40
|
-
}.join("\n"))
|
|
37
|
+
Aro::P.less(JSON.pretty_generate(Aro::Cor::DEF))
|
|
41
38
|
end
|
|
42
39
|
|
|
43
|
-
def self.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
)
|
|
52
|
+
|
|
53
|
+
if selected_def_key == :back
|
|
54
|
+
Aro::Dom::Ma_ain.open!(:cor)
|
|
55
|
+
return
|
|
56
|
+
end
|
|
57
|
+
|
|
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
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
set_ivar(selected_def_key, new_value)
|
|
100
|
+
Aro::Dom::Ma_ain.open!(:cor)
|
|
48
101
|
end
|
|
49
102
|
|
|
50
103
|
ARO_IVA_PREFIX = :ARO_IVA_
|
|
@@ -188,7 +241,7 @@ module Aro
|
|
|
188
241
|
# adapts I18n translations to generate bash environment vars.
|
|
189
242
|
#
|
|
190
243
|
# example usage:
|
|
191
|
-
# Aro::Cor::DEF[:
|
|
244
|
+
# Aro::Cor::DEF[:ENV]
|
|
192
245
|
DEF = {
|
|
193
246
|
#
|
|
194
247
|
# => ivars
|
|
@@ -197,33 +250,39 @@ module Aro
|
|
|
197
250
|
type: Aro::Cor::TYPES[:VALUES],
|
|
198
251
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
199
252
|
value: Aro::Cor::ENVS[:PRODUCTION],
|
|
200
|
-
description: I18n.t("cor.env.description"),
|
|
253
|
+
description: I18n.t("cor.ivars.env.description"),
|
|
201
254
|
possible_values: {
|
|
202
|
-
development: I18n.t("cor.env.development_description"),
|
|
203
|
-
production: I18n.t("cor.env.production_description"),
|
|
204
|
-
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"),
|
|
205
258
|
}
|
|
206
259
|
},
|
|
207
|
-
|
|
260
|
+
VERBOSE: {
|
|
208
261
|
type: Aro::Cor::TYPES[:BOOL],
|
|
209
262
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
210
263
|
value: Aro::Cor::BOOLS[:FALSE],
|
|
211
|
-
description: I18n.t("cor.
|
|
264
|
+
description: I18n.t("cor.ivars.verbose_description"),
|
|
212
265
|
},
|
|
213
266
|
OSS_OM_HOME: {
|
|
214
267
|
type: Aro::Cor::TYPES[:STRING],
|
|
215
268
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
216
269
|
value: nil,
|
|
217
|
-
description: I18n.t("cor.oss_om_home.description"),
|
|
270
|
+
description: I18n.t("cor.ivars.oss_om_home.description"),
|
|
218
271
|
possible_values: {
|
|
219
|
-
path: I18n.t("cor.oss_om_home.path_description"),
|
|
272
|
+
path: I18n.t("cor.ivars.oss_om_home.path_description"),
|
|
220
273
|
}
|
|
221
274
|
},
|
|
222
|
-
|
|
275
|
+
HIDE_F_OSS_OM_MENU: {
|
|
276
|
+
type: Aro::Cor::TYPES[:BOOL],
|
|
277
|
+
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
278
|
+
value: Aro::Cor::BOOLS[:TRUE],
|
|
279
|
+
description: I18n.t("cor.ivars.hide_f_oss_om_description"),
|
|
280
|
+
},
|
|
281
|
+
LOG_DATABASE: {
|
|
223
282
|
type: Aro::Cor::TYPES[:BOOL],
|
|
224
283
|
access: Aro::Cor::DEF_ACCESS[:WRITE],
|
|
225
284
|
value: Aro::Cor::BOOLS[:FALSE],
|
|
226
|
-
description: I18n.t("cor.
|
|
285
|
+
description: I18n.t("cor.ivars.log_db_description"),
|
|
227
286
|
},
|
|
228
287
|
|
|
229
288
|
#
|
|
@@ -233,49 +292,47 @@ module Aro
|
|
|
233
292
|
type: Aro::Cor::TYPES[:STRING],
|
|
234
293
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
235
294
|
value: Aro::Mancy::NAME_FILE,
|
|
236
|
-
description: I18n.t("cor.
|
|
295
|
+
description: I18n.t("cor.ovars.OSS_OM_FILE_description"),
|
|
237
296
|
},
|
|
238
297
|
O: {
|
|
239
298
|
type: Aro::Cor::TYPES[:INT],
|
|
240
299
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
241
300
|
value: Aro::Mancy::O,
|
|
242
|
-
description: I18n.t("cor.
|
|
301
|
+
description: I18n.t("cor.ovars.O_description"),
|
|
243
302
|
},
|
|
244
303
|
S: {
|
|
245
304
|
type: Aro::Cor::TYPES[:INT],
|
|
246
305
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
247
306
|
value: Aro::Mancy::S,
|
|
248
|
-
description: I18n.t("cor.
|
|
307
|
+
description: I18n.t("cor.ovars.S_description"),
|
|
249
308
|
},
|
|
250
309
|
OS: {
|
|
251
310
|
type: Aro::Cor::TYPES[:INT],
|
|
252
311
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
253
312
|
value: Aro::Mancy::OS,
|
|
254
|
-
description: I18n.t("cor.
|
|
313
|
+
description: I18n.t("cor.ovars.OS_description"),
|
|
255
314
|
},
|
|
256
315
|
E: {
|
|
257
316
|
type: Aro::Cor::TYPES[:INT],
|
|
258
317
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
259
318
|
value: Aro::Mancy::E,
|
|
260
|
-
description: I18n.t("cor.
|
|
319
|
+
description: I18n.t("cor.ovars.E_description"),
|
|
261
320
|
},
|
|
262
321
|
N: {
|
|
263
322
|
type: Aro::Cor::TYPES[:INT],
|
|
264
323
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
265
324
|
value: Aro::Mancy::N,
|
|
266
|
-
description: I18n.t("cor.
|
|
325
|
+
description: I18n.t("cor.ovars.N_description"),
|
|
267
326
|
},
|
|
268
|
-
|
|
327
|
+
V: {
|
|
269
328
|
type: Aro::Cor::TYPES[:INT],
|
|
270
329
|
access: Aro::Cor::DEF_ACCESS[:READ],
|
|
271
330
|
value: Aro::Mancy::V,
|
|
272
|
-
description: I18n.t("cor.
|
|
331
|
+
description: I18n.t("cor.ovars.V_description"),
|
|
273
332
|
},
|
|
274
333
|
}
|
|
275
334
|
|
|
276
335
|
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
336
|
Aro::Dom::Ma_ain.open!(:cor)
|
|
280
337
|
end
|
|
281
338
|
|
|
@@ -298,6 +355,14 @@ module Aro
|
|
|
298
355
|
Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:TEST].to_s
|
|
299
356
|
end
|
|
300
357
|
|
|
358
|
+
def self.is_development?
|
|
359
|
+
Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:DEVELOPMENT].to_s
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
def self.is_production?
|
|
363
|
+
Aro::Cor.ivar(:ENV) == Aro::Cor::ENVS[:PRODUCTION].to_s
|
|
364
|
+
end
|
|
365
|
+
|
|
301
366
|
# out vars
|
|
302
367
|
def self.ovar(suffix)
|
|
303
368
|
Aro::Cor::DEF[suffix][:value]
|
|
@@ -399,7 +464,7 @@ module Aro
|
|
|
399
464
|
}.each{|kv|
|
|
400
465
|
Aro::D.say("variable_to_set: #{kv}")
|
|
401
466
|
result = Aro::Cor.instance.cor_set_ruby_env!(kv[0].gsub(Aro::Cor::ARO_IVA_PREFIX.to_s, ""), kv[1])
|
|
402
|
-
Aro::D.say("
|
|
467
|
+
Aro::D.say("ENV[#{kv[0]}] set successfully: #{result}")
|
|
403
468
|
}
|
|
404
469
|
|
|
405
470
|
invalid_defs = validate_config
|
|
@@ -480,28 +545,6 @@ module Aro
|
|
|
480
545
|
|
|
481
546
|
private
|
|
482
547
|
|
|
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
|
-
|
|
505
548
|
def write_config(lines)
|
|
506
549
|
File.open(Aro::Cor.cor_filepath, "w+") do |file|
|
|
507
550
|
file.write(lines.join("\n"))
|
data/sys/aro/settings/git.rb
CHANGED
|
@@ -21,7 +21,6 @@ module Aro
|
|
|
21
21
|
]
|
|
22
22
|
|
|
23
23
|
def self.open!
|
|
24
|
-
generate_git_menu_items!
|
|
25
24
|
Aro::Dom::Ma_ain.open!(:git)
|
|
26
25
|
end
|
|
27
26
|
|
|
@@ -40,30 +39,6 @@ module Aro
|
|
|
40
39
|
system(:"git config list --local".to_s)
|
|
41
40
|
end
|
|
42
41
|
|
|
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
42
|
end
|
|
68
43
|
end
|
|
69
44
|
end
|
data/sys/aro/settings/ssh.rb
CHANGED
|
@@ -20,10 +20,15 @@ module Aro
|
|
|
20
20
|
ID_KEY_BASE = :id_oss_om
|
|
21
21
|
|
|
22
22
|
def self.open!
|
|
23
|
-
generate_ssh_menu_items!
|
|
24
23
|
Aro::Dom::Ma_ain.open!(:ssh)
|
|
25
24
|
end
|
|
26
25
|
|
|
26
|
+
def self.encryption_installed?
|
|
27
|
+
::File.exist?(id_key_path) &&
|
|
28
|
+
::File.exist?("#{id_key_path}.pub") &&
|
|
29
|
+
!encrypt!({not: :equal}).kind_of?(Hash)
|
|
30
|
+
end
|
|
31
|
+
|
|
27
32
|
def self.print_public_key
|
|
28
33
|
Aro::P.less(::File.read("#{id_key_path}.pub"))
|
|
29
34
|
end
|
|
@@ -75,45 +80,25 @@ module Aro
|
|
|
75
80
|
end
|
|
76
81
|
|
|
77
82
|
def self.id_key_path
|
|
78
|
-
::File.join(Aro::Cor.ivar(:OSS_OM_HOME), ID_KEY_BASE.to_s)
|
|
83
|
+
id_path = ::File.join(Aro::Cor.ivar(:OSS_OM_HOME), Aro::Dom::Ssh::ID_KEY_BASE.to_s)
|
|
84
|
+
raise "missing_id_key!" if Aro::Dom::Ma_ain.is_initialized? && !::File.exist?(id_path)
|
|
85
|
+
id_path
|
|
79
86
|
end
|
|
80
87
|
|
|
81
88
|
private
|
|
82
89
|
|
|
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
90
|
def self.encrypt!(decrypted_json)
|
|
106
|
-
Aro::Dom::Ma_ain.
|
|
107
|
-
puts __method__
|
|
108
|
-
puts :expects_decrypted_json
|
|
91
|
+
# Aro::Dom::Ma_ain.sane_backtrace!
|
|
92
|
+
# puts __method__
|
|
93
|
+
# puts :expects_decrypted_json
|
|
109
94
|
|
|
110
95
|
return decrypted_json
|
|
111
96
|
end
|
|
112
97
|
|
|
113
98
|
def self.decrypt!(encrypted_json)
|
|
114
|
-
Aro::Dom::Ma_ain.
|
|
115
|
-
puts __method__
|
|
116
|
-
puts :expects_encrypted_json
|
|
99
|
+
# Aro::Dom::Ma_ain.sane_backtrace!
|
|
100
|
+
# puts __method__
|
|
101
|
+
# puts :expects_encrypted_json
|
|
117
102
|
|
|
118
103
|
return encrypted_json
|
|
119
104
|
end
|
data/sys/aro/store.rb
CHANGED
|
@@ -29,22 +29,16 @@ class Aro::Dom::Store
|
|
|
29
29
|
@cache = {} # clear'd
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def self.
|
|
32
|
+
def self.save_file!(aro_file, updates)
|
|
33
33
|
return if aro_file.nil?
|
|
34
34
|
unless ::File.exist?(aro_file.aro_file_path)
|
|
35
35
|
::File.write(aro_file.aro_file_path, {}.to_json)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
39
|
-
puts :todo_validate_updates_or_depricate
|
|
40
|
-
puts __method__
|
|
41
|
-
|
|
42
|
-
|
|
43
38
|
store_instance = Aro::Dom::Ma_ain.instance.get_store_for(aro_file)
|
|
44
39
|
updates.each{|k, v|
|
|
45
|
-
|
|
46
40
|
store_instance.save_key_value_pair(k, v)
|
|
47
|
-
Aro::
|
|
41
|
+
Aro::D.say([
|
|
48
42
|
"reading in #{k} after setting to #{v} in #{aro_file.aro_file_path}",
|
|
49
43
|
"got value => #{store_instance.safe_get_key(k)}"
|
|
50
44
|
])
|
|
@@ -55,33 +49,58 @@ class Aro::Dom::Store
|
|
|
55
49
|
set_key(k, v)
|
|
56
50
|
end
|
|
57
51
|
|
|
58
|
-
def save_exec_oss_om_params!(
|
|
52
|
+
def save_exec_oss_om_params!(
|
|
53
|
+
label,
|
|
54
|
+
oss_om_const,
|
|
55
|
+
oss_om_method,
|
|
56
|
+
oss_om_params = [],
|
|
57
|
+
oss_om_data = {}
|
|
58
|
+
)
|
|
59
59
|
Aro::P.say(__method__)
|
|
60
60
|
Aro::Dom::Ma_ain.instance.store_mutex.synchronize do
|
|
61
|
-
built = self.class.build_exec_oss_om_params!(
|
|
61
|
+
built = self.class.build_exec_oss_om_params!(
|
|
62
|
+
label,
|
|
63
|
+
oss_om_const,
|
|
64
|
+
oss_om_method,
|
|
65
|
+
oss_om_params,
|
|
66
|
+
oss_om_data
|
|
67
|
+
)
|
|
62
68
|
built.each{|k, v| self.set_key(k, v)}
|
|
63
69
|
end
|
|
64
70
|
end
|
|
65
71
|
|
|
66
|
-
def self.build_exec_oss_om_params!(
|
|
72
|
+
def self.build_exec_oss_om_params!(
|
|
73
|
+
label,
|
|
74
|
+
oss_om_const,
|
|
75
|
+
oss_om_method,
|
|
76
|
+
oss_om_params = [],
|
|
77
|
+
oss_om_data = {}
|
|
78
|
+
)
|
|
67
79
|
Aro::P.say(__method__)
|
|
68
80
|
# {
|
|
69
81
|
# action_name:,
|
|
70
82
|
# action_key: Aro::Dom::Action::TYPES[:OSS_OM][:key],
|
|
71
83
|
# action_params: {
|
|
72
84
|
# aro_class_name:,
|
|
73
|
-
# aro_class_method
|
|
85
|
+
# aro_class_method:,
|
|
86
|
+
# aro_call_params:,
|
|
74
87
|
# }
|
|
88
|
+
# action_data:
|
|
75
89
|
# }
|
|
76
|
-
raise "invalid oss_om_const!" unless Aro::Dom::Oss_OpenMenu::EXEC_CLASSES.include?(oss_om_const.name)
|
|
90
|
+
raise "invalid oss_om_const! #{oss_om_const}" unless Aro::Dom::Oss_OpenMenu::EXEC_CLASSES.include?(oss_om_const.name)
|
|
77
91
|
raise "invalid oss_om_method! #{oss_om_method}" unless oss_om_const.methods.include?(oss_om_method.to_sym)
|
|
92
|
+
|
|
93
|
+
# todo: validate oss_om_params && oss_om_data
|
|
94
|
+
|
|
78
95
|
{
|
|
79
96
|
action_name: label,
|
|
80
97
|
action_key: :exec_oss_om,
|
|
81
98
|
action_params: {
|
|
82
99
|
aro_class_name: oss_om_const.name,
|
|
83
|
-
aro_class_method: oss_om_method
|
|
84
|
-
|
|
100
|
+
aro_class_method: oss_om_method,
|
|
101
|
+
aro_call_params: oss_om_params || []
|
|
102
|
+
},
|
|
103
|
+
action_data: oss_om_data.stringify_keys
|
|
85
104
|
}
|
|
86
105
|
end
|
|
87
106
|
|