aro 0.2.6 → 0.2.8

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -2
  3. data/README.md +10 -54
  4. data/aro.gemspec +6 -3
  5. data/bin/oss_om +2 -0
  6. data/checksums/aro-0.2.7.gem.sha512 +1 -0
  7. data/checksums/aro-0.2.8.gem.sha512 +1 -0
  8. data/listen.rb +1 -1
  9. data/locale/en.cor.yml +28 -35
  10. data/locale/en.yml +23 -60
  11. data/sys/aro/action.rb +132 -0
  12. data/sys/aro/book.rb +150 -0
  13. data/sys/aro/d.rb +3 -1
  14. data/sys/aro/db/migrate/1793913747_create_data_bases.rb +2 -0
  15. data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +2 -0
  16. data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +2 -0
  17. data/sys/aro/db/migrate/1793913841_create_menus.rb +2 -0
  18. data/sys/aro/db/migrate/1793913861_create_menu_items.rb +3 -2
  19. data/sys/aro/db.rb +19 -33
  20. data/sys/aro/designer.rb +291 -102
  21. data/sys/aro/imports.rb +78 -0
  22. data/sys/aro/library.rb +202 -0
  23. data/sys/aro/locale.rb +4 -2
  24. data/sys/aro/mancy.rb +6 -39
  25. data/sys/aro/models/concerns/tar_go_for_root_sec.rb +34 -0
  26. data/sys/aro/models/concerns/uuid.rb +2 -0
  27. data/sys/aro/models/data_base.rb +73 -11
  28. data/sys/aro/models/directory.rb +3 -5
  29. data/sys/aro/models/file.rb +3 -1
  30. data/sys/aro/models/menu.rb +65 -1
  31. data/sys/aro/models/menu_item.rb +68 -4
  32. data/sys/aro/oss_open_menu.rb +307 -0
  33. data/sys/aro/p.rb +15 -9
  34. data/sys/aro/plugins.rb +104 -0
  35. data/sys/aro/r.rb +2 -0
  36. data/sys/aro/{cor.rb → settings/cor.rb} +163 -220
  37. data/sys/aro/settings/git.rb +44 -0
  38. data/sys/aro/settings/ssh.rb +108 -0
  39. data/sys/aro/store.rb +111 -37
  40. data/sys/aro/v.rb +3 -1
  41. data/sys/aro.rb +2 -0
  42. data/sys/ma_ain.rb +271 -0
  43. data/sys/reiquire.rb +41 -54
  44. data/sys/shr/prompt.rb +6 -1
  45. data/sys/shr/version.rb +8 -8
  46. data/tasks/make.rake +2 -3
  47. metadata +39 -24
  48. data/locale/en.cards.yml +0 -519
  49. data/locale/en.cmd.yml +0 -34
  50. data/locale/en.usage.yml +0 -142
  51. data/sys/aro/cmd.rb +0 -96
  52. data/sys/aro/db/migrate/1763374647_create_tecks.rb +0 -20
  53. data/sys/aro/db/migrate/1763432541_create_tlogs.rb +0 -20
  54. data/sys/aro/ma_ain.rb +0 -54
  55. data/sys/aro/models/teck.rb +0 -251
  56. data/sys/aro/models/tlog.rb +0 -21
  57. data/sys/aro/views/base.rb +0 -25
  58. data/sys/aro/views/teck.rb +0 -30
  59. data/sys/cli/constants.rb +0 -45
  60. data/sys/cli/create.rb +0 -23
  61. data/sys/cli/nterface.rb +0 -37
  62. data/sys/cli/teck.rb +0 -107
  63. data/sys/cli/usage.rb +0 -25
  64. data/sys/cli.rb +0 -23
  65. data/sys/shr/t.rb +0 -74
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 279f80459edf35682f8291e75dc65c1f92728f90febccc332b742a9b825b239b
4
- data.tar.gz: 4aa8aac39b11468c25e34f232846689e80af84dfa5924c3dad887d499c851e2e
3
+ metadata.gz: 33fb4492fff420dc6e9467e84572e6f742d93da5b0e86bb2384c79e9498d8348
4
+ data.tar.gz: e62e74089db19c5b8e96748fd126bf8dd551e215987e601c71fd9284b23ac13a
5
5
  SHA512:
6
- metadata.gz: 8c680184cff7f46e5627a10cc846a4723d3cfd3a80fb2f4206df0ea16e47aa5f1ee2dab9e5732c0ffc12ed42a3fce0392749068a8b0a332ea6a2c435340885c7
7
- data.tar.gz: 61354e41b939cf8d67f62c869306441e250aed60fe4872198f72eb7e4eefa1dd95ee4f6605503f47190ca4322f1ed573e30e8b9023139640adf8fded083b3802
6
+ metadata.gz: 01ac90efea24a115c557487670364f128a0d86b4dceee0d05b5d6ab421a3ff130156c3b35e59d901930a2db7738fcd731cc3f20480b394e4926dec453c2e6eaf
7
+ data.tar.gz: 627f333cf704d7deddd98f5215e36dc36f524b13038ea0eaac60df8e7ac48295e9b85e7256fcdc7a642253732f0a49b487fe3df49ebc98c6ba9c4723d313dc15
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aro (0.2.6)
4
+ aro (0.2.8)
5
5
  activerecord (~> 8.1, >= 8.1.4.1)
6
6
  i18n (~> 1.15, >= 1.15.2)
7
7
  sqlite3 (~> 2.10, >= 2.10.2)
8
+ tty-font (~> 0.5, >= 0.5.0)
8
9
  tty-prompt (~> 0.23, >= 0.23.1)
9
10
 
10
11
  GEM
@@ -98,6 +99,7 @@ GEM
98
99
  timeout (0.6.1)
99
100
  tty-color (0.6.0)
100
101
  tty-cursor (0.7.1)
102
+ tty-font (0.5.0)
101
103
  tty-prompt (0.23.1)
102
104
  pastel (~> 0.8)
103
105
  tty-reader (~> 0.8)
@@ -134,7 +136,7 @@ CHECKSUMS
134
136
  activemodel (8.1.4.1) sha256=063caf105372fbc98b2d789e4be23de63ac5c043f7d9330f04e2caddb7012805
135
137
  activerecord (8.1.4.1) sha256=bd65599ca0b5d210937f835d42c7aff69d271741c75aab022730be6cbce67e87
136
138
  activesupport (8.1.4.1) sha256=16ac4f341ca65c85a1fcdb8ac73f68891aae9e3c4a6f9c3a27daed8b00017ed7
137
- aro (0.2.6)
139
+ aro (0.2.8)
138
140
  base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
139
141
  bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66
140
142
  bundler (4.0.24) sha256=16ca64e20816a0cf151a948fb141d788602996d2b4d73577b74388fe84fa98bc
@@ -189,6 +191,7 @@ CHECKSUMS
189
191
  timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
190
192
  tty-color (0.6.0) sha256=6f9c37ca3a4e2367fb2e6d09722762647d6f455c111f05b59f35730eeb24332a
191
193
  tty-cursor (0.7.1) sha256=79534185e6a777888d88628b14b6a1fdf5154a603f285f80b1753e1908e0bf48
194
+ tty-font (0.5.0) sha256=495ee588701be4abaf03da8b14382794003cb2d836127b02c78cda18aaf451e2
192
195
  tty-prompt (0.23.1) sha256=fcdbce905238993f27eecfdf67597a636bc839d92192f6a0eef22b8166449ec8
193
196
  tty-reader (0.9.0) sha256=c62972c985c0b1566f0e56743b6a7882f979d3dc32ff491ed490a076f899c2b1
194
197
  tty-screen (0.8.2) sha256=c090652115beae764336c28802d633f204fb84da93c6a968aa5d8e319e819b50
data/README.md CHANGED
@@ -1,70 +1,26 @@
1
- # aro
2
- >__a cli for tarot__ - follow the way of the aro eht.
1
+ ## aro
2
+ ### .oss_om
3
+
4
+ > __a oss_om unix utility__
3
5
 
4
6
  ##### __current version:__
5
7
  [![Gem Version](https://badge.fury.io/rb/aro.svg)](https://badge.fury.io/rb/aro)
6
8
 
7
- aro is a command line interface that allows you to manage multiple tarot tecks.
8
-
9
+ aro is a unix utility for designing and creating linux applications.
9
10
 
10
- ### install
11
+ ### installation
11
12
 
12
13
  ```bash
13
14
  $ gem install aro
14
15
  ```
15
16
 
16
- ### use
17
-
18
- ```bash
19
- $ aro -h
20
- ```
21
-
22
- [usage documentation](https://raw.githubusercontent.com/i2097i/aro/refs/heads/master/locale/en.usage.yml)
23
-
24
-
25
- [card definitions](https://raw.githubusercontent.com/i2097i/aro/refs/heads/master/locale/en.cards.yml)
26
-
27
-
28
- ### develop
29
-
30
- [rubygems.org guides](https://guides.rubygems.org)
31
-
32
- ```ruby
33
- # the Rakefile contains bundler's gem_tasks,
34
- # which are used for gem development.
35
-
36
- # Rakefile
37
- require "bundler/gem_tasks"
38
- ```
39
-
40
- ```bash
41
- # list tasks
42
- $ rake --tasks
43
-
44
- # build gem
45
- $ rake build
46
-
47
- # build and install
48
- $ rake install
49
- ```
50
-
51
- ### test
17
+ ### usage
52
18
 
53
19
  ```bash
54
- $ rspec
20
+ $ oss_om
55
21
  ```
56
-
57
- #### pre-commit hook:
58
- ```bash
59
- : cat .git/hooks/pre-commit
60
- #!/bin/sh
61
-
62
- echo "running pre-commit hooks"
63
- echo "exec rspec -f d -o ./spec/spec.log"
64
- exec rspec -f d -o ./spec/spec.log
65
- ```
66
-
67
22
  [license](http://opensource.org/licenses/MIT)
23
+
68
24
  [issues](https://github.com/i2097i/aro/issues)
69
25
 
70
- >aro by i2097i is copyright (2026)
26
+ ##### aro (v0.2.8) 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 = "a cli for tarot."
19
- spec.summary = Aro::RELEASE_NOTES.to_s
20
- spec.homepage = "https://github.com/i2097i/aro"
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"
@@ -36,4 +38,5 @@ Gem::Specification.new do |spec|
36
38
  spec.add_runtime_dependency "i18n", "~> 1.15", ">= 1.15.2"
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"
41
+ spec.add_runtime_dependency "tty-font", "~> 0.5", ">= 0.5.0"
39
42
  end
data/bin/oss_om CHANGED
@@ -1,5 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
+ # frozen_string_literal: true
4
+
3
5
  =begin
4
6
 
5
7
  aro
@@ -0,0 +1 @@
1
+ 68d130e78710ebf7ce77cd530fa1e04bcdbd6c8253d8bbec3be68dc86b414e013a27368bb035836d776ee210c900b86157836089033d634d2bc96a2a7bf347f3
@@ -0,0 +1 @@
1
+ bf02f246670ca6f9d520c5fa1f4bc76205694f68188cb9492e66e7084e12cbb41227a95e32e9016fe4801dced2823235ab38f9023e75701cf5a8e01b1b34ceae
data/listen.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require :listen.to_s
2
2
 
3
- listener = Listen.to(*[:sys.to_s, :bin.to_s, :spec.to_s, :locale.to_s], only: /[\.rb\.yml]/) {|modified, added, removed|
3
+ listener = Listen.to(*[:sys.to_s, :bin.to_s, :locale.to_s], only: /[oss_om\.rb\.yml]/) {|modified, added, removed|
4
4
  # puts modified
5
5
  # puts added
6
6
  # puts removed
data/locale/en.cor.yml CHANGED
@@ -1,44 +1,37 @@
1
1
  en:
2
2
  cor:
3
- aro_env:
4
- O_description: "read-only env var for holding O."
5
- S_description: "read-only env var for holding S."
6
- OS_description: "read-only env var for holding OS."
7
- E_description: "read-only env var for holding E."
8
- N_description: "read-only env var for holding N"
9
- NAME_FILE_description: "read-only env var for name file."
10
- I2097I_description: "read-only env var for i2097i."
11
- YES_description: "read-only env var for 'aroyes'."
12
- ALL_description: "read-only env var for 'all'."
13
- dimension:
14
- description: "selected dimension of aro space."
15
- dev_tarot_description: "reads from /dev/tarot device if available."
16
- ruby_facot_description: "generated ruby_facot (facade randomness)."
17
- oss_om_home:
18
- description: "the directory where .oss_om lives."
19
- any_valid_path_description: "any valid path. if null $HOME is used."
20
- interface:
21
- description: "aro output interface."
22
- terminal_description: "render terminal output (default)."
23
- lanimret_description: "render flie web output."
24
- height_description: "display height. valid range: (%{min}-%{max})"
25
- width_description: "display width. valid range: (%{min}-%{max})"
26
- env:
27
- description: "aro run environment."
28
- development_description: "basic development logs and features."
29
- production_description: "game logging only."
30
- test_description: "logging and features tailored for tests."
31
- verbose_description: "enable verbose logging in development env."
32
- log_aro_db_description: "show aro database transactions"
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:
17
+ O_description: "zero."
18
+ S_description: "one."
19
+ OS_description: "two."
20
+ E_description: "three."
21
+ N_description: "four."
22
+ V_description: "five."
23
+ OSS_OM_FILE_description: "generated oss_om project file."
24
+
25
+ oss_om_pkey_path:
26
+ description: "path to openssl public key. used to perform oss_om actions."
27
+ path_description: "path to openssl key (usually ~/.ssh/id_key_name.pub)"
33
28
  generate: "generating default cor file at %{name}."
34
29
  source: "installing ivars from %{name}..."
35
30
  maximum: "max"
36
31
  minimum: "min"
37
32
  possible_values: "possible values"
38
- type:
33
+ types:
39
34
  bool_description: "true or false."
40
35
  int_description: "a primitive decimal-less numeric."
41
- string_description: "a blank-space-terminated string of characters."
42
- values_description: "an enumerated type."
43
- z_description: "sleep time between attempts to read /dev/tarot. valid range (%{min}-%{max})"
44
- z_max_description: "max number of z long sleeps before giving up. valid range (%{min}-%{max})"
36
+ string_description: "string of characters."
37
+ values_description: "an enumerated type."
data/locale/en.yml CHANGED
@@ -1,68 +1,31 @@
1
1
  en:
2
2
  open_menu:
3
- welcome: "welcome to oss_om"
3
+ base_db_password_prompt: "enter database password <%{sql_filepath}> (default %{aro_name}): "
4
+ edit_action_for_menu_item: "edit action '%{action_name}' for menu item '%{localized_name}'"
4
5
  edit_menu_localized_name: "designing open menu '%{localized_name}'"
6
+ edit_menu_item_localized_name: "designing open menu item '%{localized_name}'"
7
+ design_action_for_menu_item: "designing open menu item action for '%{localized_name}'"
5
8
  get_new_value_from_user: "input new value (press enter to cancel): "
9
+ select_exec_oss_om_const: "which oss_om class will run this action?"
10
+ select_exec_oss_om_method: "%{class} method to run?"
11
+ default_user_item_text: "default %{localized_name} item"
12
+ edit_ivars_select: "which ivar do you want to edit?"
13
+ new_ivar_value_prompt: "enter new %{value_type} for %{def_key} (current is '%{current_value}'"
14
+ edit_ivars_possible_values_select: "listing possible values for %{def_key}"
15
+ design_schema_for: "designing schema for %{localized_name}"
6
16
  designer:
7
17
  create_menu: "enter display text for the new menu"
18
+ imports:
19
+ confirm_import: "%{prompt_text} (selected: %{file_name}) confirm (y/n):"
20
+ user_cancelled: "user cancelled import."
21
+ plugins:
22
+ confirm_plugin: "[selected %{file_name}] confirm (y/n):"
23
+ user_cancelled: "user cancelled import."
24
+ select_plugin: "select a plugin"
25
+ library:
26
+ get_book_param: "enter %{key}"
27
+ new_book_select: "creating a new book"
28
+ unsaved_changes_confirm: "unsaved changes. go back anyway? (y/n):"
8
29
  errors:
9
30
  invalid_i18n_path: "invalid_i18n_path"
10
- constants:
11
- commands: "COMMANDS"
12
- subcommands: "SUBCOMMANDS"
13
- # VERY IMPORTANT!
14
- very_important: "VERY IMPORTANT! %{dev_tarot}"
15
- # VERY IMPORTANT!
16
-
17
- errors:
18
- header: "%{cmd} says there was a problem."
19
- invalid_usage: "%{cmd} says you're not supposed to be here."
20
- missing_args: "%{cmd} says missing required argument(s)."
21
- missing_teck: "%{cmd} says no teck selected. use 'aro teck' to select one or 'aro teck new var_name' to create one."
22
- not_found: "%{cmd} not found."
23
- not_in_aro: "%{cmd} says you are not in aro space. that command will not work here."
24
- not_initialized: "%{cmd} says you need to initialize aro. run 'aro init' to do so"
25
- missing_base_migrations: "missing_base_migrations"
26
- locale_load_error: "locale_load_error: failed to load locale %{named} library"
27
- warnings:
28
- invalid_order: "the order specified for displaying tlogs in invalid. using default (desc)."
29
- messages:
30
- base_db_password_prompt: "enter main password for base sqlite3 database <%{sql_filepath}> (default %{aro_name}): "
31
- choose_card: "choose a card."
32
- choose_teck: "choose a teck."
33
- confirmation_prompt: "input 'aroyes' to reset %{name}, or enter to cancel (cancel): "
34
- creating: "creating %{name}..."
35
- creation_attempt: "attempting to create aro table named %{name}..."
36
- creation_failure: "%{name} creation failed!"
37
- creation_success: |
38
- %{name} created successfully!
39
-
40
- to get started navigate to the %{name} directory:
41
-
42
- $ cd %{name}
43
-
44
- see aro --help for usage.
45
- teck_created_sucessfully: "%{name} teck created successfully"
46
- teck_selected: "%{name} teck selected in the %{room} room."
47
- drawing: "drawing a card from %{name}"
48
- drawing_from_dimension: "in the the %{dimension} dimension..."
49
- ruby_facot_random: |
50
- unable to read from /dev/tarot - using facade randomness instead.
51
- for more information visit:
52
- https://github.com/arowmancy/dev_tarot
53
- history_drawn: "drawn cards"
54
- no_tecks: |
55
- no tecks created yet.
56
-
57
- use the following command to create one:
58
-
59
- $ aro teck new var_name
60
-
61
- see aro --help for usage.
62
- printing_card: "printing %{card}..."
63
- showing: "showing %{name} [count:%{count}, order:%{order}]..."
64
- shuffling: "shuffling %{name}'s cards..."
65
- replacing_drawn: "replacing all drawn cards to %{name}..."
66
- resetting: "resetting %{name}'s cards..."
67
- understood: "%{name} says: 'understood.'"
68
- welcome: "summoned %{name}"
31
+ locale_load_error: "locale_load_error: failed to load locale %{named} library"
data/sys/aro/action.rb ADDED
@@ -0,0 +1,132 @@
1
+ # frozen_string_literal: true
2
+
3
+ =begin
4
+
5
+ action.rb
6
+
7
+ aro dom action
8
+
9
+ by i2097i
10
+
11
+ =end
12
+
13
+ module Aro
14
+ module Dom
15
+ class Action
16
+
17
+ TYPES = {
18
+ OSS_OM: {
19
+ key: :exec_oss_om,
20
+ params: {
21
+ aro_class_name: {
22
+ default_value: Aro::Dom::Action.name,
23
+ required: true
24
+ },
25
+ aro_class_method: {
26
+ default_value: :name,
27
+ required: true
28
+ },
29
+ aro_call_params: {
30
+ default_value: [],
31
+ }
32
+ },
33
+ data: {
34
+ default_value: {}
35
+ }
36
+ }
37
+ }
38
+
39
+ def self.valid_param_values!(action_key, params)
40
+ params.keys.each{|k|
41
+ v = params[k]
42
+ params_action_def = Aro::Dom::Action::TYPES[action_key][:params][k.to_sym]
43
+ v = params_action_def[:default_value] if v.nil?
44
+ required = false
45
+ required = params_action_def[:required] unless params_action_def[:required].nil?
46
+
47
+ raise "required value missing! params[#{k}] = '#{v}'" if required && (v.nil? || v.empty?)
48
+ }
49
+ end
50
+
51
+ def self.valid_param_keys!(action_key, params)
52
+ (
53
+ Aro::Dom::Action::TYPES[action_key][:params].keys & # assert one ampersand(&) here!
54
+ params.keys.map{|k|
55
+ k.to_s&.strip.to_sym
56
+ }
57
+ ).count == params.keys.count
58
+ end
59
+
60
+ def self.validate_params!(action_key, params)
61
+ Aro::P.say("validating #{action_key} action")
62
+ Aro::V.say("params: #{JSON.pretty_generate(params)}")
63
+
64
+ raise "invalid params! (#{params})" unless params.kind_of?(Hash) &&
65
+ valid_param_keys!(action_key, params) && valid_param_values!(action_key, params)
66
+ end
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
+
75
+ def self.validate_action_key!(action_key)
76
+ action_key = action_key&.upcase.to_sym
77
+ raise "invalid action! (#{action_key})" unless Aro::Dom::Action::TYPES.keys.include?(action_key)
78
+ return action_key
79
+ end
80
+
81
+ def self.create(action_key, menu_item)
82
+ Aro::P.say(__method__)
83
+ action_key = validate_action_key!(action_key)
84
+
85
+ aro_action_type_def = Aro::Dom::Action::TYPES[action_key]
86
+ case aro_action_type_def[:key]
87
+ when :exec_oss_om
88
+ Aro::Dom::Oss_OpenMenu.create_exec_oss_om_entry_for(menu_item)
89
+ end
90
+ end
91
+
92
+ def self.perform(action_key, params = {}, data = {})
93
+ Aro::P.say(__method__)
94
+ action_key = validate_action_key!(action_key)
95
+ validate_params!(action_key, params)
96
+ validate_data!(action_key, data)
97
+
98
+ params = params.symbolize_keys
99
+ aro_action_type_def = Aro::Dom::Action::TYPES[action_key]
100
+ case aro_action_type_def[:key]
101
+ when :exec_oss_om
102
+ Aro::P.say("#{params[:aro_class_name]}.#{params[:aro_class_method]}")
103
+ begin
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
123
+ rescue NoMethodError => e
124
+ Aro::Dom::Ma_ain.sane_backtrace!
125
+ Aro::P.say("exec_oss_om error! #{e}")
126
+ end
127
+ end
128
+ end
129
+
130
+ end
131
+ end
132
+ end
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
data/sys/aro/d.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  =begin
2
4
 
3
5
  d.rb
@@ -21,7 +23,7 @@ module Aro
21
23
 
22
24
  def self.should_print?
23
25
  return false unless Aro::Cor.ivar(:ENV).present?
24
- Aro::Cor::DBG_MODES.include?(Aro::Cor.ivar(:ENV)&.to_sym)
26
+ Aro::Cor::DEBUG_MODES.include?(Aro::Cor.ivar(:ENV)&.to_sym)
25
27
  end
26
28
  end
27
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateDataBases < ActiveRecord::Migration[8.1]
2
4
  def change
3
5
  create_table :data_bases do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateDataBaseDirectories < ActiveRecord::Migration[8.1]
2
4
  def change
3
5
  create_table :data_base_directories do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateDataBaseFiles < ActiveRecord::Migration[8.1]
2
4
  def change
3
5
  create_table :data_base_files do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateMenus < ActiveRecord::Migration[8.1]
2
4
  def change
3
5
  create_table :menus do |t|