aro 0.2.8 → 0.3.0
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 +1 -0
- data/Gemfile.lock +7 -2
- data/README.md +8 -7
- data/aro.gemspec +1 -0
- data/bin/oss_om +26 -1
- data/checksums/aro-0.2.9.gem.sha512 +1 -0
- data/checksums/aro-0.3.0.gem.sha512 +1 -0
- data/craft_docker-compose.template +80 -0
- data/craft_env.template +1 -0
- data/craft_reinstall_gems.sh +8 -0
- data/locale/en.yml +11 -0
- data/sys/aro/action.rb +3 -3
- data/sys/aro/book.rb +6 -14
- 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/db.rb +1 -1
- data/sys/aro/designer.rb +133 -10
- data/sys/aro/imports.rb +3 -3
- data/sys/aro/library.rb +4 -4
- data/sys/aro/locale.rb +3 -3
- data/sys/aro/mancy.rb +2 -2
- data/sys/aro/models/cubicus.rb +39 -0
- data/sys/aro/models/data_base.rb +13 -3
- data/sys/aro/models/file.rb +1 -1
- data/sys/aro/models/glyph.rb +77 -0
- data/sys/aro/models/menu.rb +40 -11
- data/sys/aro/models/menu_item.rb +4 -6
- data/sys/aro/models/objecticus.rb +28 -0
- data/sys/aro/models/perspecticus.rb +28 -0
- data/sys/aro/open_system/projector.rb +201 -0
- data/sys/aro/oss_open_menu.rb +10 -3
- data/sys/aro/oss_open_system.rb +131 -0
- data/sys/aro/p.rb +0 -11
- data/sys/aro/plugins.rb +8 -6
- data/sys/aro/settings/cor.rb +1 -25
- data/sys/aro/store.rb +1 -5
- data/sys/ma_ain.rb +35 -21
- data/sys/reiquire.rb +1 -0
- data/sys/shr/prompt.rb +14 -3
- data/sys/shr/version.rb +1 -5
- metadata +34 -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: cc3f0a78f7877d2544884c051c685690f6f165c7542a30148a9c4a9a2b9515d9
|
|
4
|
+
data.tar.gz: 1baace7ed33148a2cb78c132460275c7592fb10c09e2baca3e3b78255a74a31f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 205eccd21e0327f192eab4188841b88c03e66a0d59969f0f3d63251ea5680e9f73c9e7d76282f8894f5abe14a1ebcba9eabaf05fe0fb72abcfc42794ccd6af05
|
|
7
|
+
data.tar.gz: 8aebe9cbea26d808de6c8fb74d99406e138cafe00a014b8b8f4fd11bca9f6437ab9d17936eb51a46914b2186b511e17f93abc3667d1ff71157ae243db6ab1b38
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
aro (0.
|
|
4
|
+
aro (0.3.0)
|
|
5
5
|
activerecord (~> 8.1, >= 8.1.4.1)
|
|
6
|
+
f_dot (~> 0.0.3, >= 0.0.3)
|
|
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.3)
|
|
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.
|
|
143
|
+
aro (0.3.0)
|
|
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.3)
|
|
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
|
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
|
|
|
39
39
|
spec.add_runtime_dependency "sqlite3", "~> 2.10", ">= 2.10.2"
|
|
40
40
|
spec.add_runtime_dependency "tty-prompt", "~> 0.23", ">= 0.23.1"
|
|
41
41
|
spec.add_runtime_dependency "tty-font", "~> 0.5", ">= 0.5.0"
|
|
42
|
+
spec.add_runtime_dependency "f_dot", "~> 0.0.3", ">= 0.0.3"
|
|
42
43
|
end
|
data/bin/oss_om
CHANGED
|
@@ -14,4 +14,29 @@
|
|
|
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
|
+
Thread.new{
|
|
24
|
+
begin
|
|
25
|
+
Aro::Dom::Ma_ain.instance.reign!
|
|
26
|
+
rescue StandardError => e
|
|
27
|
+
FDot::Based::Cubicus.run_exit_cleanup!
|
|
28
|
+
puts "rescued in aro binary: #{e}"
|
|
29
|
+
puts "exiting..."
|
|
30
|
+
exit
|
|
31
|
+
ensure
|
|
32
|
+
FDot::Based::Cubicus.run_exit_cleanup!
|
|
33
|
+
end
|
|
34
|
+
}.join
|
|
35
|
+
else
|
|
36
|
+
Aro::Dom::Ma_ain.instance.reign!
|
|
37
|
+
end
|
|
38
|
+
rescue StandardError => e
|
|
39
|
+
puts "rescued in aro binary: #{e}"
|
|
40
|
+
puts Thread.current.backtrace
|
|
41
|
+
raise e
|
|
42
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3105ae158bd9e2baed7e8a78ee4a4a4db70adc9e1275994ebdce7e31b5749f0aa9b912e4965989980cf5097721392f2f6a49a7d7cb34f95be13915385a270dab
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
27a910ae76baaff66ca5e791feb0396a29047426e9250c76d7cb3bc201b9f2492d0ea653b05632711509743b2fbc2ba88aa8393446c34df591c524cb230dddaf
|
|
@@ -0,0 +1,80 @@
|
|
|
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 four 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
|
+
# 4) editor:
|
|
25
|
+
# this is a linuxserver/code-server instance for local code editing
|
|
26
|
+
#
|
|
27
|
+
services:
|
|
28
|
+
display:
|
|
29
|
+
image: lscr.io/linuxserver/firefox:latest
|
|
30
|
+
container_name: display
|
|
31
|
+
environment:
|
|
32
|
+
- PUID=1000 # replace with host user id
|
|
33
|
+
- PGID=1000 # replace with host user group
|
|
34
|
+
- TZ=Etc/UTC
|
|
35
|
+
- FIREFOX_CLI=--kiosk http://host.docker.internal:8080/
|
|
36
|
+
- SELKIES_UI_SHOW_SIDEBAR=false
|
|
37
|
+
- HARDEN_DESKTOP=true
|
|
38
|
+
- HARDEN_OPENBOX=true
|
|
39
|
+
- RESTART_APP=true
|
|
40
|
+
volumes:
|
|
41
|
+
- ./.oss_om/open_system/display:/config
|
|
42
|
+
ports:
|
|
43
|
+
- "3001:3001" # use this to access display
|
|
44
|
+
- "3000:3000"
|
|
45
|
+
shm_size: "1gb"
|
|
46
|
+
restart: unless-stopped
|
|
47
|
+
extra_hosts:
|
|
48
|
+
- "host.docker.internal:host-gateway"
|
|
49
|
+
history:
|
|
50
|
+
image: gitea/gitea:latest
|
|
51
|
+
container_name: history
|
|
52
|
+
environment:
|
|
53
|
+
- USER_UID=1000
|
|
54
|
+
- USER_GID=1000
|
|
55
|
+
restart: unless-stopped
|
|
56
|
+
volumes:
|
|
57
|
+
- ./.oss_om/open_system/history:/data
|
|
58
|
+
ports:
|
|
59
|
+
- "2997:3000"
|
|
60
|
+
- "2222:22"
|
|
61
|
+
editor:
|
|
62
|
+
image: lscr.io/linuxserver/code-server:latest
|
|
63
|
+
container_name: editor
|
|
64
|
+
environment:
|
|
65
|
+
- PUID=1000
|
|
66
|
+
- PGID=1000
|
|
67
|
+
- TZ=America/New_York
|
|
68
|
+
- PASSWORD=${EDITOR_PASSWORD-insecure_password}
|
|
69
|
+
volumes:
|
|
70
|
+
- ./.oss_om/open_system/editor:/config
|
|
71
|
+
ports:
|
|
72
|
+
# artificial intelligence tells me this keeps my editor web traffic local.
|
|
73
|
+
- "127.0.0.1:8443:8443"
|
|
74
|
+
networks:
|
|
75
|
+
- editor_network
|
|
76
|
+
restart: unless-stopped
|
|
77
|
+
networks:
|
|
78
|
+
editor_network:
|
|
79
|
+
driver: bridge
|
|
80
|
+
|
data/craft_env.template
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
EDITOR_PASSWORD=vs_oss_om_editor
|
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}'"
|
|
@@ -13,15 +15,24 @@ en:
|
|
|
13
15
|
new_ivar_value_prompt: "enter new %{value_type} for %{def_key} (current is '%{current_value}'"
|
|
14
16
|
edit_ivars_possible_values_select: "listing possible values for %{def_key}"
|
|
15
17
|
design_schema_for: "designing schema for %{localized_name}"
|
|
18
|
+
design_json_schema_for: "designing json schema for %{localized_name}"
|
|
19
|
+
design_json_schema_new_key: "what type of data will %{localized_name} hold?"
|
|
16
20
|
designer:
|
|
17
21
|
create_menu: "enter display text for the new menu"
|
|
18
22
|
imports:
|
|
19
23
|
confirm_import: "%{prompt_text} (selected: %{file_name}) confirm (y/n):"
|
|
20
24
|
user_cancelled: "user cancelled import."
|
|
21
25
|
plugins:
|
|
26
|
+
open_plugins_menu: "install :open_system or choose from the plugins/ directory."
|
|
22
27
|
confirm_plugin: "[selected %{file_name}] confirm (y/n):"
|
|
23
28
|
user_cancelled: "user cancelled import."
|
|
24
29
|
select_plugin: "select a plugin"
|
|
30
|
+
choose_plugin_description: "ruby classes are used as a way to interface other processes with oss_om."
|
|
31
|
+
choose_plugin_sample_info: "a sample_plugin.rb file is automatically generated in the plugins/ directory."
|
|
32
|
+
description: "chapter_plugins are installed in books"
|
|
33
|
+
location: "you can see them by navigating to the library"
|
|
34
|
+
new_book_prompt: "would you like to create a new book?"
|
|
35
|
+
new_book_menu: "create new book now?"
|
|
25
36
|
library:
|
|
26
37
|
get_book_param: "enter %{key}"
|
|
27
38
|
new_book_select: "creating a new book"
|
data/sys/aro/action.rb
CHANGED
|
@@ -65,7 +65,7 @@ module Aro
|
|
|
65
65
|
valid_param_keys!(action_key, params) && valid_param_values!(action_key, params)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def self.validate_data!(action_key, data)
|
|
68
|
+
def self.validate_data!(action_key, data = {})
|
|
69
69
|
Aro::P.say("validating #{action_key} action data")
|
|
70
70
|
|
|
71
71
|
raise "invalid data! (#{data})" unless data.kind_of?(Hash)
|
|
@@ -108,7 +108,7 @@ module Aro
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
if data.keys.count > Aro::Mancy::O
|
|
111
|
-
method_call_params << data.
|
|
111
|
+
method_call_params << data.stringify_keys
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
oss_om_const = params[:aro_class_name].constantize
|
|
@@ -121,7 +121,7 @@ module Aro
|
|
|
121
121
|
oss_om_const.send(params[:aro_class_method])
|
|
122
122
|
end
|
|
123
123
|
rescue NoMethodError => e
|
|
124
|
-
|
|
124
|
+
puts Thread.current.backtrace
|
|
125
125
|
Aro::P.say("exec_oss_om error! #{e}")
|
|
126
126
|
end
|
|
127
127
|
end
|
data/sys/aro/book.rb
CHANGED
|
@@ -36,12 +36,12 @@ module Aro
|
|
|
36
36
|
unless action_data["oss_om_type"].nil?
|
|
37
37
|
case action_data["oss_om_type"].to_sym
|
|
38
38
|
when :key_value_store
|
|
39
|
-
Aro::P.less(:going_to_design_schema)
|
|
40
39
|
Aro::Dom::Designer.design_schema_for(chapter_menu_item)
|
|
41
40
|
when :plugin
|
|
42
41
|
Aro::P.less("Aro::Dom::Ma_ain.running? #{Aro::Dom::Ma_ain.running?}")
|
|
43
|
-
if
|
|
44
|
-
|
|
42
|
+
if action_data.keys.include?(:plugin_file_path.to_s) &&
|
|
43
|
+
!action_data["plugin_file_path"].nil? &&
|
|
44
|
+
Aro::Dom::Ma_ain.running?
|
|
45
45
|
|
|
46
46
|
Aro::Dom::Ma_ain.run_plugin!(chapter_menu_item, action_data)
|
|
47
47
|
else
|
|
@@ -51,6 +51,8 @@ module Aro
|
|
|
51
51
|
else
|
|
52
52
|
Aro::Dom::Designer.design_schema_for(chapter_menu_item)
|
|
53
53
|
end
|
|
54
|
+
|
|
55
|
+
Aro::Dom::Ma_ain.navigate_to!(chapter_menu_item.menu)
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
#
|
|
@@ -69,19 +71,9 @@ module Aro
|
|
|
69
71
|
|
|
70
72
|
chapter_params = {
|
|
71
73
|
title: "chapter_#{contents_menu.menu_items.count}", # auto-increment
|
|
72
|
-
text: nil
|
|
73
74
|
}
|
|
74
75
|
|
|
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
76
|
chapter_menu_item = contents_menu.generate_new_item(chapter_params[:title], for_type: :system)
|
|
84
|
-
|
|
85
77
|
chapter_menu_item.aro_file.write!(
|
|
86
78
|
Aro::Dom::Store.build_exec_oss_om_params!(
|
|
87
79
|
chapter_params[:title],
|
|
@@ -92,7 +84,7 @@ module Aro
|
|
|
92
84
|
)
|
|
93
85
|
)
|
|
94
86
|
|
|
95
|
-
|
|
87
|
+
open_chapter!(chapter_menu_item.uuid, chapter_params.stringify_keys)
|
|
96
88
|
end
|
|
97
89
|
|
|
98
90
|
# the table_of_contents menu_item:
|
data/sys/aro/db.rb
CHANGED
data/sys/aro/designer.rb
CHANGED
|
@@ -35,7 +35,7 @@ module Aro
|
|
|
35
35
|
Aro::P.say("run the following commands to continue:")
|
|
36
36
|
Aro::P.say("$ cd #{Aro::Cor.ivar(:OSS_OM_HOME)} && oss_om")
|
|
37
37
|
Aro::P.say("exiting...")
|
|
38
|
-
|
|
38
|
+
Aro::Dom::Ma_ain.exec_quit!
|
|
39
39
|
else
|
|
40
40
|
Aro::Dom::Ma_ain.instance.reign!
|
|
41
41
|
end
|
|
@@ -49,6 +49,7 @@ module Aro
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
Aro::P.say("Aro::Dom::Ma_ain.open!")
|
|
52
|
+
Aro::P.say("loading aro gem v#{Aro::VERSION}...")
|
|
52
53
|
Aro::Dom::Ma_ain.open!
|
|
53
54
|
loop do
|
|
54
55
|
selected_menu_item_uuid = Aro::P.default_select(
|
|
@@ -196,6 +197,11 @@ module Aro
|
|
|
196
197
|
Aro::Dom::Ma_ain.toggle_run_mode
|
|
197
198
|
return
|
|
198
199
|
when :open_shell
|
|
200
|
+
if FDot::DISPLAY_MODES[:websockets] == FDot::Based::Interface.instance.display_mode
|
|
201
|
+
Aro::P.say("cannot open bash from FDot::DISPLAY_MODES[:websockets] display mode!")
|
|
202
|
+
Aro::P.say("bash must be run in FDot::DISPLAY_MODES[:terminal] display mode.")
|
|
203
|
+
return
|
|
204
|
+
end
|
|
199
205
|
Aro::P.say("starting bash session for #{`whoami`.strip}")
|
|
200
206
|
system(:bash.to_s)
|
|
201
207
|
else
|
|
@@ -334,6 +340,7 @@ module Aro
|
|
|
334
340
|
action_data = ensure_action_data_oss_om_type_exists!(action_data)
|
|
335
341
|
|
|
336
342
|
return design_schema_for(chapter_menu_item) if action_data["oss_om_type"].to_s == :key_value_store.to_s
|
|
343
|
+
return design_json_schema_for(chapter_menu_item) if action_data["oss_om_type"].to_s == :json_store.to_s
|
|
337
344
|
|
|
338
345
|
plugin_file_path = Aro::Dom::Plugins.choose_plugin
|
|
339
346
|
|
|
@@ -352,6 +359,123 @@ module Aro
|
|
|
352
359
|
})
|
|
353
360
|
end
|
|
354
361
|
|
|
362
|
+
def self.design_json_schema_for(chapter_menu_item)
|
|
363
|
+
action_data = chapter_menu_item.store.safe_get_key("action_data") || {}
|
|
364
|
+
raise "missing action data for #{chapter_menu_item.inspect}!" if action_data.nil? ||
|
|
365
|
+
!action_data.kind_of?(Hash)
|
|
366
|
+
|
|
367
|
+
action_data = ensure_action_data_oss_om_type_exists!(action_data)
|
|
368
|
+
return design_plugin_for(chapter_menu_item) if action_data["oss_om_type"].to_s == :plugin.to_s
|
|
369
|
+
return design_schema_for(chapter_menu_item) if action_data["oss_om_type"].to_s == :key_value_store.to_s
|
|
370
|
+
action_data_copy = action_data.dup
|
|
371
|
+
loop do
|
|
372
|
+
options = [
|
|
373
|
+
{name: :back, value: :back},
|
|
374
|
+
{name: "new_key(+)", value: :new_key}
|
|
375
|
+
] + action_data_copy.keys.map{|k|
|
|
376
|
+
value_display = action_data_copy[k].to_s
|
|
377
|
+
value_display = value_display.length > 5 ? value_display[0..5] + "..." : value_display
|
|
378
|
+
{name: "#{k}(#{value_display})", value: k}
|
|
379
|
+
} + [
|
|
380
|
+
{name: :save, value: :save}
|
|
381
|
+
]
|
|
382
|
+
|
|
383
|
+
selected_option = Aro::P.default_select(
|
|
384
|
+
I18n.t("open_menu.design_json_schema_for", localized_name: chapter_menu_item.localized_name),
|
|
385
|
+
options
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
case selected_option.to_sym
|
|
389
|
+
when :back
|
|
390
|
+
confirmed = true
|
|
391
|
+
if action_data_copy.any?{|k, v| action_data[k] != v} ||
|
|
392
|
+
(action_data_copy.keys & action_data.keys).count != action_data.keys.count
|
|
393
|
+
confirmed = get_new_value_from_user(
|
|
394
|
+
"unsaved changes exist. leave schema designer?",
|
|
395
|
+
"press enter to confirm ('n' to cancel):"
|
|
396
|
+
).nil?
|
|
397
|
+
end
|
|
398
|
+
break if confirmed
|
|
399
|
+
when :save
|
|
400
|
+
action_data_copy[:oss_om_type.to_s] = action_data["oss_om_type"].to_s
|
|
401
|
+
chapter_menu_item.aro_file.write!({
|
|
402
|
+
action_data: action_data_copy
|
|
403
|
+
})
|
|
404
|
+
break
|
|
405
|
+
when :new_key
|
|
406
|
+
# create new key
|
|
407
|
+
new_key = get_new_value_from_user("enter new key: ")
|
|
408
|
+
next if new_key.nil?
|
|
409
|
+
new_key = new_key.strip.gsub(/[\n\W]/, "_")
|
|
410
|
+
if action_data_copy.keys.include?(new_key)
|
|
411
|
+
# confirm overwrite?
|
|
412
|
+
confirm_overwrite = get_new_value_from_user(
|
|
413
|
+
"key #{new_key} already exists.",
|
|
414
|
+
"press enter to confirm ('n' to cancel):"
|
|
415
|
+
)
|
|
416
|
+
unless confirm_overwrite.nil?
|
|
417
|
+
Aro::P.say("user cancelled")
|
|
418
|
+
next
|
|
419
|
+
end
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
selected_data_type = Aro::P.default_select(
|
|
423
|
+
I18n.t("open_menu.design_json_schema_new_key", localized_name: new_key),
|
|
424
|
+
[{name: :cancel, value: :cancel}] + [
|
|
425
|
+
:boolean,
|
|
426
|
+
:number,
|
|
427
|
+
:string,
|
|
428
|
+
:hash,
|
|
429
|
+
:array
|
|
430
|
+
].map{|k| {name: k, value: k}}
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
next if selected_data_type == :cancel
|
|
434
|
+
|
|
435
|
+
new_value = nil
|
|
436
|
+
case selected_data_type
|
|
437
|
+
when :boolean
|
|
438
|
+
new_value = true
|
|
439
|
+
new_value = Aro::P.default_select(
|
|
440
|
+
"new_value is set to #{new_value}",
|
|
441
|
+
[{name: :toggle, value: :toggle}, {name: :keep, value: :keep}]
|
|
442
|
+
) == :keep
|
|
443
|
+
when :number
|
|
444
|
+
while !new_value.kind_of?(Numeric)
|
|
445
|
+
new_value = get_new_value_from_user(
|
|
446
|
+
"enter new #{selected_data_type} value for #{selected_option}:",
|
|
447
|
+
)
|
|
448
|
+
if !new_value.kind_of?(Numeric)
|
|
449
|
+
Aro::P.say("#{new_value} is invalid! expected numeric value.")
|
|
450
|
+
new_value = nil
|
|
451
|
+
end
|
|
452
|
+
end
|
|
453
|
+
when :string
|
|
454
|
+
new_value = get_new_value_from_user(
|
|
455
|
+
"enter new #{selected_data_type} value for #{selected_option}:",
|
|
456
|
+
)
|
|
457
|
+
when :hash
|
|
458
|
+
new_value = {}
|
|
459
|
+
when :array
|
|
460
|
+
new_value = []
|
|
461
|
+
end
|
|
462
|
+
action_data_copy[new_key] = new_value
|
|
463
|
+
Aro::P.say("set #{new_key} to #{action_data_copy[new_key]}")
|
|
464
|
+
else
|
|
465
|
+
# todo:
|
|
466
|
+
# Aro::P.say("todo: edit selected key #{selected_option}")
|
|
467
|
+
# case action_data_copy[selected_option]&.class
|
|
468
|
+
# when TrueClass, FalseClass:
|
|
469
|
+
# when Numeric:
|
|
470
|
+
# when String:
|
|
471
|
+
# when Hash:
|
|
472
|
+
# when Array:
|
|
473
|
+
# end
|
|
474
|
+
end
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
end
|
|
478
|
+
|
|
355
479
|
def self.design_schema_for(chapter_menu_item)
|
|
356
480
|
action_data = chapter_menu_item.store.safe_get_key("action_data") || {}
|
|
357
481
|
raise "missing action data for #{chapter_menu_item.inspect}!" if action_data.nil? ||
|
|
@@ -360,6 +484,7 @@ module Aro
|
|
|
360
484
|
action_data = ensure_action_data_oss_om_type_exists!(action_data)
|
|
361
485
|
|
|
362
486
|
return design_plugin_for(chapter_menu_item) if action_data["oss_om_type"].to_s == :plugin.to_s
|
|
487
|
+
return design_json_schema_for(chapter_menu_item) if action_data["oss_om_type"].to_s == :json_store.to_s
|
|
363
488
|
|
|
364
489
|
action_data_copy = action_data.except(:oss_om_type.to_s).dup
|
|
365
490
|
loop do
|
|
@@ -432,7 +557,9 @@ module Aro
|
|
|
432
557
|
while new_val.nil? && !user_cancelled
|
|
433
558
|
Aro::P.say(ask_text)
|
|
434
559
|
puts "\n"
|
|
435
|
-
new_val = Aro::
|
|
560
|
+
new_val = Aro::Prompt.ask(prompt_text_override || I18n.t("open_menu.get_new_value_from_user"))
|
|
561
|
+
|
|
562
|
+
puts "#{self.class.name} got new_val: #{new_val}"
|
|
436
563
|
user_cancelled = new_val.nil? || new_val.empty?
|
|
437
564
|
new_val = nil if user_cancelled
|
|
438
565
|
end
|
|
@@ -448,18 +575,14 @@ module Aro
|
|
|
448
575
|
# ensure oss_om_type is set
|
|
449
576
|
options = [
|
|
450
577
|
{name: :key_value_store, value: :key_value_store},
|
|
451
|
-
{name: :plugin, value: :plugin}
|
|
578
|
+
{name: :plugin, value: :plugin},
|
|
579
|
+
{name: :json_store, value: :json_store}
|
|
452
580
|
]
|
|
453
581
|
|
|
454
|
-
|
|
582
|
+
data["oss_om_type"] = Aro::P.default_select(
|
|
455
583
|
"select chapter schema oss_om_type: ",
|
|
456
584
|
options
|
|
457
|
-
)
|
|
458
|
-
|
|
459
|
-
case selected_option.to_sym
|
|
460
|
-
when :key_value_store, :plugin
|
|
461
|
-
data["oss_om_type"] = selected_option.to_s
|
|
462
|
-
end
|
|
585
|
+
).to_s
|
|
463
586
|
end
|
|
464
587
|
|
|
465
588
|
data
|
data/sys/aro/imports.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Aro
|
|
|
34
34
|
raise "invalid file path! #{selected_option}" unless File.exist?(selected_option)
|
|
35
35
|
|
|
36
36
|
Aro::P.say("selected import: #{selected_option}")
|
|
37
|
-
confirmed = Aro::
|
|
37
|
+
confirmed = Aro::Prompt.ask(
|
|
38
38
|
I18n.t(
|
|
39
39
|
"open_menu.imports.confirm_import",
|
|
40
40
|
file_name: File.basename(selected_option),
|
|
@@ -67,9 +67,9 @@ module Aro
|
|
|
67
67
|
[".keep", ""],
|
|
68
68
|
["sample.txt", "sample text"]
|
|
69
69
|
].each{|a|
|
|
70
|
-
file_path = ::File.join(imports_dir, a[Aro::
|
|
70
|
+
file_path = ::File.join(imports_dir, a[Aro::Mancy::O])
|
|
71
71
|
::File.open(file_path, "w+") {|f|
|
|
72
|
-
f.write(a[Aro::
|
|
72
|
+
f.write(a[Aro::Mancy::S])
|
|
73
73
|
} unless ::File.exist?(file_path)
|
|
74
74
|
}
|
|
75
75
|
end
|
data/sys/aro/library.rb
CHANGED
|
@@ -35,7 +35,7 @@ module Aro
|
|
|
35
35
|
is_valid = true
|
|
36
36
|
raise "invalid book_yaml" unless is_valid
|
|
37
37
|
|
|
38
|
-
puts
|
|
38
|
+
puts "todo_import_book_yaml"
|
|
39
39
|
Aro::Dom::Ma_ain.sane_backtrace!
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -95,8 +95,8 @@ module Aro
|
|
|
95
95
|
case selected_option.to_sym
|
|
96
96
|
when :back
|
|
97
97
|
confirmed = true
|
|
98
|
-
|
|
99
|
-
confirmed = Aro::
|
|
98
|
+
unless book_params.all?{|k, v| v.nil?}
|
|
99
|
+
confirmed = Aro::Prompt.ask(I18n.t("open_menu.library.unsaved_changes_confirm")).to_sym
|
|
100
100
|
confirmed = confirmed == :y
|
|
101
101
|
end
|
|
102
102
|
return Aro::Dom::Library.open! if confirmed
|
|
@@ -115,7 +115,7 @@ module Aro
|
|
|
115
115
|
private
|
|
116
116
|
|
|
117
117
|
def self.generate_new_book!(book_params)
|
|
118
|
-
new_book_title_key = book_params[:title].downcase.gsub(" ", "_").to_sym
|
|
118
|
+
new_book_title_key = "#{book_params[:title].downcase}".gsub(" ", "_").to_sym
|
|
119
119
|
|
|
120
120
|
book_menu = open_book(
|
|
121
121
|
new_book_title_key,
|
data/sys/aro/locale.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Aro
|
|
|
15
15
|
class Locale
|
|
16
16
|
|
|
17
17
|
def self.add_i18n_key(user_input_text, library_name: :menus, new_i18n_display_key: nil)
|
|
18
|
-
Aro::
|
|
18
|
+
Aro::D.say(__method__)
|
|
19
19
|
library_yaml = load_library(library_name: library_name)
|
|
20
20
|
new_i18n_display_key = i18n_keyify_text(user_input_text) if new_i18n_display_key.nil?
|
|
21
21
|
|
|
@@ -70,7 +70,7 @@ module Aro
|
|
|
70
70
|
|
|
71
71
|
def self.i18n_keyify_text(text)
|
|
72
72
|
# downcase'd, gsub non-word characters with "_"
|
|
73
|
-
text.downcase.gsub(/[\W]/, "_")
|
|
73
|
+
"#{text.downcase}".gsub(/[\W]/, "_")
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def self.i18n_valuify_text(text)
|
|
@@ -94,7 +94,7 @@ module Aro
|
|
|
94
94
|
Reiquire.configure_i18n
|
|
95
95
|
return false
|
|
96
96
|
end
|
|
97
|
-
|
|
97
|
+
Aro::V.say(library_yaml.inspect)
|
|
98
98
|
|
|
99
99
|
default_locale = library_yaml[
|
|
100
100
|
I18n.default_locale.to_s
|
data/sys/aro/mancy.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module Aro
|
|
16
16
|
class Mancy
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
A = :"@"
|
|
19
19
|
O = 0
|
|
20
20
|
S = 1
|
|
@@ -96,7 +96,7 @@ module Aro
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def self.domain
|
|
99
|
-
is_initialized? ? "#{Aro::Mancy.aro_mancy_name}#{Aro::Mancy::A}#{Aro::Mancy}" : `whoami`.strip
|
|
99
|
+
is_initialized? ? "#{Aro::Mancy.aro_mancy_name}#{Aro::Mancy::A}#{Aro::Mancy.name}" : `whoami`.strip
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
def self.aro_mancy_name
|