aro 0.2.5 → 0.2.7

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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.ruby-version +1 -0
  4. data/Gemfile.lock +109 -89
  5. data/README.md +10 -54
  6. data/aro.gemspec +12 -12
  7. data/bin/oss_om +17 -0
  8. data/checksums/aro-0.2.5.gem.sha512 +1 -0
  9. data/checksums/aro-0.2.6.gem.sha512 +1 -0
  10. data/checksums/aro-0.2.7.gem.sha512 +1 -0
  11. data/listen.rb +1 -1
  12. data/locale/en.cor.yml +22 -36
  13. data/locale/en.menu_items.yml +2 -0
  14. data/locale/en.menus.yml +2 -0
  15. data/locale/en.yml +14 -55
  16. data/sys/aro/action.rb +153 -0
  17. data/sys/aro/d.rb +6 -3
  18. data/sys/aro/db/migrate/.DS_Store +0 -0
  19. data/sys/aro/db/migrate/1793913747_create_data_bases.rb +15 -0
  20. data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +16 -0
  21. data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +14 -0
  22. data/sys/aro/db/migrate/1793913841_create_menus.rb +13 -0
  23. data/sys/aro/db/migrate/1793913861_create_menu_items.rb +15 -0
  24. data/sys/aro/db.rb +62 -37
  25. data/sys/aro/designer.rb +350 -0
  26. data/sys/aro/locale.rb +138 -0
  27. data/sys/aro/mancy.rb +30 -38
  28. data/sys/aro/models/concerns/.keep +0 -0
  29. data/sys/aro/models/concerns/tar_go_for_root_sec.rb +37 -0
  30. data/sys/aro/models/concerns/uuid.rb +31 -0
  31. data/sys/aro/models/data_base.rb +122 -0
  32. data/sys/aro/models/directory.rb +46 -0
  33. data/sys/aro/models/file.rb +29 -0
  34. data/sys/aro/models/menu.rb +91 -0
  35. data/sys/aro/models/menu_item.rb +113 -0
  36. data/sys/aro/oss_open_menu.rb +331 -0
  37. data/sys/aro/p.rb +15 -6
  38. data/sys/aro/r.rb +3 -2
  39. data/sys/aro/settings/cor.rb +602 -0
  40. data/sys/aro/settings/git.rb +69 -0
  41. data/sys/aro/settings/ssh.rb +123 -0
  42. data/sys/aro/store.rb +198 -0
  43. data/sys/aro/v.rb +4 -2
  44. data/sys/aro.rb +3 -2
  45. data/sys/ma_ain.rb +202 -0
  46. data/sys/reiquire.rb +133 -25
  47. data/sys/shr/.DS_Store +0 -0
  48. data/sys/shr/prompt.rb +13 -2
  49. data/sys/shr/version.rb +8 -2
  50. data/tasks/make.rake +2 -1
  51. metadata +65 -120
  52. data/bin/aos +0 -31
  53. data/bin/aro +0 -50
  54. data/bin/ino +0 -22
  55. data/ino_rules_todo.txt +0 -28
  56. data/locale/en.abot.yml +0 -81
  57. data/locale/en.amg.yml +0 -44
  58. data/locale/en.aos.yml +0 -40
  59. data/locale/en.cards.yml +0 -519
  60. data/locale/en.data.yml +0 -30
  61. data/locale/en.dom.yml +0 -47
  62. data/locale/en.flie.yml +0 -29
  63. data/locale/en.ino.yml +0 -9
  64. data/locale/en.usage.yml +0 -219
  65. data/sys/aos/abot.rb +0 -254
  66. data/sys/aos/amg.rb +0 -184
  67. data/sys/aos/aos.rb +0 -672
  68. data/sys/aos/cor.rb +0 -770
  69. data/sys/aos/data.rb +0 -117
  70. data/sys/aos/db/migrate/1765148774_create_yous.rb +0 -20
  71. data/sys/aos/db/migrate/1765762724_create_ilibs.rb +0 -22
  72. data/sys/aos/db/migrate/1765907766_create_ilogs.rb +0 -18
  73. data/sys/aos/db/migrate/1765933985_create_agodos.rb +0 -22
  74. data/sys/aos/db/migrate/1766203888_create_fpxies.rb +0 -18
  75. data/sys/aos/db.rb +0 -105
  76. data/sys/aos/flie.rb +0 -144
  77. data/sys/aos/models/agodo.rb +0 -103
  78. data/sys/aos/models/fpxy.rb +0 -26
  79. data/sys/aos/models/ilib.rb +0 -46
  80. data/sys/aos/models/ilog.rb +0 -27
  81. data/sys/aos/models/you.rb +0 -138
  82. data/sys/aos/s.rb +0 -26
  83. data/sys/aos/vws/base.rb +0 -159
  84. data/sys/aos/vws/dom.rb +0 -32
  85. data/sys/aos/vws/games/abot.rb +0 -21
  86. data/sys/aos/vws/games/ino.rb +0 -21
  87. data/sys/aos/vws/games/teck.rb +0 -122
  88. data/sys/aos/vws/games.rb +0 -19
  89. data/sys/aos/vws/home.rb +0 -23
  90. data/sys/aos/vws/know/body.rb +0 -19
  91. data/sys/aos/vws/know/mind.rb +0 -19
  92. data/sys/aos/vws/know/spirit.rb +0 -19
  93. data/sys/aos/vws/know.rb +0 -19
  94. data/sys/aos/vws/root/amg.rb +0 -21
  95. data/sys/aos/vws/root/config.rb +0 -21
  96. data/sys/aos/vws/root/data.rb +0 -21
  97. data/sys/aos/vws/root/flie.rb +0 -21
  98. data/sys/aos/vws/root.rb +0 -19
  99. data/sys/aos/vws/welcome/waite.rb +0 -31
  100. data/sys/aos/vws/welcome/winner.rb +0 -19
  101. data/sys/aos/vws/welcome.rb +0 -66
  102. data/sys/aro/db/migrate/1763374647_create_tecks.rb +0 -20
  103. data/sys/aro/db/migrate/1763432541_create_tlogs.rb +0 -20
  104. data/sys/aro/db/migrate/1768856981_create_scrolls.rb +0 -20
  105. data/sys/aro/db/migrate/1768858841_create_legends.rb +0 -16
  106. data/sys/aro/db/migrate/1768858967_create_stories.rb +0 -17
  107. data/sys/aro/db/migrate/1768859060_create_chapters.rb +0 -15
  108. data/sys/aro/db/migrate/1768859126_create_statements.rb +0 -22
  109. data/sys/aro/db/migrate/1768859144_create_players.rb +0 -18
  110. data/sys/aro/ino.rb +0 -64
  111. data/sys/aro/models/chapter.rb +0 -18
  112. data/sys/aro/models/legend.rb +0 -28
  113. data/sys/aro/models/player.rb +0 -17
  114. data/sys/aro/models/scroll.rb +0 -46
  115. data/sys/aro/models/statement.rb +0 -14
  116. data/sys/aro/models/story.rb +0 -28
  117. data/sys/aro/models/teck.rb +0 -260
  118. data/sys/aro/models/tlog.rb +0 -21
  119. data/sys/cli/constants.rb +0 -50
  120. data/sys/cli/create.rb +0 -23
  121. data/sys/cli/dom.rb +0 -43
  122. data/sys/cli/nterface.rb +0 -37
  123. data/sys/cli/teck.rb +0 -108
  124. data/sys/cli/usage.rb +0 -29
  125. data/sys/cli.rb +0 -24
  126. data/sys/dom/d.rb +0 -138
  127. data/sys/dom/dom.rb +0 -215
  128. data/sys/dom/p.rb +0 -17
  129. data/sys/fpx.rb +0 -104
  130. data/sys/shr/ilib/crs/CMakeLists.txt +0 -12
  131. data/sys/shr/ilib/crs/compile.sh +0 -5
  132. data/sys/shr/ilib/crs/crs.c +0 -24
  133. data/sys/shr/ilib/crs/crs.o +0 -0
  134. data/sys/shr/ilib/crs/libcrs.so +0 -0
  135. data/sys/shr/t.rb +0 -74
@@ -0,0 +1,331 @@
1
+ # frozen_string_literal: true
2
+
3
+ =begin
4
+
5
+ oss_open_menu.rb
6
+
7
+ aro dom oss_open_menu.
8
+
9
+ by i2097i
10
+
11
+ =end
12
+
13
+ module Aro
14
+ module Dom
15
+ class Oss_OpenMenu
16
+
17
+ EXEC_CLASSES = [
18
+ "Aro::Cor",
19
+ "Aro::Dom::Oss_OpenMenu",
20
+ "Aro::Dom::Ma_ain",
21
+ "Aro::Dom::Git",
22
+ "Aro::Dom::Ssh"
23
+ ]
24
+
25
+ EXEC_METHODS = [
26
+ :open_cor!,
27
+ :open_git!,
28
+ :open_ssh!
29
+ ]
30
+
31
+ def self.boot!
32
+ # soft-load (source vars only) existing .cor
33
+ Aro::P.say("sourcing existing Aro::Cor env...")
34
+ Aro::Cor.instance.source_config
35
+
36
+ # set up oss_om workspace
37
+ Aro::P.say("Aro::Dom::Ma_ain.init!")
38
+ return unless Aro::Dom::Ma_ain.init!
39
+
40
+ # hard-load (source and generate config if needed)
41
+ Aro::P.say("Aro::Cor.instance.load_env!")
42
+ Aro::Cor.instance.load_env!
43
+
44
+ # kick off database
45
+ Aro::P.say("Aro::Db.ensure_connected!")
46
+ Aro::Db.ensure_connected!
47
+
48
+ # reload i18n locale configuration
49
+ Aro::P.say("Reiquire.reload_i18n!")
50
+ Reiquire.reload_i18n!
51
+
52
+ puts TTY::Font.new(:standard).write(
53
+ "f#{Aro::Mancy::ARO_DIRECTORY}",
54
+ letter_spacing: 1
55
+ )
56
+ end
57
+
58
+ def self.domain(git_username = nil)
59
+ if git_username.nil?
60
+ git_username = `git config user.name`&.strip
61
+ raise "invalid git config!" if git_username.nil?
62
+ end
63
+ "#{git_username}@oss_om.#{Aro::Dom::Ma_ain.aro_mancy_name}.local"
64
+ end
65
+
66
+ def self.install!
67
+ begin
68
+ ensure_global_git!
69
+ rescue RuntimeError => e
70
+ Aro::P.say(e)
71
+ return false
72
+ end
73
+ # soft-load (source vars only) existing .cor
74
+ Aro::P.say("sourcing existing Aro::Cor env...")
75
+ Aro::Cor.instance.source_config
76
+
77
+ # set up oss_om workspace
78
+ Aro::P.say("Aro::Dom::Ma_ain.init!")
79
+ Aro::Dom::Ma_ain.init!
80
+
81
+ key_path = Aro::Cor.ivar(:OSS_OM_HOME)
82
+ Aro::Dom::Designer.design_oss_om unless !key_path.nil? && Dir.exist?(key_path)
83
+
84
+ private_key_path = Aro::Dom::Ssh.id_key_path
85
+ required_local_files = [
86
+ ".gitignore",
87
+ ".git/config",
88
+ File.basename(private_key_path),
89
+ File.basename(private_key_path) + :".pub".to_s,
90
+ ]
91
+ missing_required_files = required_local_files.any?{|rlf| !::File.exist?(rlf)}
92
+ return Aro::Dom::Git.log unless missing_required_files
93
+ # run the install program until setup is complete
94
+ # return false to cancel
95
+ while missing_required_files do
96
+ gitconfig_path = ::File.join(key_path, ".git/config")
97
+ Aro::P.say("checking for local .git/config at #{gitconfig_path}")
98
+ if ::File.exist?(gitconfig_path)
99
+ break unless required_local_files.empty?{|rlf| !::File.exist?(rlf)}
100
+
101
+ Aro::P.say("#{self.name} already installed. continuing...")
102
+ return Aro::Dom::Git.log
103
+ else
104
+ Aro::P.say("missing local .git/config!")
105
+ Aro::P.say("setting up local git config...")
106
+
107
+ default_git_email = `git config user.email`.strip
108
+ default_text = default_git_email.nil? ? "" : " (default: #{default_git_email})"
109
+ git_email = Aro::Dom::Designer.get_new_value_from_user(
110
+ "enter git config user.email#{default_text}: ",
111
+ "(enter to use default):"
112
+ )
113
+ git_email = default_git_email if git_email.nil?
114
+ if git_email.nil? || git_email.empty?
115
+ Aro::P.say("missing git email! unable to continue #{self.name}.#{__method__}")
116
+ return false
117
+ end
118
+ Aro::P.say("using #{git_email} for email.")
119
+
120
+ default_git_username = (`git config user.email`.strip || git_email).split("@")[0]
121
+ git_username = Aro::Dom::Designer.get_new_value_from_user(
122
+ "enter git config user.name (default is #{default_git_username}): ",
123
+ "(enter to use default):"
124
+ )
125
+ git_username ||= default_git_username
126
+ if git_username.nil? || git_username.empty?
127
+ Aro::P.say("missing git username! unable to continue #{self.name}.#{__method__}")
128
+ return false
129
+ end
130
+ Aro::P.say("using #{git_username} for username.")
131
+
132
+ unless ::File.exist?(private_key_path)
133
+ key_domain = domain(git_username)
134
+
135
+ Aro::P.say("generating new ssh key in #{key_path} using domain #{key_domain}")
136
+ Aro::P.say("ssh-keygen -t RSA -f #{private_key_path} -b #{Aro::Mancy::NUMERALS[:MMXCVII] * 2} -C #{key_domain}")
137
+ keygen_result = `ssh-keygen -t RSA -f #{private_key_path} -b #{Aro::Mancy::NUMERALS[:MMXCVII] * 2} -C "#{key_domain}"`
138
+ Aro::P.say("ssh-keygen result: #{keygen_result}")
139
+ unless ::File.exist?(private_key_path)
140
+ Aro::P.say("oss_om ssh-keygen failed! unable to continue #{self.name}.#{__method__}")
141
+ return false
142
+ end
143
+ system("chmod 700 #{private_key_path}")
144
+ Aro::P.say("#{self.name} uses the project .gitignore to ensure privacy.")
145
+ Aro::P.say("write .gitignore!")
146
+ File.open(".gitignore", "w+") do |f|
147
+ f.write([
148
+ "#",
149
+ "#",
150
+ "# auto-generated by #{self.name} > #{key_domain} on #{Time.now}",
151
+ "#",
152
+ "# ignore oss_om private key!",
153
+ File.basename(private_key_path),
154
+ "#",
155
+ "# ignore entire '.oss_om/' directory!",
156
+ "#{Aro::Dom::Ma_ain::ARO_DIRECTORY.to_s}/*",
157
+ "#",
158
+ "#"
159
+ ].join("\n"))
160
+ f.write("\n")
161
+ end
162
+ end
163
+
164
+ Aro::P.say("system(git init)")
165
+ system(:"git init".to_s)
166
+
167
+ ensure_git_hooks_installed!
168
+
169
+ default_config = {
170
+ user_email: git_email,
171
+ user_name: git_username,
172
+ init_defaultBranch: :foss_om,
173
+ user_signingkey: "#{private_key_path}.pub",
174
+ gpg_format: :ssh,
175
+ commit_gpgsign: true,
176
+ core_editor: :nano
177
+ }.each{|k, v|
178
+ Aro::P.say("system(git config #{k.to_s.gsub("_", ".")} #{v})")
179
+ system(:"git config #{k.to_s.gsub("_", ".")} #{v}".to_s)
180
+ }
181
+ end
182
+
183
+ Aro::P.say("system(git checkout -b #{default_config[:init_defaultBranch]})")
184
+ system(:"git checkout -b #{default_config[:init_defaultBranch]}".to_s)
185
+ Aro::P.say("system(git branch -D main")
186
+ system(:"git branch -D main".to_s)
187
+ Aro::P.say("system(git add .)")
188
+ system(:"git add .".to_s)
189
+ Aro::P.say("system(git commit -m '#{key_domain} initial commit'")
190
+ system(:"git commit -m \"#{key_domain} initial commit\"".to_s)
191
+
192
+ Aro::P.say("#{self.name} installed successfully.")
193
+ end
194
+
195
+ return Aro::Dom::Git.log
196
+ end
197
+
198
+ def self.create_exec_oss_om_entry_for(menu_item)
199
+ # todo: this is a placeholder
200
+ # remove when is_encrypted complete
201
+ allow_exec_unsecure_oss_om_entries = true
202
+
203
+ unless allow_exec_unsecure_oss_om_entries || Aro::Dom::Ma_ain.is_encrypted?
204
+ Aro::P.say(__method__)
205
+ Aro::P.say("redirecting to settings until Aro::Dom::Ma_ain.is_encrypted!")
206
+ Aro::Dom::Ma_ain.exec_settings!
207
+ return
208
+ end
209
+
210
+ const_options = [
211
+ {name: :back, value: :back}
212
+ ] + EXEC_CLASSES.map{|exec_class_name|
213
+ {name: exec_class_name, value: exec_class_name}
214
+ }
215
+
216
+ selected_const_name = Aro::P.default_select(
217
+ I18n.t("open_menu.select_exec_oss_om_const"),
218
+ const_options
219
+ )
220
+
221
+ return if selected_const_name == :back
222
+ Aro::P.say("'#{selected_const_name}' selected")
223
+
224
+ selected_const = selected_const_name.constantize
225
+ raise "invalid const! #{selected_const}" unless EXEC_CLASSES.include?(selected_const.name)
226
+
227
+ method_options = [{name: :back, value: :back}] +
228
+ selected_const.methods.select{|m|
229
+ selected_const::EXEC_METHODS.include?(m)
230
+ }.map{|m|
231
+ {name: m, value: m}
232
+ }
233
+
234
+ selected_method_name = Aro::P.default_select(
235
+ I18n.t("open_menu.select_exec_oss_om_method", class: selected_const_name),
236
+ method_options
237
+ )
238
+
239
+ return if selected_method_name == :back
240
+ Aro::P.say("oss_om_method '#{selected_method_name}' selected")
241
+
242
+ menu_item.store.save_exec_oss_om_params!(
243
+ selected_const_name.constantize,
244
+ selected_method_name,
245
+ menu_item.localized_name
246
+ )
247
+ end
248
+
249
+ def self.create_exec_system_entry_for(menu_item)
250
+ unless Aro::Dom::Ma_ain.is_encrypted?
251
+ Aro::P.say(__method__)
252
+ Aro::P.say("redirecting to settings until Aro::Dom::Ma_ain.is_encrypted!")
253
+ Aro::Dom::Ma_ain.exec_settings!
254
+ return
255
+ end
256
+
257
+ puts __method__
258
+ puts self.name
259
+ Aro::Dom::Ma_ain.i2097i_bookmark
260
+ end
261
+
262
+ def self.create_exec_data_base_entry_for(menu_item)
263
+ unless Aro::Dom::Ma_ain.is_encrypted?
264
+ Aro::P.say(__method__)
265
+ Aro::P.say("redirecting to settings until Aro::Dom::Ma_ain.is_encrypted!")
266
+ Aro::Dom::Ma_ain.exec_settings!
267
+ return
268
+ end
269
+
270
+ puts __method__
271
+ puts self.name
272
+ Aro::Dom::Ma_ain.i2097i_bookmark
273
+ end
274
+
275
+ def self.open_git!
276
+ Aro::Dom::Git.open!
277
+ end
278
+
279
+ def self.open_ssh!
280
+ Aro::Dom::Ssh.open!
281
+ end
282
+
283
+ def self.open_cor!
284
+ Aro::Cor.open!
285
+ end
286
+
287
+ private
288
+
289
+ def self.ensure_global_git!
290
+ raise "git not installed!" unless Aro::Mancy::O == system(:"which -s git".to_s).to_s.strip.to_i
291
+ raise "git not configured!" unless system(:"git config user.name".to_s) || false
292
+ end
293
+
294
+ def self.ensure_git_hooks_installed!
295
+ raise "git not initialized!" unless Dir.exist?(".git")
296
+ pre_commit_hook_path = ::File.join(
297
+ Aro::Cor.ivar(:OSS_OM_HOME),
298
+ ".git/hooks/pre-commit"
299
+ )
300
+
301
+ Aro::Dom::Ma_ain.i2097i_bookmark
302
+ puts "todo: ensure pre-commit file matches current generated content"
303
+ pre_commit_validation_allow_invalid = true
304
+ pre_commit_hook_valid = ::File.exist?(pre_commit_hook_path) && pre_commit_validation_allow_invalid
305
+ return true if pre_commit_hook_valid
306
+ Aro::P.say("warning: pre_commit_validation_allow_invalid is set to #{pre_commit_validation_allow_invalid}!")
307
+
308
+ File.open(pre_commit_hook_path, "w+") do |f|
309
+ f.write([
310
+ "#",
311
+ "#",
312
+ "# auto-generated by #{self.name} > #{self.domain} on #{Time.now}",
313
+ "#",
314
+ "# #{self.name} pre-commit git hook.",
315
+ "#",
316
+ "# validate .gitignore",
317
+ "# tar oss_om using id_oss_om keypair",
318
+ "echo '#{self.name} pre-commit hook running'",
319
+ "echo 'todo:'",
320
+ "echo 'initialize tar_oss_om.tar.gz'",
321
+ ].join("\n"))
322
+ f.write("\n")
323
+ end
324
+ Aro::P.say("system(chmod +x #{pre_commit_hook_path}")
325
+ system("chmod +x #{pre_commit_hook_path}")
326
+ Aro::P.say("git hook installed successfully.")
327
+ end
328
+
329
+ end
330
+ end
331
+ end
data/sys/aro/p.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  =begin
2
4
 
3
5
  p.rb
@@ -9,17 +11,24 @@
9
11
  =end
10
12
 
11
13
  require_relative :"../shr/prompt".to_s
12
- require_relative :"./r".to_s
13
14
 
14
15
  module Aro
15
16
  class P < Aro::Prompt
17
+
16
18
  def self.say(message)
17
- if Aro::Mancy.in_aro? && !Aro::T.is_dev_tarot?
18
- Aro::R.say(message)
19
- else
20
- super(["#{Aro::Mancy::PS1}#{message}"])
21
- end
19
+ super("#{Aro::Dom::Ma_ain.ps1_display || Aro::Mancy.ps1_display}#{normalize_message(message)}")
22
20
  end
21
+
22
+ def self.default_select(display_text, options)
23
+ Aro::P.p.select(
24
+ Aro::Dom::Ma_ain.mini_hud_for(display_text),
25
+ options,
26
+ show_help: :always,
27
+ cycle: true,
28
+ per_page: 11
29
+ )
30
+ end
31
+
23
32
  end
24
33
  end
25
34
 
data/sys/aro/r.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  =begin
2
4
 
3
5
  r.rb
@@ -12,9 +14,8 @@ require_relative :"../shr/prompt".to_s
12
14
 
13
15
  module Aro
14
16
  class R < Aro::Prompt
15
- PS1 = :">[#{Aro::T::RUBY_FACOT}]>:"
16
17
  def self.say(message)
17
- super(["#{Aro::R::PS1} #{message}"])
18
+ super("#{Aro::Mancy.ps1_display(Aro::R.name)} #{normalize_message(message)}")
18
19
  end
19
20
  end
20
21
  end