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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e01261ca4ed5bbcd2cc2201a4c6848d189edd299b71cb3bcd19680e6f7587714
|
|
4
|
+
data.tar.gz: 32e93c9a8c4e1104ce378c9eb59f96e042345332246f5572a30c7bbd1d085ece
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ac9214dbb4d14810eb5770be3329bee6d36e328196c108875e5a3b25715659f6953add8196201ac4164f37e2f7a51fcda4f048ef953051133fcd92b3c11ff8f
|
|
7
|
+
data.tar.gz: f87cdd3ce23098cece61484954e2fff0538c9f847f9e751d22d5b8aa8f0e5a27ca3b2f9857e05067a5bc795f09e22ad17e348fcf399796741e8ba023dc78caf5
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
aro (0.2.
|
|
4
|
+
aro (0.2.9)
|
|
5
5
|
activerecord (~> 8.1, >= 8.1.4.1)
|
|
6
|
+
f_dot (~> 0.0.2, >= 0.0.2)
|
|
6
7
|
i18n (~> 1.15, >= 1.15.2)
|
|
7
8
|
sqlite3 (~> 2.10, >= 2.10.2)
|
|
8
9
|
tty-font (~> 0.5, >= 0.5.0)
|
|
@@ -36,6 +37,9 @@ GEM
|
|
|
36
37
|
connection_pool (3.0.2)
|
|
37
38
|
diff-lcs (1.6.2)
|
|
38
39
|
drb (2.2.3)
|
|
40
|
+
f_dot (0.0.2)
|
|
41
|
+
tty-font (~> 0.5, >= 0.5.0)
|
|
42
|
+
tty-prompt (~> 0.23, >= 0.23.1)
|
|
39
43
|
ffi (1.17.4-aarch64-linux-gnu)
|
|
40
44
|
ffi (1.17.4-aarch64-linux-musl)
|
|
41
45
|
ffi (1.17.4-arm-linux-gnu)
|
|
@@ -136,7 +140,7 @@ CHECKSUMS
|
|
|
136
140
|
activemodel (8.1.4.1) sha256=063caf105372fbc98b2d789e4be23de63ac5c043f7d9330f04e2caddb7012805
|
|
137
141
|
activerecord (8.1.4.1) sha256=bd65599ca0b5d210937f835d42c7aff69d271741c75aab022730be6cbce67e87
|
|
138
142
|
activesupport (8.1.4.1) sha256=16ac4f341ca65c85a1fcdb8ac73f68891aae9e3c4a6f9c3a27daed8b00017ed7
|
|
139
|
-
aro (0.2.
|
|
143
|
+
aro (0.2.9)
|
|
140
144
|
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
141
145
|
bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66
|
|
142
146
|
bundler (4.0.24) sha256=16ca64e20816a0cf151a948fb141d788602996d2b4d73577b74388fe84fa98bc
|
|
@@ -144,6 +148,7 @@ CHECKSUMS
|
|
|
144
148
|
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
145
149
|
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
146
150
|
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
151
|
+
f_dot (0.0.2)
|
|
147
152
|
ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
|
|
148
153
|
ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39
|
|
149
154
|
ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564
|
data/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
> __a oss_om unix utility__
|
|
1
|
+
# [aro(rubygems)](https://rubygems.org/gems/aro)
|
|
2
|
+
# [aro(github)](https://github.com/f-oss-om-foundation/aro)
|
|
5
3
|
|
|
6
4
|
##### __current version:__
|
|
7
5
|
[](https://badge.fury.io/rb/aro)
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
|
|
8
|
+
```json
|
|
9
|
+
{"tldr": "aro is a unix utility for designing and creating linux applications."}
|
|
10
|
+
```
|
|
10
11
|
|
|
11
12
|
### installation
|
|
12
13
|
|
|
@@ -21,6 +22,6 @@ $ oss_om
|
|
|
21
22
|
```
|
|
22
23
|
[license](http://opensource.org/licenses/MIT)
|
|
23
24
|
|
|
24
|
-
[issues](https://github.com/
|
|
25
|
+
[issues](https://github.com/f-oss-om-foundation/aro/issues)
|
|
25
26
|
|
|
26
|
-
##### aro (v0.2.
|
|
27
|
+
##### aro (v0.2.9) by scot reichman is copyright (2026)
|
data/aro.gemspec
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
|
+
GEM_DESCRIPTION = "aro is a unix utility for designing and creating linux applications."
|
|
12
|
+
|
|
11
13
|
require_relative :"sys/shr/version".to_s
|
|
12
14
|
|
|
13
15
|
Gem::Specification.new do |spec|
|
|
@@ -15,9 +17,9 @@ Gem::Specification.new do |spec|
|
|
|
15
17
|
spec.version = Aro::VERSION.to_s
|
|
16
18
|
spec.authors = ["i2097i"]
|
|
17
19
|
spec.email = ["i2097i@hotmail.com"]
|
|
18
|
-
spec.description =
|
|
19
|
-
spec.summary =
|
|
20
|
-
spec.homepage = "https://github.com/
|
|
20
|
+
spec.description = GEM_DESCRIPTION + "\n#{Aro::VERSION} release notes: #{Aro::RELEASE_NOTES}"
|
|
21
|
+
spec.summary = GEM_DESCRIPTION
|
|
22
|
+
spec.homepage = "https://github.com/f-oss-om-foundation/aro"
|
|
21
23
|
spec.license = "MIT"
|
|
22
24
|
spec.files = `git ls-files`.split("\n").reject{|p| p.match?(/^(spec|.release|.*.gem$)/)}
|
|
23
25
|
spec.bindir = "bin"
|
|
@@ -37,4 +39,5 @@ Gem::Specification.new do |spec|
|
|
|
37
39
|
spec.add_runtime_dependency "sqlite3", "~> 2.10", ">= 2.10.2"
|
|
38
40
|
spec.add_runtime_dependency "tty-prompt", "~> 0.23", ">= 0.23.1"
|
|
39
41
|
spec.add_runtime_dependency "tty-font", "~> 0.5", ">= 0.5.0"
|
|
42
|
+
spec.add_runtime_dependency "f_dot", "~> 0.0.2", ">= 0.0.2"
|
|
40
43
|
end
|
data/bin/oss_om
CHANGED
|
@@ -14,4 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
require :aro.to_s
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
begin
|
|
18
|
+
if ARGV[0]&.strip&.to_sym == :cubicus
|
|
19
|
+
# start in FDot::DISPLAY_MODES[:websockets] display_mode
|
|
20
|
+
# start websocket thread
|
|
21
|
+
FDot::Based::Processor.instance.f_dot_space_override_path = Aro::Mancy.root_dir
|
|
22
|
+
FDot::Based::Cubicus.instance.start_ws_thread
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Aro::Dom::Ma_ain.instance.reign!
|
|
26
|
+
rescue StandardError => e
|
|
27
|
+
puts "rescued in aro bin for #{e}"
|
|
28
|
+
puts Thread.current.backtrace
|
|
29
|
+
raise e
|
|
30
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bf02f246670ca6f9d520c5fa1f4bc76205694f68188cb9492e66e7084e12cbb41227a95e32e9016fe4801dced2823235ab38f9023e75701cf5a8e01b1b34ceae
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
59c1276f49f9d1dc48f518df845f786e45a262dad963bb0e5ceda66dd88e7baa3f602e9da0605499d0bc987f78d0360e3929e20a3d904c081f91e910b44c5b65
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# this configuration is built explicitly for websocket
|
|
2
|
+
# controls such that a/any unix host system can
|
|
3
|
+
# run aro's oss_om via websockets and a minimal
|
|
4
|
+
# implementation of a single instance of mozilla firefox
|
|
5
|
+
# running in kiosk mode within a docker container.
|
|
6
|
+
# the host system starts the oss_om process in cubicus mode:
|
|
7
|
+
# $ oss_om cubicus
|
|
8
|
+
# this starts oss_om in websocket display_mode
|
|
9
|
+
# lightweight golang websocket server process
|
|
10
|
+
# starts and begins processing communication
|
|
11
|
+
# between the host process (oss_om) and the
|
|
12
|
+
# display (a regular browser tab can also be used)
|
|
13
|
+
# for controls processing and rendering display to
|
|
14
|
+
# the display (firefox docker container)
|
|
15
|
+
# oss_om has three components within a project
|
|
16
|
+
# 1) display:
|
|
17
|
+
# a) a browser tab visiting the same url as the display docker container.
|
|
18
|
+
# b) the display docker container
|
|
19
|
+
# 2) controls:
|
|
20
|
+
# this is the host system that runs docker compose and starts oss_om cubicus
|
|
21
|
+
# 3) history:
|
|
22
|
+
# this is a gitea instance for oss_om encrypted storage
|
|
23
|
+
# note: this is not implemented yet
|
|
24
|
+
#
|
|
25
|
+
|
|
26
|
+
services:
|
|
27
|
+
display:
|
|
28
|
+
image: lscr.io/linuxserver/firefox:latest
|
|
29
|
+
container_name: display
|
|
30
|
+
environment:
|
|
31
|
+
- PUID=1000
|
|
32
|
+
- PGID=1000
|
|
33
|
+
- TZ=Etc/UTC
|
|
34
|
+
- FIREFOX_CLI=--kiosk http://host.docker.internal:8080/
|
|
35
|
+
- SELKIES_UI_SHOW_SIDEBAR=false
|
|
36
|
+
- HARDEN_DESKTOP=true
|
|
37
|
+
- HARDEN_OPENBOX=true
|
|
38
|
+
- RESTART_APP=true
|
|
39
|
+
volumes:
|
|
40
|
+
- ./.oss_om/open_system/display:/config
|
|
41
|
+
ports:
|
|
42
|
+
- "3001:3001"
|
|
43
|
+
- "3000:3000"
|
|
44
|
+
shm_size: "1gb"
|
|
45
|
+
restart: unless-stopped
|
|
46
|
+
extra_hosts:
|
|
47
|
+
- "host.docker.internal:host-gateway"
|
|
48
|
+
history:
|
|
49
|
+
image: gitea/gitea:latest
|
|
50
|
+
container_name: history
|
|
51
|
+
environment:
|
|
52
|
+
- USER_UID=1000
|
|
53
|
+
- USER_GID=1000
|
|
54
|
+
restart: unless-stopped
|
|
55
|
+
volumes:
|
|
56
|
+
- ./.oss_om/open_system/history:/data
|
|
57
|
+
ports:
|
|
58
|
+
- "2997:3000"
|
|
59
|
+
- "2222:22"
|
data/locale/en.cor.yml
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
en:
|
|
2
2
|
cor:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
|
|
4
|
+
ivars:
|
|
5
|
+
env:
|
|
6
|
+
description: "oss_om run environment."
|
|
7
|
+
development_description: "add debugging verbosity to standard oss_om output."
|
|
8
|
+
production_description: "standard oss_om output."
|
|
9
|
+
test_description: "used for testing."
|
|
10
|
+
verbose_description: "enable verbose logging in development."
|
|
11
|
+
oss_om_home:
|
|
12
|
+
description: "the directory where .oss_om/ lives."
|
|
13
|
+
path_description: "any valid path file path. defaults to $HOME"
|
|
14
|
+
log_db_description: "enable database transaction logging."
|
|
15
|
+
hide_f_oss_om_description: "hide or show the %{\u222B} menu globally."
|
|
16
|
+
ovars:
|
|
9
17
|
O_description: "zero."
|
|
10
18
|
S_description: "one."
|
|
11
19
|
OS_description: "two."
|
|
@@ -13,14 +21,10 @@ en:
|
|
|
13
21
|
N_description: "four."
|
|
14
22
|
V_description: "five."
|
|
15
23
|
OSS_OM_FILE_description: "generated oss_om project file."
|
|
16
|
-
|
|
17
|
-
description: "the directory where .oss_om/ lives."
|
|
18
|
-
path_description: "any valid path file path. defaults to $HOME"
|
|
24
|
+
|
|
19
25
|
oss_om_pkey_path:
|
|
20
26
|
description: "path to openssl public key. used to perform oss_om actions."
|
|
21
27
|
path_description: "path to openssl key (usually ~/.ssh/id_key_name.pub)"
|
|
22
|
-
verbose_description: "enable verbose logging in development."
|
|
23
|
-
log_aro_db_description: "show aro database transactions"
|
|
24
28
|
generate: "generating default cor file at %{name}."
|
|
25
29
|
source: "installing ivars from %{name}..."
|
|
26
30
|
maximum: "max"
|
data/locale/en.yml
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
en:
|
|
2
|
+
open_system:
|
|
3
|
+
create_glyph_select: "choose glyph type"
|
|
2
4
|
open_menu:
|
|
3
5
|
base_db_password_prompt: "enter database password <%{sql_filepath}> (default %{aro_name}): "
|
|
4
6
|
edit_action_for_menu_item: "edit action '%{action_name}' for menu item '%{localized_name}'"
|
|
@@ -8,9 +10,31 @@ en:
|
|
|
8
10
|
get_new_value_from_user: "input new value (press enter to cancel): "
|
|
9
11
|
select_exec_oss_om_const: "which oss_om class will run this action?"
|
|
10
12
|
select_exec_oss_om_method: "%{class} method to run?"
|
|
11
|
-
default_user_item_text: "
|
|
13
|
+
default_user_item_text: "default %{localized_name} item"
|
|
14
|
+
edit_ivars_select: "which ivar do you want to edit?"
|
|
15
|
+
new_ivar_value_prompt: "enter new %{value_type} for %{def_key} (current is '%{current_value}'"
|
|
16
|
+
edit_ivars_possible_values_select: "listing possible values for %{def_key}"
|
|
17
|
+
design_schema_for: "designing schema for %{localized_name}"
|
|
12
18
|
designer:
|
|
13
19
|
create_menu: "enter display text for the new menu"
|
|
20
|
+
imports:
|
|
21
|
+
confirm_import: "%{prompt_text} (selected: %{file_name}) confirm (y/n):"
|
|
22
|
+
user_cancelled: "user cancelled import."
|
|
23
|
+
plugins:
|
|
24
|
+
open_plugins_menu: "install :open_system or choose from the plugins/ directory."
|
|
25
|
+
confirm_plugin: "[selected %{file_name}] confirm (y/n):"
|
|
26
|
+
user_cancelled: "user cancelled import."
|
|
27
|
+
select_plugin: "select a plugin"
|
|
28
|
+
choose_plugin_description: "ruby classes are used as a way to interface other processes with oss_om."
|
|
29
|
+
choose_plugin_sample_info: "a sample_plugin.rb file is automatically generated in the plugins/ directory."
|
|
30
|
+
description: "chapter_plugins are installed in books"
|
|
31
|
+
location: "you can see them by navigating to the library"
|
|
32
|
+
new_book_prompt: "would you like to create a new book?"
|
|
33
|
+
new_book_menu: "create new book now?"
|
|
34
|
+
library:
|
|
35
|
+
get_book_param: "enter %{key}"
|
|
36
|
+
new_book_select: "creating a new book"
|
|
37
|
+
unsaved_changes_confirm: "unsaved changes. go back anyway? (y/n):"
|
|
14
38
|
errors:
|
|
15
39
|
invalid_i18n_path: "invalid_i18n_path"
|
|
16
40
|
locale_load_error: "locale_load_error: failed to load locale %{named} library"
|
data/sys/aro/action.rb
CHANGED
|
@@ -23,44 +23,16 @@ module Aro
|
|
|
23
23
|
required: true
|
|
24
24
|
},
|
|
25
25
|
aro_class_method: {
|
|
26
|
-
default_value: :
|
|
27
|
-
required: false
|
|
28
|
-
},
|
|
29
|
-
oss_om_ssh_key: {
|
|
30
|
-
default_value: nil,
|
|
31
|
-
required: true,
|
|
32
|
-
unique: true
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
SYSTEM: {
|
|
37
|
-
key: :exec_system,
|
|
38
|
-
params: {
|
|
39
|
-
command_string: {
|
|
40
|
-
default_value: nil,
|
|
26
|
+
default_value: :name,
|
|
41
27
|
required: true
|
|
42
28
|
},
|
|
43
|
-
|
|
44
|
-
default_value:
|
|
45
|
-
required: true,
|
|
46
|
-
unique: true
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
CREATE_DATA_BASE: {
|
|
51
|
-
key: :exec_data_base,
|
|
52
|
-
params: {
|
|
53
|
-
data_base_name: {
|
|
54
|
-
default_value: nil,
|
|
55
|
-
required: true,
|
|
56
|
-
unique: true
|
|
57
|
-
},
|
|
58
|
-
oss_om_ssh_key: {
|
|
59
|
-
default_value: nil,
|
|
60
|
-
required: true,
|
|
61
|
-
unique: true
|
|
29
|
+
aro_call_params: {
|
|
30
|
+
default_value: [],
|
|
62
31
|
}
|
|
63
32
|
},
|
|
33
|
+
data: {
|
|
34
|
+
default_value: {}
|
|
35
|
+
}
|
|
64
36
|
}
|
|
65
37
|
}
|
|
66
38
|
|
|
@@ -93,6 +65,13 @@ module Aro
|
|
|
93
65
|
valid_param_keys!(action_key, params) && valid_param_values!(action_key, params)
|
|
94
66
|
end
|
|
95
67
|
|
|
68
|
+
def self.validate_data!(action_key, data = {})
|
|
69
|
+
Aro::P.say("validating #{action_key} action data")
|
|
70
|
+
|
|
71
|
+
raise "invalid data! (#{data})" unless data.kind_of?(Hash)
|
|
72
|
+
# todo: validate data schema here
|
|
73
|
+
end
|
|
74
|
+
|
|
96
75
|
def self.validate_action_key!(action_key)
|
|
97
76
|
action_key = action_key&.upcase.to_sym
|
|
98
77
|
raise "invalid action! (#{action_key})" unless Aro::Dom::Action::TYPES.keys.include?(action_key)
|
|
@@ -107,17 +86,14 @@ module Aro
|
|
|
107
86
|
case aro_action_type_def[:key]
|
|
108
87
|
when :exec_oss_om
|
|
109
88
|
Aro::Dom::Oss_OpenMenu.create_exec_oss_om_entry_for(menu_item)
|
|
110
|
-
when :exec_system
|
|
111
|
-
Aro::Dom::Oss_OpenMenu.create_exec_system_entry_for(menu_item)
|
|
112
|
-
when :exec_data_base
|
|
113
|
-
Aro::Dom::Oss_OpenMenu.create_exec_data_base_entry_for(menu_item)
|
|
114
89
|
end
|
|
115
90
|
end
|
|
116
91
|
|
|
117
|
-
def self.perform(action_key, params = {})
|
|
92
|
+
def self.perform(action_key, params = {}, data = {})
|
|
118
93
|
Aro::P.say(__method__)
|
|
119
94
|
action_key = validate_action_key!(action_key)
|
|
120
95
|
validate_params!(action_key, params)
|
|
96
|
+
validate_data!(action_key, data)
|
|
121
97
|
|
|
122
98
|
params = params.symbolize_keys
|
|
123
99
|
aro_action_type_def = Aro::Dom::Action::TYPES[action_key]
|
|
@@ -125,26 +101,29 @@ module Aro
|
|
|
125
101
|
when :exec_oss_om
|
|
126
102
|
Aro::P.say("#{params[:aro_class_name]}.#{params[:aro_class_method]}")
|
|
127
103
|
begin
|
|
128
|
-
|
|
104
|
+
method_call_params = []
|
|
105
|
+
if params[:aro_call_params].kind_of?(Array) &&
|
|
106
|
+
params[:aro_call_params].count > Aro::Mancy::O
|
|
107
|
+
method_call_params += params[:aro_call_params]
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if data.keys.count > Aro::Mancy::O
|
|
111
|
+
method_call_params << data.dup.stringify_keys
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
oss_om_const = params[:aro_class_name].constantize
|
|
115
|
+
|
|
116
|
+
raise "invalid oss_om_const! #{oss_om_const}" if oss_om_const.nil?
|
|
117
|
+
|
|
118
|
+
if method_call_params.any?
|
|
119
|
+
oss_om_const.send(params[:aro_class_method], *method_call_params)
|
|
120
|
+
else
|
|
121
|
+
oss_om_const.send(params[:aro_class_method])
|
|
122
|
+
end
|
|
129
123
|
rescue NoMethodError => e
|
|
124
|
+
puts Thread.main.backtrace
|
|
130
125
|
Aro::P.say("exec_oss_om error! #{e}")
|
|
131
126
|
end
|
|
132
|
-
when :exec_system
|
|
133
|
-
Aro::P.say("todo: implement!")
|
|
134
|
-
Aro::P.say("when :exec_system")
|
|
135
|
-
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
136
|
-
command_string = params[:command_string]
|
|
137
|
-
if command_string.nil?
|
|
138
|
-
raise "invalid command_string! #{command_string}"
|
|
139
|
-
end
|
|
140
|
-
Aro::P.say("#{self.name} performing #{action_key} action: [system(#{command_string})]")
|
|
141
|
-
result = system("#{command_string}")
|
|
142
|
-
Aro::P.say("=> #{result}")
|
|
143
|
-
Aro::P.say("\n")
|
|
144
|
-
when :exec_data_base
|
|
145
|
-
Aro::P.say("todo: implement!")
|
|
146
|
-
Aro::P.say("when :exec_data_base")
|
|
147
|
-
Aro::Dom::Ma_ain.i2097i_bookmark
|
|
148
127
|
end
|
|
149
128
|
end
|
|
150
129
|
|
data/sys/aro/book.rb
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
book.rb
|
|
6
|
+
|
|
7
|
+
aro dom book.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module Aro
|
|
14
|
+
module Dom
|
|
15
|
+
class Book
|
|
16
|
+
|
|
17
|
+
EXEC_METHODS = [
|
|
18
|
+
:open_chapter!,
|
|
19
|
+
:create_chapter!
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
def self.open_chapter!(chapter_item_uuid = nil, action_data = {})
|
|
23
|
+
chapter_menu_item = Aro::Dom::MenuItem.find_by(uuid: chapter_item_uuid)
|
|
24
|
+
raise "invalid uuid! #{chapter_item_uuid}" if chapter_menu_item.nil?
|
|
25
|
+
|
|
26
|
+
puts TTY::Font.new(:standard).write(
|
|
27
|
+
chapter_menu_item.localized_name,
|
|
28
|
+
letter_spacing: 1
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
raise "invalid action data for #{chapter_menu_item.inspect}!" if action_data.nil? ||
|
|
32
|
+
!action_data.kind_of?(Hash)
|
|
33
|
+
|
|
34
|
+
puts JSON.pretty_generate(action_data)
|
|
35
|
+
|
|
36
|
+
unless action_data["oss_om_type"].nil?
|
|
37
|
+
case action_data["oss_om_type"].to_sym
|
|
38
|
+
when :key_value_store
|
|
39
|
+
Aro::P.less(:going_to_design_schema)
|
|
40
|
+
Aro::Dom::Designer.design_schema_for(chapter_menu_item)
|
|
41
|
+
when :plugin
|
|
42
|
+
Aro::P.less("Aro::Dom::Ma_ain.running? #{Aro::Dom::Ma_ain.running?}")
|
|
43
|
+
if Aro::Dom::Ma_ain.running?
|
|
44
|
+
Aro::P.less(:going_to_run_plugin_from_book)
|
|
45
|
+
|
|
46
|
+
Aro::Dom::Ma_ain.run_plugin!(chapter_menu_item, action_data)
|
|
47
|
+
else
|
|
48
|
+
Aro::Dom::Designer.design_plugin_for(chapter_menu_item)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
else
|
|
52
|
+
Aro::Dom::Designer.design_schema_for(chapter_menu_item)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
#
|
|
57
|
+
# the expected value here is explicitly the shared uuid of the
|
|
58
|
+
# Aro::Dom::Menu
|
|
59
|
+
# Aro::Dom::DataBase::Directory
|
|
60
|
+
def self.create_chapter!(uuid)
|
|
61
|
+
raise "invalid uuid" if uuid.nil? || uuid.empty? || !uuid.kind_of?(String)
|
|
62
|
+
directory = chapters_data_base.data_base_directories.find_by(
|
|
63
|
+
uuid: uuid
|
|
64
|
+
)
|
|
65
|
+
raise "invalid directory!" if directory.nil?
|
|
66
|
+
|
|
67
|
+
contents_menu = Aro::Dom::Menu.find_by(uuid: directory.uuid)
|
|
68
|
+
raise "invalid contents_menu!" if contents_menu.nil?
|
|
69
|
+
|
|
70
|
+
chapter_params = {
|
|
71
|
+
title: "chapter_#{contents_menu.menu_items.count}", # auto-increment
|
|
72
|
+
text: nil
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
while chapter_params[:text].nil?
|
|
76
|
+
chapter_params[:text] = Aro::Dom::Imports.get_plain_text_import(
|
|
77
|
+
"import plain text from file for #{chapter_params[:title]}: (choose file)"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
return if chapter_params[:text] == false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
chapter_menu_item = contents_menu.generate_new_item(chapter_params[:title], for_type: :system)
|
|
84
|
+
|
|
85
|
+
chapter_menu_item.aro_file.write!(
|
|
86
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
87
|
+
chapter_params[:title],
|
|
88
|
+
Aro::Dom::Book,
|
|
89
|
+
"open_chapter!",
|
|
90
|
+
[chapter_menu_item.uuid],
|
|
91
|
+
chapter_params
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
Aro::Dom::Ma_ain.navigate_to!(contents_menu)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# the table_of_contents menu_item:
|
|
99
|
+
# (Aro::Dom::MenuItem)
|
|
100
|
+
# a new directory is generated if needed
|
|
101
|
+
# Aro::Dom::DataBase::Directory
|
|
102
|
+
# then a new menu is created if needed
|
|
103
|
+
# Aro::Dom::Menu
|
|
104
|
+
# the menu and the directory share a uuid.
|
|
105
|
+
# this creates new data_base folder (.oss_om/data_bases/chapters)
|
|
106
|
+
# and also generates a new directory folder within the chapters data_base folder.
|
|
107
|
+
# this folder's name is 'the uuid of a table_of_contents menu_item'
|
|
108
|
+
#
|
|
109
|
+
def self.open_table_of_contents!(table_of_contents_item)
|
|
110
|
+
raise "invalid menu item! #{table_of_contents_item.inspect}" unless table_of_contents_item.kind_of?(Aro::Dom::MenuItem)
|
|
111
|
+
|
|
112
|
+
# open_contents
|
|
113
|
+
directory = chapters_data_base.data_base_directories.find_or_create_by(
|
|
114
|
+
unix_path: table_of_contents_item.uuid
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
contents_menu = Aro::Dom::Menu.find_by(uuid: directory.uuid)
|
|
118
|
+
if contents_menu.nil?
|
|
119
|
+
# find or create the new contents_menu
|
|
120
|
+
contents_menu = Aro::Dom::Menu.create(uuid: directory.uuid)
|
|
121
|
+
Aro::Dom::Locale.add_i18n_key(
|
|
122
|
+
table_of_contents_item.menu.localized_name,
|
|
123
|
+
new_i18n_display_key: contents_menu.uuid
|
|
124
|
+
)
|
|
125
|
+
[:create_chapter].each{|k|
|
|
126
|
+
i = contents_menu.generate_new_item(k, for_type: :system)
|
|
127
|
+
|
|
128
|
+
i.aro_file.write!(
|
|
129
|
+
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
130
|
+
k,
|
|
131
|
+
Aro::Dom::Book,
|
|
132
|
+
"#{k}!",
|
|
133
|
+
[contents_menu.uuid]
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
contents_menu
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
private
|
|
143
|
+
|
|
144
|
+
def self.chapters_data_base
|
|
145
|
+
Aro::Dom::DataBase.find_or_create_by(unix_path: :chapters)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|