aro 0.2.7 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49c45a57df78cbe2dd5a637afc2fc665e30f078f7168f20c0d082e51b57f524d
4
- data.tar.gz: ec6c532357abe58d831550ded9341bf1878054555e4d8f9f3530218bab82ccd0
3
+ metadata.gz: 33fb4492fff420dc6e9467e84572e6f742d93da5b0e86bb2384c79e9498d8348
4
+ data.tar.gz: e62e74089db19c5b8e96748fd126bf8dd551e215987e601c71fd9284b23ac13a
5
5
  SHA512:
6
- metadata.gz: 694efc455ed4636bb9dd7dd37c60ec5b31f03b5fb272a71acebc805789e4c4368484802de729d5d9c584e48b54db7200554c65f58c56ee948ab2c5e7c21c19bd
7
- data.tar.gz: a28f71863d7770caabf7938448635fd52f50e7f4a8724a7a05d41ec733d99a0e152e377261f66a74e815d887bd6fe53f7e72b8604d2930ce89681c6ac670b65a
6
+ metadata.gz: 01ac90efea24a115c557487670364f128a0d86b4dceee0d05b5d6ab421a3ff130156c3b35e59d901930a2db7738fcd731cc3f20480b394e4926dec453c2e6eaf
7
+ data.tar.gz: 627f333cf704d7deddd98f5215e36dc36f524b13038ea0eaac60df8e7ac48295e9b85e7256fcdc7a642253732f0a49b487fe3df49ebc98c6ba9c4723d313dc15
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aro (0.2.7)
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)
@@ -136,7 +136,7 @@ CHECKSUMS
136
136
  activemodel (8.1.4.1) sha256=063caf105372fbc98b2d789e4be23de63ac5c043f7d9330f04e2caddb7012805
137
137
  activerecord (8.1.4.1) sha256=bd65599ca0b5d210937f835d42c7aff69d271741c75aab022730be6cbce67e87
138
138
  activesupport (8.1.4.1) sha256=16ac4f341ca65c85a1fcdb8ac73f68891aae9e3c4a6f9c3a27daed8b00017ed7
139
- aro (0.2.7)
139
+ aro (0.2.8)
140
140
  base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
141
141
  bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66
142
142
  bundler (4.0.24) sha256=16ca64e20816a0cf151a948fb141d788602996d2b4d73577b74388fe84fa98bc
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ## aro
2
- ### oss_om*
2
+ ### .oss_om
3
3
 
4
4
  > __a oss_om unix utility__
5
5
 
@@ -23,4 +23,4 @@ $ oss_om
23
23
 
24
24
  [issues](https://github.com/i2097i/aro/issues)
25
25
 
26
- ##### aro (v0.2.7) by scot reichman 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 = "aro is a unix utility for designing and creating linux applications."
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"
@@ -0,0 +1 @@
1
+ bf02f246670ca6f9d520c5fa1f4bc76205694f68188cb9492e66e7084e12cbb41227a95e32e9016fe4801dced2823235ab38f9023e75701cf5a8e01b1b34ceae
data/locale/en.cor.yml CHANGED
@@ -1,11 +1,19 @@
1
1
  en:
2
2
  cor:
3
- env:
4
- description: "oss_om run environment."
5
- development_description: "add debugging verbosity to standard oss_om output."
6
- production_description: "standard oss_om output."
7
- test_description: "used for rspec."
8
- aro_env:
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
- oss_om_home:
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
@@ -8,9 +8,24 @@ en:
8
8
  get_new_value_from_user: "input new value (press enter to cancel): "
9
9
  select_exec_oss_om_const: "which oss_om class will run this action?"
10
10
  select_exec_oss_om_method: "%{class} method to run?"
11
- default_user_item_text: "item 1 for %{localized_name} menu"
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}"
12
16
  designer:
13
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):"
14
29
  errors:
15
30
  invalid_i18n_path: "invalid_i18n_path"
16
31
  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: :inspect,
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
- oss_om_ssh_key: {
44
- default_value: nil,
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
- params[:aro_class_name].constantize.send(params[:aro_class_method])
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
+ Aro::Dom::Ma_ain.sane_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