aro 0.2.5 → 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/.gitignore +2 -2
- data/.ruby-version +1 -0
- data/Gemfile.lock +109 -89
- data/README.md +10 -54
- data/aro.gemspec +12 -12
- data/bin/oss_om +17 -0
- data/checksums/aro-0.2.5.gem.sha512 +1 -0
- data/checksums/aro-0.2.6.gem.sha512 +1 -0
- data/checksums/aro-0.2.7.gem.sha512 +1 -0
- data/listen.rb +1 -1
- data/locale/en.cor.yml +22 -36
- data/locale/en.menu_items.yml +2 -0
- data/locale/en.menus.yml +2 -0
- data/locale/en.yml +14 -55
- data/sys/aro/action.rb +153 -0
- data/sys/aro/d.rb +6 -3
- data/sys/aro/db/migrate/.DS_Store +0 -0
- data/sys/aro/db/migrate/1793913747_create_data_bases.rb +15 -0
- data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +16 -0
- data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +14 -0
- data/sys/aro/db/migrate/1793913841_create_menus.rb +13 -0
- data/sys/aro/db/migrate/1793913861_create_menu_items.rb +15 -0
- data/sys/aro/db.rb +62 -37
- data/sys/aro/designer.rb +350 -0
- data/sys/aro/locale.rb +138 -0
- data/sys/aro/mancy.rb +30 -38
- data/sys/aro/models/concerns/.keep +0 -0
- data/sys/aro/models/concerns/tar_go_for_root_sec.rb +37 -0
- data/sys/aro/models/concerns/uuid.rb +31 -0
- data/sys/aro/models/data_base.rb +122 -0
- data/sys/aro/models/directory.rb +46 -0
- data/sys/aro/models/file.rb +29 -0
- data/sys/aro/models/menu.rb +91 -0
- data/sys/aro/models/menu_item.rb +113 -0
- data/sys/aro/oss_open_menu.rb +331 -0
- data/sys/aro/p.rb +15 -6
- data/sys/aro/r.rb +3 -2
- data/sys/aro/settings/cor.rb +602 -0
- data/sys/aro/settings/git.rb +69 -0
- data/sys/aro/settings/ssh.rb +123 -0
- data/sys/aro/store.rb +198 -0
- data/sys/aro/v.rb +4 -2
- data/sys/aro.rb +3 -2
- data/sys/ma_ain.rb +202 -0
- data/sys/reiquire.rb +133 -25
- data/sys/shr/.DS_Store +0 -0
- data/sys/shr/prompt.rb +13 -2
- data/sys/shr/version.rb +8 -2
- data/tasks/make.rake +2 -1
- metadata +65 -120
- data/bin/aos +0 -31
- data/bin/aro +0 -50
- data/bin/ino +0 -22
- data/ino_rules_todo.txt +0 -28
- data/locale/en.abot.yml +0 -81
- data/locale/en.amg.yml +0 -44
- data/locale/en.aos.yml +0 -40
- data/locale/en.cards.yml +0 -519
- data/locale/en.data.yml +0 -30
- data/locale/en.dom.yml +0 -47
- data/locale/en.flie.yml +0 -29
- data/locale/en.ino.yml +0 -9
- data/locale/en.usage.yml +0 -219
- data/sys/aos/abot.rb +0 -254
- data/sys/aos/amg.rb +0 -184
- data/sys/aos/aos.rb +0 -672
- data/sys/aos/cor.rb +0 -770
- data/sys/aos/data.rb +0 -117
- data/sys/aos/db/migrate/1765148774_create_yous.rb +0 -20
- data/sys/aos/db/migrate/1765762724_create_ilibs.rb +0 -22
- data/sys/aos/db/migrate/1765907766_create_ilogs.rb +0 -18
- data/sys/aos/db/migrate/1765933985_create_agodos.rb +0 -22
- data/sys/aos/db/migrate/1766203888_create_fpxies.rb +0 -18
- data/sys/aos/db.rb +0 -105
- data/sys/aos/flie.rb +0 -144
- data/sys/aos/models/agodo.rb +0 -103
- data/sys/aos/models/fpxy.rb +0 -26
- data/sys/aos/models/ilib.rb +0 -46
- data/sys/aos/models/ilog.rb +0 -27
- data/sys/aos/models/you.rb +0 -138
- data/sys/aos/s.rb +0 -26
- data/sys/aos/vws/base.rb +0 -159
- data/sys/aos/vws/dom.rb +0 -32
- data/sys/aos/vws/games/abot.rb +0 -21
- data/sys/aos/vws/games/ino.rb +0 -21
- data/sys/aos/vws/games/teck.rb +0 -122
- data/sys/aos/vws/games.rb +0 -19
- data/sys/aos/vws/home.rb +0 -23
- data/sys/aos/vws/know/body.rb +0 -19
- data/sys/aos/vws/know/mind.rb +0 -19
- data/sys/aos/vws/know/spirit.rb +0 -19
- data/sys/aos/vws/know.rb +0 -19
- data/sys/aos/vws/root/amg.rb +0 -21
- data/sys/aos/vws/root/config.rb +0 -21
- data/sys/aos/vws/root/data.rb +0 -21
- data/sys/aos/vws/root/flie.rb +0 -21
- data/sys/aos/vws/root.rb +0 -19
- data/sys/aos/vws/welcome/waite.rb +0 -31
- data/sys/aos/vws/welcome/winner.rb +0 -19
- data/sys/aos/vws/welcome.rb +0 -66
- 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/db/migrate/1768856981_create_scrolls.rb +0 -20
- data/sys/aro/db/migrate/1768858841_create_legends.rb +0 -16
- data/sys/aro/db/migrate/1768858967_create_stories.rb +0 -17
- data/sys/aro/db/migrate/1768859060_create_chapters.rb +0 -15
- data/sys/aro/db/migrate/1768859126_create_statements.rb +0 -22
- data/sys/aro/db/migrate/1768859144_create_players.rb +0 -18
- data/sys/aro/ino.rb +0 -64
- data/sys/aro/models/chapter.rb +0 -18
- data/sys/aro/models/legend.rb +0 -28
- data/sys/aro/models/player.rb +0 -17
- data/sys/aro/models/scroll.rb +0 -46
- data/sys/aro/models/statement.rb +0 -14
- data/sys/aro/models/story.rb +0 -28
- data/sys/aro/models/teck.rb +0 -260
- data/sys/aro/models/tlog.rb +0 -21
- data/sys/cli/constants.rb +0 -50
- data/sys/cli/create.rb +0 -23
- data/sys/cli/dom.rb +0 -43
- data/sys/cli/nterface.rb +0 -37
- data/sys/cli/teck.rb +0 -108
- data/sys/cli/usage.rb +0 -29
- data/sys/cli.rb +0 -24
- data/sys/dom/d.rb +0 -138
- data/sys/dom/dom.rb +0 -215
- data/sys/dom/p.rb +0 -17
- data/sys/fpx.rb +0 -104
- data/sys/shr/ilib/crs/CMakeLists.txt +0 -12
- data/sys/shr/ilib/crs/compile.sh +0 -5
- data/sys/shr/ilib/crs/crs.c +0 -24
- data/sys/shr/ilib/crs/crs.o +0 -0
- data/sys/shr/ilib/crs/libcrs.so +0 -0
- data/sys/shr/t.rb +0 -74
|
@@ -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
|
data/sys/aro/store.rb
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
store.rb
|
|
6
|
+
|
|
7
|
+
json data store
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
class Aro::Dom::Store
|
|
14
|
+
attr_accessor :is_open, :cache, :clear_flag, :parser_error, :open_file_path
|
|
15
|
+
|
|
16
|
+
def initialize
|
|
17
|
+
open_file_path = nil
|
|
18
|
+
clear_cache!
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def clear_cache!
|
|
22
|
+
if @is_open
|
|
23
|
+
@clear_flag = true
|
|
24
|
+
return
|
|
25
|
+
end
|
|
26
|
+
@clear_flag = false
|
|
27
|
+
@is_open = false
|
|
28
|
+
|
|
29
|
+
@cache = {} # clear'd
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.edit(aro_file, updates)
|
|
33
|
+
return if aro_file.nil?
|
|
34
|
+
unless ::File.exist?(aro_file.aro_file_path)
|
|
35
|
+
::File.write(aro_file.aro_file_path, {}.to_json)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
39
|
+
puts :todo_validate_updates_or_depricate
|
|
40
|
+
puts __method__
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
store_instance = Aro::Dom::Ma_ain.instance.get_store_for(aro_file)
|
|
44
|
+
updates.each{|k, v|
|
|
45
|
+
|
|
46
|
+
store_instance.save_key_value_pair(k, v)
|
|
47
|
+
Aro::P.say([
|
|
48
|
+
"reading in #{k} after setting to #{v} in #{aro_file.aro_file_path}",
|
|
49
|
+
"got value => #{store_instance.safe_get_key(k)}"
|
|
50
|
+
])
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def save_key_value_pair(k, v)
|
|
55
|
+
set_key(k, v)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def save_exec_oss_om_params!(oss_om_const, oss_om_method, label)
|
|
59
|
+
Aro::P.say(__method__)
|
|
60
|
+
Aro::Dom::Ma_ain.instance.store_mutex.synchronize do
|
|
61
|
+
built = self.class.build_exec_oss_om_params!(oss_om_const, oss_om_method, label)
|
|
62
|
+
built.each{|k, v| self.set_key(k, v)}
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.build_exec_oss_om_params!(oss_om_const, oss_om_method, label)
|
|
67
|
+
Aro::P.say(__method__)
|
|
68
|
+
# {
|
|
69
|
+
# action_name:,
|
|
70
|
+
# action_key: Aro::Dom::Action::TYPES[:OSS_OM][:key],
|
|
71
|
+
# action_params: {
|
|
72
|
+
# aro_class_name:,
|
|
73
|
+
# aro_class_method:
|
|
74
|
+
# }
|
|
75
|
+
# }
|
|
76
|
+
raise "invalid oss_om_const!" unless Aro::Dom::Oss_OpenMenu::EXEC_CLASSES.include?(oss_om_const.name)
|
|
77
|
+
raise "invalid oss_om_method! #{oss_om_method}" unless oss_om_const.methods.include?(oss_om_method.to_sym)
|
|
78
|
+
{
|
|
79
|
+
action_name: label,
|
|
80
|
+
action_key: :exec_oss_om,
|
|
81
|
+
action_params: {
|
|
82
|
+
aro_class_name: oss_om_const.name,
|
|
83
|
+
aro_class_method: oss_om_method
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def safe_get_key(k)
|
|
89
|
+
safe_key = nil
|
|
90
|
+
Aro::Dom::Ma_ain.instance.store_mutex.synchronize do
|
|
91
|
+
safe_key = get_key(k)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
safe_key
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
|
|
99
|
+
def get_key(key)
|
|
100
|
+
return if open_file_path.nil?
|
|
101
|
+
|
|
102
|
+
key = key.to_s
|
|
103
|
+
|
|
104
|
+
# ensure default for key exists
|
|
105
|
+
@cache[key] = {value: nil, persisted: false} unless @cache.keys.include?(key)
|
|
106
|
+
|
|
107
|
+
# return cache value if storage open or the cache value is persisted
|
|
108
|
+
return @cache[key][:value] if @is_open || @cache[key][:persisted]
|
|
109
|
+
|
|
110
|
+
# open storage
|
|
111
|
+
@is_open = true
|
|
112
|
+
storage_contents = {}
|
|
113
|
+
@parser_error = Aro::Dom::Ssh.decrypt_file!(open_file_path)
|
|
114
|
+
unless @parser_error.kind_of?(StandardError) ||
|
|
115
|
+
StandardError.subclasses.include?(@parser_error.class)
|
|
116
|
+
|
|
117
|
+
# return value from Aro::Dom::Ssh.decrypt_file!
|
|
118
|
+
# is not an error.
|
|
119
|
+
storage_contents = @parser_error
|
|
120
|
+
@parser_error = nil
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
unless @parser_error.nil?
|
|
124
|
+
@is_open = false
|
|
125
|
+
raise @parser_error
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# only update the cache value if present in storage
|
|
129
|
+
if storage_contents.keys.include?(key)
|
|
130
|
+
@cache[key] = {value: storage_contents[key], persisted: true}
|
|
131
|
+
else
|
|
132
|
+
@cache[key][:persisted] = false
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
value = @cache[key][:value]
|
|
136
|
+
@is_open = false
|
|
137
|
+
clear_cache! if @clear_flag
|
|
138
|
+
|
|
139
|
+
return value
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def set_key(key, value)
|
|
143
|
+
return if open_file_path.nil?
|
|
144
|
+
|
|
145
|
+
key = key.to_s
|
|
146
|
+
|
|
147
|
+
# ensure default for key exists
|
|
148
|
+
@cache[key] = {value: value, persisted: false} unless @cache.keys.include?(key)
|
|
149
|
+
|
|
150
|
+
# assign new cache value and set persisted to false
|
|
151
|
+
@cache[key][:value] = value
|
|
152
|
+
@cache[key][:persisted] = false
|
|
153
|
+
|
|
154
|
+
# return if storage open
|
|
155
|
+
# non-persisted cache values update next cycle
|
|
156
|
+
return true if @is_open
|
|
157
|
+
|
|
158
|
+
# open storage
|
|
159
|
+
@is_open = true
|
|
160
|
+
storage_contents = {}
|
|
161
|
+
|
|
162
|
+
@parser_error = Aro::Dom::Ssh.decrypt_file!(open_file_path)
|
|
163
|
+
unless @parser_error.kind_of?(StandardError) ||
|
|
164
|
+
StandardError.subclasses.include?(@parser_error.class)
|
|
165
|
+
|
|
166
|
+
# return value from Aro::Dom::Ssh.decrypt_file!
|
|
167
|
+
# is not an error.
|
|
168
|
+
storage_contents = @parser_error
|
|
169
|
+
@parser_error = nil
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
unless @parser_error.nil?
|
|
173
|
+
@is_open = false
|
|
174
|
+
raise @parser_error
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# update storage and cache
|
|
178
|
+
([key] + @cache.keys.select{|k|
|
|
179
|
+
!@cache[k][:persisted]
|
|
180
|
+
}).each{|k|
|
|
181
|
+
storage_contents[k] = @cache[k][:value]
|
|
182
|
+
@cache[k][:persisted] = true
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# write storage
|
|
186
|
+
write_result = Aro::Dom::Ssh.write_encrypted_file!(open_file_path, storage_contents.to_json)
|
|
187
|
+
unless write_result == true
|
|
188
|
+
@is_open = false
|
|
189
|
+
raise write_result
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# close storage
|
|
193
|
+
@is_open = false
|
|
194
|
+
clear_cache! if @clear_flag
|
|
195
|
+
|
|
196
|
+
write_result
|
|
197
|
+
end
|
|
198
|
+
end
|
data/sys/aro/v.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
=begin
|
|
2
4
|
|
|
3
5
|
v.rb
|
|
@@ -14,11 +16,11 @@ module Aro
|
|
|
14
16
|
class V < Aro::D
|
|
15
17
|
def self.say(message)
|
|
16
18
|
return unless Aro::V.should_print?
|
|
17
|
-
super(message)
|
|
19
|
+
super(normalize_message(message))
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def self.should_print?
|
|
21
|
-
|
|
23
|
+
Aro::Cor.ivar(:VERBOSE).to_s == Aro::Cor::BOOLS[:TRUE].to_s && super
|
|
22
24
|
end
|
|
23
25
|
end
|
|
24
26
|
end
|
data/sys/aro.rb
CHANGED
data/sys/ma_ain.rb
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
ma_ain.rb
|
|
6
|
+
|
|
7
|
+
aro dom ma_ain.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module Aro
|
|
14
|
+
module Dom
|
|
15
|
+
class Ma_ain < Aro::Mancy
|
|
16
|
+
# inherits Singleton
|
|
17
|
+
|
|
18
|
+
# evolution planning
|
|
19
|
+
#
|
|
20
|
+
# Cor (copy of Aro::Cor)
|
|
21
|
+
# Engine
|
|
22
|
+
# Designer
|
|
23
|
+
# Git
|
|
24
|
+
# Ssh
|
|
25
|
+
# Block (copy of Aro::Dom::DataBase)
|
|
26
|
+
# Chain (copy of Aro::Dom::Directory)
|
|
27
|
+
# Node (copy of Aro::Dom::File)
|
|
28
|
+
# List (copy of Aro::Dom::Menu)
|
|
29
|
+
# ListItem (copy of Aro::Dom::MenuItem)
|
|
30
|
+
#
|
|
31
|
+
#
|
|
32
|
+
|
|
33
|
+
EXEC_METHODS = [
|
|
34
|
+
:exec_browse_data_bases!,
|
|
35
|
+
:exec_settings!,
|
|
36
|
+
:exec_quit!
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
RUN_MODES = [
|
|
40
|
+
:design,
|
|
41
|
+
:run
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
UNICODE_KEYS = {
|
|
45
|
+
bang: "\u0021",
|
|
46
|
+
check: "\u2713",
|
|
47
|
+
close: "\u2A2F",
|
|
48
|
+
integral: "\u222B",
|
|
49
|
+
secure: "\u266F",
|
|
50
|
+
unsecure: "\u266D",
|
|
51
|
+
yinyang: "\u262F",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
attr_accessor :current_menu, :previous_menu
|
|
55
|
+
attr_accessor :data_mutex, :store_mutex
|
|
56
|
+
attr_accessor :stores
|
|
57
|
+
# todo: unused currently. init instance with hashing algo stuff
|
|
58
|
+
attr_accessor :valid_settings
|
|
59
|
+
attr_accessor :run_mode
|
|
60
|
+
|
|
61
|
+
def reign!
|
|
62
|
+
begin
|
|
63
|
+
# default mode is :run
|
|
64
|
+
self.run_mode = Aro::Mancy::S
|
|
65
|
+
Aro::P.say("Aro::Dom::Oss_OpenMenu.install!")
|
|
66
|
+
if Aro::Dom::Oss_OpenMenu.install!
|
|
67
|
+
Aro::P.say("Aro::Dom::Oss_OpenMenu.boot!")
|
|
68
|
+
Aro::Dom::Oss_OpenMenu.boot!
|
|
69
|
+
else
|
|
70
|
+
Aro::P.say("installation failed. exiting now...")
|
|
71
|
+
exit
|
|
72
|
+
end
|
|
73
|
+
Aro::P.say("Aro::Dom::Designer.design")
|
|
74
|
+
Aro::Dom::Designer.design
|
|
75
|
+
rescue RuntimeError => e
|
|
76
|
+
|
|
77
|
+
Aro::P.say("#{e.class}! #{e.inspect}")
|
|
78
|
+
self.class.i2097i_bookmark
|
|
79
|
+
reign!
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def initialize
|
|
84
|
+
self.data_mutex = Mutex.new
|
|
85
|
+
self.store_mutex = Mutex.new
|
|
86
|
+
|
|
87
|
+
@stores = {}
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.i2097i_bookmark
|
|
91
|
+
return
|
|
92
|
+
Aro::P.less("\n#{UNICODE_KEYS[:bang] * Aro::Mancy::OS} <breakpoint> #{self.name}\n\n" +
|
|
93
|
+
Thread.current.backtrace[1..].reverse.map{|l|
|
|
94
|
+
l.gsub("#{Reiquire.gem_dir}", "").gsub(Aro::Mancy.root_dir, "")
|
|
95
|
+
}.last(Aro::Mancy::V).join("\n")
|
|
96
|
+
)
|
|
97
|
+
puts __method__
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def self.init!
|
|
101
|
+
root_dir_path = Aro::Cor.ivar(:OSS_OM_HOME)
|
|
102
|
+
return false if root_dir_path.nil? || !Dir.exist?(root_dir_path)
|
|
103
|
+
Aro::P.say("#{self.name} initializing in #{root_dir_path}")
|
|
104
|
+
Aro::Mancy.init(root_dir_path)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def self.is_encrypted?
|
|
108
|
+
!Aro::Cor.ivar(:oss_om_ssh_key).nil? &&
|
|
109
|
+
!self.instance.valid_settings.nil?
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def self.domain
|
|
113
|
+
self.instance.current_menu.nil? ? super : "#{Aro::Mancy.aro_mancy_name}#{Aro::Mancy::A}#{Aro::Dom::Ma_ain}"
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def self.mini_hud_for(display_text = nil)
|
|
117
|
+
cryption_text = UNICODE_KEYS[
|
|
118
|
+
is_encrypted? ? :secure : :unsecure
|
|
119
|
+
] + UNICODE_KEYS[:bang]
|
|
120
|
+
|
|
121
|
+
if is_encrypted?
|
|
122
|
+
cryption_text = "#{UNICODE_KEYS[:secure]}#{UNICODE_KEYS[:bang]}"
|
|
123
|
+
else
|
|
124
|
+
cryption_text = "#{UNICODE_KEYS[:unsecure]}#{UNICODE_KEYS[:bang]}"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
mode_text = RUN_MODES[self.instance.run_mode || Aro::Mancy::O]
|
|
128
|
+
[
|
|
129
|
+
"(#{cryption_text})[#{mode_text}: ",
|
|
130
|
+
display_text
|
|
131
|
+
].join("")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def self.ps1_display(cls_name = nil)
|
|
135
|
+
super(domain)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.open!(data_base = :ma_ain)
|
|
139
|
+
Aro::P.say("Aro::Dom::DataBase.open_menu(#{data_base})")
|
|
140
|
+
staged_menu = nil
|
|
141
|
+
begin
|
|
142
|
+
staged_menu = Aro::Dom::DataBase.open_menu(data_base)
|
|
143
|
+
rescue StandardError => e
|
|
144
|
+
raise "#{self.name} error opening data_base #{data_base}! #{e.inspect}"
|
|
145
|
+
end
|
|
146
|
+
self.instance.previous_menu = self.instance.current_menu
|
|
147
|
+
self.instance.current_menu = staged_menu
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def self.back!
|
|
151
|
+
self.instance.current_menu = nil
|
|
152
|
+
open!
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def self.toggle_run_mode
|
|
156
|
+
self.instance.run_mode = self.instance.run_mode == 0 ? 1 : 0
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def self.running?
|
|
160
|
+
RUN_MODES[self.instance.run_mode || Aro::Mancy::O] == :run
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def self.get_current_options
|
|
164
|
+
options = []
|
|
165
|
+
|
|
166
|
+
options << {back: :back, value: :back} unless self.instance.previous_menu.nil?
|
|
167
|
+
|
|
168
|
+
options << {name: "#{UNICODE_KEYS[:integral]}(#{Aro::Mancy::ARO_DIRECTORY})", value: :open_menu}
|
|
169
|
+
|
|
170
|
+
options += self.instance.current_menu.menu_items.select{|mi| mi.user?}.map{|mi| mi.as_tty}
|
|
171
|
+
options += self.instance.current_menu.menu_items.select{|mi| mi.system?}.map{|mi| mi.as_tty}
|
|
172
|
+
|
|
173
|
+
options
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def self.exec_browse_data_bases!
|
|
177
|
+
Aro::Dom::Ma_ain.open!(:browse_data_bases)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def self.exec_settings!
|
|
181
|
+
Aro::Dom::Ma_ain.open!(:settings)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def self.exec_quit!
|
|
185
|
+
exit
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def get_store_for(aro_file)
|
|
189
|
+
raise "invalid aro_file!" if aro_file.nil?
|
|
190
|
+
|
|
191
|
+
if @stores[aro_file.uuid].nil?
|
|
192
|
+
new_store = Aro::Dom::Store.new
|
|
193
|
+
new_store.open_file_path = aro_file.aro_file_path
|
|
194
|
+
@stores[aro_file.uuid] = new_store
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
return Aro::Dom::Ma_ain.instance.stores[aro_file.uuid]
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|