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
data/sys/aro/models/data_base.rb
CHANGED
|
@@ -20,28 +20,24 @@ class Aro::Dom::DataBase < ActiveRecord::Base
|
|
|
20
20
|
|
|
21
21
|
def self.open_menu(menu_sym)
|
|
22
22
|
# get the menu directory
|
|
23
|
-
data_base_directory = menu_data_base.data_base_directories.find_or_create_by(
|
|
23
|
+
@@data_base_directory = menu_data_base.data_base_directories.find_or_create_by(
|
|
24
24
|
unix_path: menu_sym
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
-
menu = Aro::Dom::Menu.find_by(uuid: data_base_directory.uuid)
|
|
27
|
+
menu = Aro::Dom::Menu.find_by(uuid: @@data_base_directory.uuid)
|
|
28
28
|
if menu.nil?
|
|
29
29
|
# find or create the new menu
|
|
30
|
-
|
|
30
|
+
menu_const = Aro::Dom::Menu
|
|
31
|
+
menu_const = Aro::Dom::Cubicus if menu_sym == :open_system
|
|
32
|
+
|
|
33
|
+
menu = menu_const.create(uuid: @@data_base_directory.uuid)
|
|
31
34
|
Aro::Dom::Locale.add_i18n_key(
|
|
32
35
|
menu_sym.to_s,
|
|
33
36
|
new_i18n_display_key: menu.uuid
|
|
34
37
|
)
|
|
35
38
|
end
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
when :ma_ain
|
|
39
|
-
menu.generate_ma_ain!
|
|
40
|
-
when :settings
|
|
41
|
-
menu.generate_settings!
|
|
42
|
-
else
|
|
43
|
-
menu.generate_user_default!
|
|
44
|
-
end
|
|
40
|
+
generate_menu_items_for!(menu)
|
|
45
41
|
|
|
46
42
|
# return the menu
|
|
47
43
|
return menu
|
|
@@ -68,9 +64,9 @@ class Aro::Dom::DataBase < ActiveRecord::Base
|
|
|
68
64
|
# for user-created menu items
|
|
69
65
|
menu_item.aro_file.write!(
|
|
70
66
|
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
67
|
+
menu_item.localized_name,
|
|
71
68
|
Aro::Dom::Oss_OpenMenu,
|
|
72
|
-
:name
|
|
73
|
-
menu_item.localized_name
|
|
69
|
+
:name # oss_om_class_method defaults to Aro::Dom::Oss_OpenMenu.name
|
|
74
70
|
)
|
|
75
71
|
)
|
|
76
72
|
end
|
|
@@ -113,10 +109,61 @@ class Aro::Dom::DataBase < ActiveRecord::Base
|
|
|
113
109
|
|
|
114
110
|
private
|
|
115
111
|
|
|
112
|
+
def self.generate_menu_items_for!(menu)
|
|
113
|
+
raise "invalid menu!" if menu.nil?
|
|
114
|
+
|
|
115
|
+
case @@data_base_directory.unix_path.to_sym
|
|
116
|
+
when :ma_ain
|
|
117
|
+
menu.generate_ma_ain!
|
|
118
|
+
when :configuration
|
|
119
|
+
menu.generate_configuration!
|
|
120
|
+
when :library
|
|
121
|
+
generate_items!(menu, Aro::Dom::Library)
|
|
122
|
+
when :open_system
|
|
123
|
+
unless menu.kind_of?(Aro::Dom::Cubicus)
|
|
124
|
+
raise "expected Aro::Dom::Cubicus open_system menu type! #{menu.inspect}"
|
|
125
|
+
end
|
|
126
|
+
menu.generate_open_system!
|
|
127
|
+
when :cor
|
|
128
|
+
generate_items!(menu, Aro::Cor)
|
|
129
|
+
when :git
|
|
130
|
+
generate_items!(menu, Aro::Dom::Git)
|
|
131
|
+
when :ssh
|
|
132
|
+
generate_items!(menu, Aro::Dom::Ssh)
|
|
133
|
+
else
|
|
134
|
+
menu.generate_user_default!
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.generate_items!(menu, oss_om_const_for_exec)
|
|
139
|
+
return unless !menu.nil? && menu.menu_items.empty?
|
|
140
|
+
raise "invalid directory! #{@@data_base_directory}" if @@data_base_directory.nil? ||
|
|
141
|
+
@@data_base_directory.uuid != menu.uuid
|
|
142
|
+
raise "invalid const! #{oss_om_const_for_exec}" unless Aro::Dom::Oss_OpenMenu::EXEC_CLASSES.include?(
|
|
143
|
+
oss_om_const_for_exec.name
|
|
144
|
+
) && oss_om_const_for_exec::EXEC_METHODS.kind_of?(Array) &&
|
|
145
|
+
oss_om_const_for_exec::EXEC_METHODS.all?{|em|
|
|
146
|
+
oss_om_const_for_exec.methods.include?(em.to_sym)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
oss_om_const_for_exec::EXEC_METHODS.each{|method_name|
|
|
150
|
+
menu_item = menu.generate_new_item(method_name, for_type: :system)
|
|
151
|
+
|
|
152
|
+
menu_item.aro_file.write!(
|
|
153
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
154
|
+
"#{@@data_base_directory.unix_path} #{method_name}",
|
|
155
|
+
oss_om_const_for_exec,
|
|
156
|
+
method_name
|
|
157
|
+
)
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
end
|
|
161
|
+
|
|
116
162
|
def sync
|
|
117
163
|
Aro::Dom::Ma_ain.instance.data_mutex.synchronize do
|
|
118
164
|
self.class.ensure_data_base_git!
|
|
119
165
|
ensure_unix_exists!
|
|
120
166
|
end
|
|
121
167
|
end
|
|
168
|
+
|
|
122
169
|
end
|
data/sys/aro/models/directory.rb
CHANGED
|
@@ -15,7 +15,7 @@ class Aro::Dom::DataBase::Directory < ActiveRecord::Base
|
|
|
15
15
|
self.table_name = :data_base_directories
|
|
16
16
|
belongs_to :data_base, class_name: "Aro::Dom::DataBase"
|
|
17
17
|
|
|
18
|
-
has_many :data_base_files, class_name: "Aro::Dom::DataBase::File"
|
|
18
|
+
has_many :data_base_files, class_name: "Aro::Dom::DataBase::File", foreign_key: :data_base_directory_id
|
|
19
19
|
|
|
20
20
|
after_create :sync
|
|
21
21
|
after_commit :sync
|
|
@@ -32,10 +32,6 @@ class Aro::Dom::DataBase::Directory < ActiveRecord::Base
|
|
|
32
32
|
::File.join(data_base.aro_data_base_path, unix_path)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
def schema
|
|
36
|
-
::File.join(aro_directory_path, :def_directory, ".json")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
35
|
private
|
|
40
36
|
|
|
41
37
|
def sync
|
data/sys/aro/models/file.rb
CHANGED
|
@@ -16,7 +16,7 @@ class Aro::Dom::DataBase::File < ActiveRecord::Base
|
|
|
16
16
|
belongs_to :data_base_directory, class_name: "Aro::Dom::DataBase::Directory"
|
|
17
17
|
|
|
18
18
|
def write!(updates)
|
|
19
|
-
Aro::Dom::Store.
|
|
19
|
+
Aro::Dom::Store.save_file!(self, updates)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def aro_file_path
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
glyph.rb
|
|
6
|
+
|
|
7
|
+
aro dom glyph menu item.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require_relative "./menu_item"
|
|
14
|
+
|
|
15
|
+
class Aro::Dom::Glyph < Aro::Dom::MenuItem
|
|
16
|
+
# belongs_to :menu
|
|
17
|
+
|
|
18
|
+
EXEC_METHODS = [
|
|
19
|
+
:create_glyph!
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
def self.create_glyph!(menu_item_uuid, action_data = {})
|
|
23
|
+
create_glyph_menu_item = Aro::Dom::MenuItem.find_by(uuid: menu_item_uuid)
|
|
24
|
+
|
|
25
|
+
raise "invalid menu_item_uuid! #{menu_item_uuid}" if create_glyph_menu_item.nil?
|
|
26
|
+
|
|
27
|
+
Aro::P.say("#{self.name} is the base essence within open_system")
|
|
28
|
+
|
|
29
|
+
options = [
|
|
30
|
+
{name: :back, value: :back},
|
|
31
|
+
{name: :objecticus, value: :objecticus},
|
|
32
|
+
{name: :perspecticus, value: :perspecticus}
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
selected_option = Aro::P.default_select(
|
|
36
|
+
I18n.t("open_system.create_glyph_select"),
|
|
37
|
+
options
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return false if selected_option.kind_of?(Symbol) &&
|
|
41
|
+
selected_option == :back
|
|
42
|
+
|
|
43
|
+
selected_const = selected_option == :perspecticus ? Aro::Dom::Perspecticus : Aro::Dom::Objecticus
|
|
44
|
+
|
|
45
|
+
new_name = Aro::Dom::Designer.get_new_value_from_user(
|
|
46
|
+
"enter name for new #{selected_option}:"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
i = create_glyph_menu_item.menu.generate_new_item(
|
|
50
|
+
new_name,
|
|
51
|
+
for_type: :system,
|
|
52
|
+
open_system_class: selected_const.name
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
i.aro_file.write!(
|
|
56
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
57
|
+
new_name,
|
|
58
|
+
selected_const,
|
|
59
|
+
"open!",
|
|
60
|
+
[i.uuid],
|
|
61
|
+
{}
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
Aro::P.say("new #{self.name} '#{i.localized_name}' created successfully!")
|
|
66
|
+
|
|
67
|
+
Aro::Dom::Ma_ain.navigate_to!(create_glyph_menu_item.menu)
|
|
68
|
+
end
|
|
69
|
+
end
|
data/sys/aro/models/menu.rb
CHANGED
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
class Aro::Dom::Menu < ActiveRecord::Base
|
|
14
14
|
include Aro::Dom::Uuid
|
|
15
15
|
|
|
16
|
+
self.inheritance_column = :open_system_class
|
|
17
|
+
|
|
18
|
+
OPEN_SYSTEM_CLASSES = [
|
|
19
|
+
"Aro::Dom::Cubicus",
|
|
20
|
+
"Aro::Dom::Glyph",
|
|
21
|
+
"Aro::Dom::Objecticus",
|
|
22
|
+
"Aro::Dom::Perspecticus",
|
|
23
|
+
]
|
|
24
|
+
|
|
16
25
|
has_many :menu_items, class_name: "Aro::Dom::MenuItem"
|
|
17
26
|
|
|
18
27
|
def localized_name
|
|
@@ -24,12 +33,20 @@ class Aro::Dom::Menu < ActiveRecord::Base
|
|
|
24
33
|
end
|
|
25
34
|
|
|
26
35
|
def directory
|
|
27
|
-
Aro::Dom::DataBase::Directory.find_by(uuid: uuid)
|
|
36
|
+
@directory ||= Aro::Dom::DataBase::Directory.find_by(uuid: uuid)
|
|
28
37
|
end
|
|
29
38
|
|
|
30
|
-
def generate_new_item(localized_name, for_type: :user)
|
|
31
|
-
|
|
39
|
+
def generate_new_item(localized_name, for_type: :user, open_system_class: nil)
|
|
40
|
+
localized_name = localized_name&.to_s
|
|
32
41
|
new_menu_item = menu_items.create(type_flag: for_type)
|
|
42
|
+
if !open_system_class.nil? &&
|
|
43
|
+
Aro::Dom::Menu::OPEN_SYSTEM_CLASSES.include?(open_system_class&.to_s)
|
|
44
|
+
new_menu_item.update(open_system_class: open_system_class)
|
|
45
|
+
|
|
46
|
+
# load from constant
|
|
47
|
+
new_menu_item = new_menu_item.open_system_class.constantize.find_by(uuid: new_menu_item.uuid)
|
|
48
|
+
|
|
49
|
+
end
|
|
33
50
|
Aro::Dom::DataBase.sync_menu_item!(new_menu_item, localized_name)
|
|
34
51
|
new_menu_item
|
|
35
52
|
end
|
|
@@ -45,21 +62,33 @@ class Aro::Dom::Menu < ActiveRecord::Base
|
|
|
45
62
|
return unless is_menu_named?(:ma_ain) &&
|
|
46
63
|
menu_items.empty?
|
|
47
64
|
|
|
48
|
-
[:
|
|
65
|
+
[:library, :open_system, :configuration, :quit].each{|k|
|
|
49
66
|
i = generate_new_item(k, for_type: :system)
|
|
50
67
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Aro::Dom::
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
if k == :open_system
|
|
69
|
+
i.aro_file.write!(
|
|
70
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
71
|
+
k,
|
|
72
|
+
Aro::Dom::Oss_OpenSystem,
|
|
73
|
+
"start!",
|
|
74
|
+
[i.uuid],
|
|
75
|
+
{}
|
|
76
|
+
)
|
|
56
77
|
)
|
|
57
|
-
|
|
78
|
+
else
|
|
79
|
+
i.aro_file.write!(
|
|
80
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
81
|
+
k,
|
|
82
|
+
Aro::Dom::Ma_ain,
|
|
83
|
+
"exec_#{k}!"
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
end
|
|
58
87
|
}
|
|
59
88
|
end
|
|
60
89
|
|
|
61
|
-
def
|
|
62
|
-
return unless is_menu_named?(:
|
|
90
|
+
def generate_configuration!
|
|
91
|
+
return unless is_menu_named?(:configuration) &&
|
|
63
92
|
menu_items.empty?
|
|
64
93
|
|
|
65
94
|
[:cor, :git, :ssh].each{|k|
|
|
@@ -67,9 +96,9 @@ class Aro::Dom::Menu < ActiveRecord::Base
|
|
|
67
96
|
|
|
68
97
|
i.aro_file.write!(
|
|
69
98
|
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
99
|
+
k,
|
|
70
100
|
Aro::Dom::Oss_OpenMenu,
|
|
71
|
-
"open_#{k}!"
|
|
72
|
-
k
|
|
101
|
+
"open_#{k}!"
|
|
73
102
|
)
|
|
74
103
|
)
|
|
75
104
|
}
|
data/sys/aro/models/menu_item.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
=begin
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
menu_item.rb
|
|
6
6
|
|
|
7
7
|
aro dom menu item.
|
|
8
8
|
|
|
@@ -14,6 +14,8 @@ class Aro::Dom::MenuItem < ActiveRecord::Base
|
|
|
14
14
|
include Aro::Dom::TarGoForRootSec
|
|
15
15
|
include Aro::Dom::Uuid
|
|
16
16
|
|
|
17
|
+
self.inheritance_column = :open_system_class
|
|
18
|
+
|
|
17
19
|
belongs_to :menu, class_name: "Aro::Dom::Menu"
|
|
18
20
|
|
|
19
21
|
enum :type_flag, [
|
|
@@ -21,10 +23,6 @@ class Aro::Dom::MenuItem < ActiveRecord::Base
|
|
|
21
23
|
:user
|
|
22
24
|
]
|
|
23
25
|
|
|
24
|
-
def as_tty
|
|
25
|
-
{name: localized_name, value: uuid}
|
|
26
|
-
end
|
|
27
|
-
|
|
28
26
|
def localized_name
|
|
29
27
|
I18n.t(full_i18n_path)
|
|
30
28
|
end
|
|
@@ -70,9 +68,6 @@ class Aro::Dom::MenuItem < ActiveRecord::Base
|
|
|
70
68
|
raise "missing or invalid action_params: #{action_params.inspect}"
|
|
71
69
|
end
|
|
72
70
|
|
|
73
|
-
puts action_params
|
|
74
|
-
puts "here " * 111
|
|
75
|
-
puts action_storage_key.class
|
|
76
71
|
result = nil
|
|
77
72
|
case action_storage_key
|
|
78
73
|
when :OSS_OM
|
|
@@ -101,10 +96,11 @@ class Aro::Dom::MenuItem < ActiveRecord::Base
|
|
|
101
96
|
Aro::Dom::Action::TYPES.keys.select{|k|
|
|
102
97
|
k == action_storage_key
|
|
103
98
|
}.first,
|
|
104
|
-
store.safe_get_key("action_params")
|
|
99
|
+
store.safe_get_key("action_params"),
|
|
100
|
+
store.safe_get_key("action_data")
|
|
105
101
|
)
|
|
106
102
|
else
|
|
107
|
-
Aro::Dom::Ma_ain.
|
|
103
|
+
Aro::Dom::Ma_ain.sane_backtrace!
|
|
108
104
|
puts __method__
|
|
109
105
|
puts inspect
|
|
110
106
|
puts :todo_implement_invalid_action_handling
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
objecticus.rb
|
|
6
|
+
|
|
7
|
+
aro dom objecticus menu item.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Aro::Dom::Objecticus < Aro::Dom::Glyph
|
|
15
|
+
# belongs_to :menu
|
|
16
|
+
|
|
17
|
+
EXEC_METHODS = [
|
|
18
|
+
:open!
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
def self.open!(objecticus_uuid, action_data = {})
|
|
22
|
+
objecticus_menu_item = Aro::Dom::Objecticus.find_by(uuid: objecticus_uuid)
|
|
23
|
+
raise "invalid objecticus_uuid #{objecticus_uuid}" if objecticus_menu_item.nil?
|
|
24
|
+
|
|
25
|
+
Aro::Dom::Oss_OpenSystem.open_projector!(objecticus_menu_item)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
perspecticus.rb
|
|
6
|
+
|
|
7
|
+
aro dom perspecticus menu item.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Aro::Dom::Perspecticus < Aro::Dom::Glyph
|
|
15
|
+
# belongs_to :menu
|
|
16
|
+
|
|
17
|
+
EXEC_METHODS = [
|
|
18
|
+
:open!
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
def self.open!(perspecticus_uuid, action_data = {})
|
|
22
|
+
perspecticus_menu_item = Aro::Dom::Perspecticus.find_by(uuid: perspecticus_uuid)
|
|
23
|
+
raise "invalid perspecticus_uuid #{perspecticus_uuid}" if perspecticus_menu_item.nil?
|
|
24
|
+
|
|
25
|
+
Aro::Dom::Oss_OpenSystem.open_projector!(perspecticus_menu_item)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
projector.rb
|
|
6
|
+
|
|
7
|
+
aro dom projector.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
# this is a set of classes that run in-memory with data from:
|
|
14
|
+
# the ma_ain open_system menu item's action_data (open_system_space)
|
|
15
|
+
# the glyph's (is kind_of menu item) action_data (glyph_action_data)
|
|
16
|
+
#
|
|
17
|
+
#
|
|
18
|
+
module Aro
|
|
19
|
+
module Dom
|
|
20
|
+
class Projector
|
|
21
|
+
|
|
22
|
+
DIRECTIONS = {
|
|
23
|
+
north: 0,
|
|
24
|
+
south: 1,
|
|
25
|
+
east: 2,
|
|
26
|
+
west: 3
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
DEFAULT_GLYPH = {
|
|
30
|
+
"direction": 0,
|
|
31
|
+
"position": {"x": 0, "y": 0, "z": 0}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
DEFAULT_SPACE = []
|
|
35
|
+
attr_accessor :is_projecting
|
|
36
|
+
attr_accessor :cubicus_uuid
|
|
37
|
+
attr_accessor :glyph_uuid
|
|
38
|
+
attr_accessor :open_system_space
|
|
39
|
+
attr_accessor :glyph_action_data
|
|
40
|
+
|
|
41
|
+
# a projector generates and manages open_system space
|
|
42
|
+
# a projector projects a glyph onto a display
|
|
43
|
+
# a projector receives user input on behalf of the glyph
|
|
44
|
+
# a projector modifies the attributes of a glyph in accordance with user input
|
|
45
|
+
|
|
46
|
+
def initialize(cubicus, glyph, glyph_action_data)
|
|
47
|
+
self.glyph_action_data = {} # initialize
|
|
48
|
+
self.open_system_space = {} # initialize
|
|
49
|
+
self.is_projecting = false
|
|
50
|
+
self.cubicus_uuid = cubicus.uuid
|
|
51
|
+
self.glyph_uuid = glyph.uuid
|
|
52
|
+
|
|
53
|
+
self.glyph_action_data = glyph_action_data.empty? ? Aro::Dom::Projector::DEFAULT_GLYPH : glyph_action_data
|
|
54
|
+
|
|
55
|
+
# get open_system_data
|
|
56
|
+
open_system_item = Aro::Dom::Oss_OpenSystem.instance.get_menu_item
|
|
57
|
+
open_system_data = open_system_item.store.safe_get_key("action_data") || {}
|
|
58
|
+
raise "missing action data for #{open_system_item}!" if open_system_data.nil? ||
|
|
59
|
+
!open_system_data.kind_of?(Hash)
|
|
60
|
+
|
|
61
|
+
# load projector with open_system_space
|
|
62
|
+
self.open_system_space = open_system_data["open_system_space"] || Aro::Dom::Projector::DEFAULT_SPACE
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def project!
|
|
66
|
+
self.is_projecting = true
|
|
67
|
+
|
|
68
|
+
self.is_projecting = false
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def glyph
|
|
72
|
+
Aro::Dom::Glyph.find_by(uuid: self.glyph_uuid)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def direction_name
|
|
76
|
+
Aro::Dom::Projector::DIRECTIONS.select{|k, v| v == self.glyph_action_data["direction"]}.first[0]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# FDot::Based::Cubicus delegate
|
|
80
|
+
def current_display
|
|
81
|
+
(TTY::Font.new(:standard).write(
|
|
82
|
+
glyph.localized_name,
|
|
83
|
+
letter_spacing: 1
|
|
84
|
+
).split("\n") + [
|
|
85
|
+
"the glyph is facing #{direction_name}.",
|
|
86
|
+
"the glyph's position is #{self.glyph_action_data["position"]}.",
|
|
87
|
+
]).join("\n")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# FDot::Based::Cubicus delegate
|
|
91
|
+
def current_controls
|
|
92
|
+
[] # empty controls asserts keyboard movement in cubicus
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# FDot::Based::Cubicus delegate
|
|
96
|
+
def respond_to_control(keyboard_event)
|
|
97
|
+
Aro::P.say("received #{keyboard_event} in #{__method__}")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
103
|
+
end
|
data/sys/aro/oss_open_menu.rb
CHANGED
|
@@ -17,9 +17,16 @@ module Aro
|
|
|
17
17
|
EXEC_CLASSES = [
|
|
18
18
|
"Aro::Cor",
|
|
19
19
|
"Aro::Dom::Oss_OpenMenu",
|
|
20
|
+
"Aro::Dom::Oss_OpenSystem",
|
|
20
21
|
"Aro::Dom::Ma_ain",
|
|
22
|
+
"Aro::Dom::Library",
|
|
23
|
+
"Aro::Dom::Book",
|
|
21
24
|
"Aro::Dom::Git",
|
|
22
|
-
"Aro::Dom::Ssh"
|
|
25
|
+
"Aro::Dom::Ssh",
|
|
26
|
+
"Aro::Dom::Cubicus",
|
|
27
|
+
"Aro::Dom::Glyph",
|
|
28
|
+
"Aro::Dom::Perspecticus",
|
|
29
|
+
"Aro::Dom::Objecticus"
|
|
23
30
|
]
|
|
24
31
|
|
|
25
32
|
EXEC_METHODS = [
|
|
@@ -74,6 +81,11 @@ module Aro
|
|
|
74
81
|
Aro::P.say("sourcing existing Aro::Cor env...")
|
|
75
82
|
Aro::Cor.instance.source_config
|
|
76
83
|
|
|
84
|
+
# # temp debugging
|
|
85
|
+
# # explicitly debug in development and data_base logging
|
|
86
|
+
# Aro::Cor.set_ivar(:LOG_DATABASE, :true.to_s)
|
|
87
|
+
# Aro::Cor.set_ivar(:ENV, Aro::Cor::ENVS[:DEVELOPMENT])
|
|
88
|
+
|
|
77
89
|
# set up oss_om workspace
|
|
78
90
|
Aro::P.say("Aro::Dom::Ma_ain.init!")
|
|
79
91
|
Aro::Dom::Ma_ain.init!
|
|
@@ -85,21 +97,19 @@ module Aro
|
|
|
85
97
|
required_local_files = [
|
|
86
98
|
".gitignore",
|
|
87
99
|
".git/config",
|
|
88
|
-
File.basename(private_key_path),
|
|
89
|
-
File.basename(private_key_path) + :".pub".to_s,
|
|
100
|
+
::File.basename(private_key_path),
|
|
101
|
+
::File.basename(private_key_path) + :".pub".to_s,
|
|
90
102
|
]
|
|
91
103
|
missing_required_files = required_local_files.any?{|rlf| !::File.exist?(rlf)}
|
|
92
|
-
return
|
|
104
|
+
return true unless missing_required_files
|
|
93
105
|
# run the install program until setup is complete
|
|
94
106
|
# return false to cancel
|
|
95
107
|
while missing_required_files do
|
|
96
108
|
gitconfig_path = ::File.join(key_path, ".git/config")
|
|
97
109
|
Aro::P.say("checking for local .git/config at #{gitconfig_path}")
|
|
98
110
|
if ::File.exist?(gitconfig_path)
|
|
99
|
-
break unless required_local_files.empty?{|rlf| !::File.exist?(rlf)}
|
|
100
|
-
|
|
101
111
|
Aro::P.say("#{self.name} already installed. continuing...")
|
|
102
|
-
return
|
|
112
|
+
return true if required_local_files.all?{|rlf| ::File.exist?(rlf)}
|
|
103
113
|
else
|
|
104
114
|
Aro::P.say("missing local .git/config!")
|
|
105
115
|
Aro::P.say("setting up local git config...")
|
|
@@ -143,14 +153,16 @@ module Aro
|
|
|
143
153
|
system("chmod 700 #{private_key_path}")
|
|
144
154
|
Aro::P.say("#{self.name} uses the project .gitignore to ensure privacy.")
|
|
145
155
|
Aro::P.say("write .gitignore!")
|
|
146
|
-
File.open(".gitignore", "w+") do |f|
|
|
156
|
+
::File.open(".gitignore", "w+") do |f|
|
|
147
157
|
f.write([
|
|
148
158
|
"#",
|
|
149
159
|
"#",
|
|
150
160
|
"# auto-generated by #{self.name} > #{key_domain} on #{Time.now}",
|
|
151
161
|
"#",
|
|
152
162
|
"# ignore oss_om private key!",
|
|
153
|
-
File.basename(private_key_path),
|
|
163
|
+
::File.basename(private_key_path),
|
|
164
|
+
"# ignore oss_om public key!",
|
|
165
|
+
::File.join(::File.basename(private_key_path), ".pub"),
|
|
154
166
|
"#",
|
|
155
167
|
"# ignore entire '.oss_om/' directory!",
|
|
156
168
|
"#{Aro::Dom::Ma_ain::ARO_DIRECTORY.to_s}/*",
|
|
@@ -169,21 +181,16 @@ module Aro
|
|
|
169
181
|
default_config = {
|
|
170
182
|
user_email: git_email,
|
|
171
183
|
user_name: git_username,
|
|
172
|
-
init_defaultBranch: :foss_om,
|
|
173
184
|
user_signingkey: "#{private_key_path}.pub",
|
|
174
185
|
gpg_format: :ssh,
|
|
175
186
|
commit_gpgsign: true,
|
|
176
187
|
core_editor: :nano
|
|
177
188
|
}.each{|k, v|
|
|
178
189
|
Aro::P.say("system(git config #{k.to_s.gsub("_", ".")} #{v})")
|
|
179
|
-
system(:"git config #{k.to_s.gsub("_", ".")} #{v}".to_s)
|
|
190
|
+
system(:"git config #{k.to_s.gsub("_", ".")} '#{v}'".to_s)
|
|
180
191
|
}
|
|
181
192
|
end
|
|
182
193
|
|
|
183
|
-
Aro::P.say("system(git checkout -b #{default_config[:init_defaultBranch]})")
|
|
184
|
-
system(:"git checkout -b #{default_config[:init_defaultBranch]}".to_s)
|
|
185
|
-
Aro::P.say("system(git branch -D main")
|
|
186
|
-
system(:"git branch -D main".to_s)
|
|
187
194
|
Aro::P.say("system(git add .)")
|
|
188
195
|
system(:"git add .".to_s)
|
|
189
196
|
Aro::P.say("system(git commit -m '#{key_domain} initial commit'")
|
|
@@ -192,7 +199,7 @@ module Aro
|
|
|
192
199
|
Aro::P.say("#{self.name} installed successfully.")
|
|
193
200
|
end
|
|
194
201
|
|
|
195
|
-
return
|
|
202
|
+
return true
|
|
196
203
|
end
|
|
197
204
|
|
|
198
205
|
def self.create_exec_oss_om_entry_for(menu_item)
|
|
@@ -202,8 +209,8 @@ module Aro
|
|
|
202
209
|
|
|
203
210
|
unless allow_exec_unsecure_oss_om_entries || Aro::Dom::Ma_ain.is_encrypted?
|
|
204
211
|
Aro::P.say(__method__)
|
|
205
|
-
Aro::P.say("redirecting to
|
|
206
|
-
Aro::Dom::Ma_ain.
|
|
212
|
+
Aro::P.say("redirecting to configuration until Aro::Dom::Ma_ain.is_encrypted!")
|
|
213
|
+
Aro::Dom::Ma_ain.exec_configuration!
|
|
207
214
|
return
|
|
208
215
|
end
|
|
209
216
|
|
|
@@ -240,38 +247,12 @@ module Aro
|
|
|
240
247
|
Aro::P.say("oss_om_method '#{selected_method_name}' selected")
|
|
241
248
|
|
|
242
249
|
menu_item.store.save_exec_oss_om_params!(
|
|
250
|
+
menu_item.localized_name,
|
|
243
251
|
selected_const_name.constantize,
|
|
244
|
-
selected_method_name
|
|
245
|
-
menu_item.localized_name
|
|
252
|
+
selected_method_name
|
|
246
253
|
)
|
|
247
254
|
end
|
|
248
255
|
|
|
249
|
-
def self.create_exec_system_entry_for(menu_item)
|
|
250
|
-
unless Aro::Dom::Ma_ain.is_encrypted?
|
|
251
|
-
Aro::P.say(__method__)
|
|
252
|
-
Aro::P.say("redirecting to settings until Aro::Dom::Ma_ain.is_encrypted!")
|
|
253
|
-
Aro::Dom::Ma_ain.exec_settings!
|
|
254
|
-
return
|
|
255
|
-
end
|
|
256
|
-
|
|
257
|
-
puts __method__
|
|
258
|
-
puts self.name
|
|
259
|
-
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
260
|
-
end
|
|
261
|
-
|
|
262
|
-
def self.create_exec_data_base_entry_for(menu_item)
|
|
263
|
-
unless Aro::Dom::Ma_ain.is_encrypted?
|
|
264
|
-
Aro::P.say(__method__)
|
|
265
|
-
Aro::P.say("redirecting to settings until Aro::Dom::Ma_ain.is_encrypted!")
|
|
266
|
-
Aro::Dom::Ma_ain.exec_settings!
|
|
267
|
-
return
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
puts __method__
|
|
271
|
-
puts self.name
|
|
272
|
-
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
273
|
-
end
|
|
274
|
-
|
|
275
256
|
def self.open_git!
|
|
276
257
|
Aro::Dom::Git.open!
|
|
277
258
|
end
|
|
@@ -298,14 +279,14 @@ module Aro
|
|
|
298
279
|
".git/hooks/pre-commit"
|
|
299
280
|
)
|
|
300
281
|
|
|
301
|
-
Aro::Dom::Ma_ain.
|
|
282
|
+
Aro::Dom::Ma_ain.sane_backtrace!
|
|
302
283
|
puts "todo: ensure pre-commit file matches current generated content"
|
|
303
284
|
pre_commit_validation_allow_invalid = true
|
|
304
285
|
pre_commit_hook_valid = ::File.exist?(pre_commit_hook_path) && pre_commit_validation_allow_invalid
|
|
305
286
|
return true if pre_commit_hook_valid
|
|
306
287
|
Aro::P.say("warning: pre_commit_validation_allow_invalid is set to #{pre_commit_validation_allow_invalid}!")
|
|
307
288
|
|
|
308
|
-
File.open(pre_commit_hook_path, "w+") do |f|
|
|
289
|
+
::File.open(pre_commit_hook_path, "w+") do |f|
|
|
309
290
|
f.write([
|
|
310
291
|
"#",
|
|
311
292
|
"#",
|