aro 0.2.1 → 0.2.2

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/aro +3 -3
  4. data/checksums/aro-0.2.1.gem.sha512 +1 -0
  5. data/checksums/aro-0.2.2.gem.sha512 +1 -0
  6. data/locale/en.amg.yml +44 -0
  7. data/locale/en.aos.yml +4 -38
  8. data/locale/en.data.yml +30 -0
  9. data/locale/en.dom.yml +8 -6
  10. data/locale/en.usage.yml +20 -20
  11. data/locale/en.yml +16 -12
  12. data/sys/aos/amg.rb +58 -56
  13. data/sys/aos/aos.rb +82 -49
  14. data/sys/aos/data.rb +117 -0
  15. data/sys/aos/db/migrate/1765148774_create_yous.rb +1 -0
  16. data/sys/aos/db/migrate/{1765762724_create_libs.rb → 1765762724_create_ilibs.rb} +5 -5
  17. data/sys/aos/db/migrate/1765907766_create_ilogs.rb +18 -0
  18. data/sys/aos/db.rb +37 -17
  19. data/sys/{shr/lib/lib.rb → aos/models/ilib.rb} +9 -6
  20. data/sys/aos/models/ilog.rb +27 -0
  21. data/sys/aos/models/you.rb +50 -0
  22. data/sys/aos/vws/base.rb +9 -58
  23. data/sys/aos/vws/dom.rb +0 -1
  24. data/sys/aos/vws/games/game.rb +10 -10
  25. data/sys/aos/vws/know/{temple.rb → body.rb} +3 -3
  26. data/sys/aos/vws/know/{library.rb → mind.rb} +3 -3
  27. data/sys/aos/vws/know/spirit.rb +19 -0
  28. data/sys/aos/vws/{setup → root}/amg.rb +1 -2
  29. data/sys/aos/vws/{setup → root}/config.rb +1 -1
  30. data/sys/aos/vws/root/data.rb +21 -0
  31. data/sys/aos/vws/{setup.rb → root.rb} +3 -3
  32. data/sys/aos/vws/welcome/waite.rb +1 -0
  33. data/sys/aos/vws/welcome.rb +11 -0
  34. data/sys/aro/db/migrate/{1763374647_create_decks.rb → 1763374647_create_tecks.rb} +5 -5
  35. data/sys/aro/db/migrate/1763432541_create_tlogs.rb +20 -0
  36. data/sys/aro/db.rb +11 -11
  37. data/sys/aro/mancy.rb +4 -4
  38. data/sys/{models/deck.rb → aro/models/teck.rb} +51 -52
  39. data/sys/aro/models/tlog.rb +20 -0
  40. data/sys/cli/constants.rb +1 -1
  41. data/sys/cli/dom.rb +1 -1
  42. data/sys/cli/{deck.rb → teck.rb} +15 -15
  43. data/sys/cli.rb +4 -3
  44. data/sys/dom/config.rb +196 -143
  45. data/sys/dom/d.rb +32 -19
  46. data/sys/dom/dom.rb +22 -13
  47. data/sys/reiquire.rb +6 -7
  48. data/sys/shr/prompt.rb +0 -4
  49. data/sys/shr/version.rb +1 -1
  50. metadata +28 -20
  51. data/locale/en.cngelog.yml +0 -5
  52. data/sys/aos/you.rb +0 -21
  53. data/sys/aro/db/migrate/1763432541_create_logs.rb +0 -20
  54. data/sys/models/log.rb +0 -20
  55. /data/sys/shr/{lib → ilib}/crs/CMakeLists.txt +0 -0
  56. /data/sys/shr/{lib → ilib}/crs/compile.sh +0 -0
  57. /data/sys/shr/{lib → ilib}/crs/crs.c +0 -0
  58. /data/sys/shr/{lib → ilib}/crs/crs.o +0 -0
  59. /data/sys/shr/{lib → ilib}/crs/libcrs.so +0 -0
data/sys/dom/config.rb CHANGED
@@ -12,6 +12,7 @@ module Aro
12
12
 
13
13
  # cli entrypoint
14
14
  def self.config
15
+ Aro::Config.instance.load
15
16
  Aro::Config.process_config_command(ARGV)
16
17
  end
17
18
 
@@ -20,8 +21,8 @@ module Aro
20
21
 
21
22
  attr_accessor :config_path, :display_lines
22
23
 
23
- ARO_CONFIG_PREFIX = :ARO_CONFIG_
24
- ARO_ENV_PREFIX = :ARO_ENV_
24
+ ARO_IVA_PREFIX = :ARO_IVA_
25
+ ARO_OVA_PREFIX = :ARO_OVA_
25
26
 
26
27
  CONFIG_FILE = :".config"
27
28
 
@@ -46,6 +47,15 @@ module Aro
46
47
  JSON: :json,
47
48
  }
48
49
 
50
+ # possible interfaces
51
+ #
52
+ # example usage:
53
+ # Aro::Config::INTERFACES[:TERMINAL]
54
+ INTERFACES = {
55
+ TERMINAL: :terminal,
56
+ LANIMRET: :lanimret,
57
+ }
58
+
49
59
  # possible dimensions
50
60
  #
51
61
  # example usage:
@@ -97,7 +107,7 @@ module Aro
97
107
  }
98
108
  },
99
109
  INT: {
100
- name: :int,
110
+ name: Aro::Config::TYPES[:INT],
101
111
  description: I18n.t("cli.config.type.int_description"),
102
112
  converter: Proc.new{|v| v.to_i},
103
113
  validator: Proc.new{|unvalid, k, v|
@@ -113,7 +123,7 @@ module Aro
113
123
  }
114
124
  },
115
125
  STRING: {
116
- name: :string,
126
+ name: Aro::Config::TYPES[:STRING],
117
127
  description: I18n.t("cli.config.type.string_description"),
118
128
  converter: Proc.new{|v| v.to_s},
119
129
  validator: Proc.new{|unvalid, k, v|
@@ -122,7 +132,7 @@ module Aro
122
132
  }
123
133
  },
124
134
  VALUES: {
125
- name: :values,
135
+ name: Aro::Config::TYPES[:VALUES],
126
136
  description: I18n.t("cli.config.type.values_description"),
127
137
  converter: Proc.new{|v| v.to_s},
128
138
  validator: Proc.new{|unvalid, k, v|
@@ -181,7 +191,7 @@ module Aro
181
191
  end
182
192
 
183
193
  # adapts I18n translations to generate bash environment vars.
184
- #
194
+ #
185
195
  # example usage:
186
196
  # Aro::Config::DEF[:Z_MAX]
187
197
  DEF = {
@@ -218,7 +228,7 @@ module Aro
218
228
  value: Aro::Config::BOOLS[:FALSE],
219
229
  description: I18n.t("cli.config.log_aro_db_description"),
220
230
  },
221
- FORMAT: { # not implemented yet.
231
+ FORMAT: {
222
232
  type: Aro::Config::TYPES[:VALUES],
223
233
  implemented: false,
224
234
  access: Aro::Config::DEF_ACCESS[:WRITE],
@@ -229,6 +239,17 @@ module Aro
229
239
  json: I18n.t("cli.config.format.json_description")
230
240
  }
231
241
  },
242
+ INTERFACE: {
243
+ type: Aro::Config::TYPES[:VALUES],
244
+ implemented: false,
245
+ access: Aro::Config::DEF_ACCESS[:WRITE],
246
+ value: Aro::Config::INTERFACES[:TERMINAL],
247
+ description: I18n.t("cli.config.interface.description"),
248
+ possible_values: {
249
+ terminal: I18n.t("cli.config.interface.terminal_description"),
250
+ lanimret: I18n.t("cli.config.interface.lanimret_description")
251
+ }
252
+ },
232
253
  DIMENSION: {
233
254
  type: Aro::Config::TYPES[:VALUES],
234
255
  access: Aro::Config::DEF_ACCESS[:WRITE],
@@ -291,61 +312,61 @@ module Aro
291
312
  #
292
313
  # => ovars
293
314
  #
294
- ARO_ENV_O: {
315
+ O: {
295
316
  type: Aro::Config::TYPES[:INT],
296
317
  access: Aro::Config::DEF_ACCESS[:READ],
297
318
  value: Aro::Mancy::O,
298
319
  description: I18n.t("cli.config.aro_env.O_description"),
299
320
  },
300
- ARO_ENV_S: {
321
+ S: {
301
322
  type: Aro::Config::TYPES[:INT],
302
323
  access: Aro::Config::DEF_ACCESS[:READ],
303
324
  value: Aro::Mancy::S,
304
325
  description: I18n.t("cli.config.aro_env.S_description"),
305
326
  },
306
- ARO_ENV_OS: {
327
+ OS: {
307
328
  type: Aro::Config::TYPES[:INT],
308
329
  access: Aro::Config::DEF_ACCESS[:READ],
309
330
  value: Aro::Mancy::OS,
310
331
  description: I18n.t("cli.config.aro_env.OS_description"),
311
332
  },
312
- ARO_ENV_E: {
333
+ E: {
313
334
  type: Aro::Config::TYPES[:INT],
314
335
  access: Aro::Config::DEF_ACCESS[:READ],
315
336
  value: Aro::Mancy::E,
316
337
  description: I18n.t("cli.config.aro_env.E_description"),
317
338
  },
318
- ARO_ENV_N: {
339
+ N: {
319
340
  type: Aro::Config::TYPES[:INT],
320
341
  access: Aro::Config::DEF_ACCESS[:READ],
321
342
  value: Aro::Mancy::N,
322
343
  description: I18n.t("cli.config.aro_env.N_description"),
323
344
  },
324
- ARO_ENV_PS1: {
345
+ PS1: {
325
346
  type: Aro::Config::TYPES[:STRING],
326
347
  access: Aro::Config::DEF_ACCESS[:READ],
327
348
  value: Aro::Mancy::PS1,
328
349
  description: I18n.t("cli.config.aro_env.PS1_description"),
329
350
  },
330
- ARO_ENV_NAME_FILE: {
351
+ NAME_FILE: {
331
352
  type: Aro::Config::TYPES[:STRING],
332
353
  access: Aro::Config::DEF_ACCESS[:READ],
333
354
  value: Aro::Mancy::NAME_FILE,
334
355
  description: I18n.t("cli.config.aro_env.NAME_FILE_description"),
335
356
  },
336
- ARO_ENV_I2097I: {
357
+ I2097I: {
337
358
  type: Aro::Config::TYPES[:STRING],
338
359
  access: Aro::Config::DEF_ACCESS[:READ],
339
360
  value: Aro::Mancy::I2097I,
340
361
  description: I18n.t("cli.config.aro_env.I2097I_description"),
341
362
  },
342
- ARO_ENV_YES: {
363
+ YES: {
343
364
  type: Aro::Config::TYPES[:STRING],
344
365
  access: Aro::Config::DEF_ACCESS[:READ],
345
366
  value: Aro::Mancy::YES,
346
367
  description: I18n.t("cli.config.aro_env.YES_description"),
347
368
  },
348
- ARO_ENV_ALL: {
369
+ ALL: {
349
370
  type: Aro::Config::TYPES[:STRING],
350
371
  access: Aro::Config::DEF_ACCESS[:READ],
351
372
  value: Aro::Mancy::ALL,
@@ -354,6 +375,13 @@ module Aro
354
375
  }
355
376
 
356
377
  def load
378
+ self.config_path = ""
379
+ if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
380
+ self.config_path = Aro::Config.aro_config_path
381
+ elsif Aro::Dom.in_arodom?
382
+ self.config_path = Aro::Config.dom_config_path
383
+ end
384
+
357
385
  unless File.exist?(Aro::Config.config_filepath)
358
386
  generate_config
359
387
  end
@@ -374,17 +402,20 @@ module Aro
374
402
  # print config commands
375
403
  lines << ""
376
404
  lines << I18n.t("aos.constants.commands")
405
+ lines << ""
377
406
  lines += Aos::Vw::Base.lines_for_cmd(Aos::Os::CMDS[:CONFIG])
378
407
  lines
379
408
  end
380
409
 
381
- def self.config_filepath
382
- if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
383
- self.instance.config_path = File.join(Dir.pwd, Aro::Db.base_aro_dir)
384
- elsif Aro::Dom.in_arodom? && Aro::Dom.is_initialized?
385
- self.instance.config_path = File.join(Aro::Dom::dom_root, Aro::Dom.room_path(:config))
386
- end
410
+ def self.aro_config_path
411
+ File.join(Dir.pwd, Aro::Db.base_aro_dir)
412
+ end
387
413
 
414
+ def self.dom_config_path
415
+ File.join(Aro::Dom::dom_root, Aro::Dom.room_path(:config))
416
+ end
417
+
418
+ def self.config_filepath
388
419
  File.join(
389
420
  self.instance.config_path,
390
421
  Aro::Config::CONFIG_FILE.to_s
@@ -412,8 +443,21 @@ module Aro
412
443
  end
413
444
 
414
445
  def self.process_config_command(args)
415
- if [args[2],args[3]].compact.any? && args[1] == Aos::Os::CMDS[:CONFIG][:cmds][:SET][:key].to_s
416
- Aro::Config.set_ivar(args[2], args[3])
446
+ k = Aro::Config::DEF.keys.filter{|k| k == args[Aro::Mancy::S]&.upcase&.to_sym}&.first
447
+ unless k.nil?
448
+ unless args[Aro::Mancy::OS].nil?
449
+ # config <var_name> <var_value>
450
+ Aro::Config.set_ivar(args[Aro::Mancy::S], args[Aro::Mancy::OS])
451
+ end
452
+
453
+ # basic show var description and value
454
+ self.instance.display_lines = self.instance.lines_var(k, Aro::Config::DEF[k], ENV[Aro::Config.ivar_k(k)])
455
+ else
456
+ self.instance.display_lines = Aro::Config.base_lines
457
+ end
458
+
459
+ if Aro::Mancy.in_aro? && !Aro::Dom.in_arodom?
460
+ Aro::P.say(self.instance.display_lines.join("\n"))
417
461
  end
418
462
  end
419
463
 
@@ -423,7 +467,7 @@ module Aro
423
467
  end
424
468
  # out vars
425
469
  def self.ovar_k(suffix)
426
- "#{Aro::Config::ARO_ENV_PREFIX}#{suffix}"
470
+ "#{Aro::Config::ARO_OVA_PREFIX}#{suffix}"
427
471
  end
428
472
 
429
473
  # in vars
@@ -432,7 +476,7 @@ module Aro
432
476
  end
433
477
  # in vars
434
478
  def self.ivar_k(suffix)
435
- "#{Aro::Config::ARO_CONFIG_PREFIX}#{suffix}"
479
+ "#{Aro::Config::ARO_IVA_PREFIX}#{suffix}"
436
480
  end
437
481
 
438
482
  def self.set_ivar(k, new_value)
@@ -464,21 +508,21 @@ module Aro
464
508
 
465
509
  def setup_env
466
510
  # do not change - update $ARO_CONFIG_ENV .aro/.config file
467
- #
511
+ #
468
512
  # default is production
469
513
  varenv = Aro::Config.ivar(:ENV)
470
514
  is_valid = valid_var?(varenv, :ENV, Aro::Config::DEF[:ENV])
471
515
  ENV[:ARO_ENV.to_s] = is_valid ? varenv : Aro::Config::ENVS[:PRODUCTION].to_s
472
- Aro::D.say("setup_env: #{ENV[:ARO_ENV.to_s]}")
516
+ Aro::D.say("running in #{ENV[:ARO_ENV.to_s]} env.")
473
517
  end
474
518
 
475
519
  def self.dump_config
476
520
  dump = []
477
521
  Aro::Config::DEF.each{|k, v|
478
522
  if v[:access] == Aro::Config::DEF_ACCESS[:WRITE]
479
- dump << "$#{Aro::Config.ivar_k(k).ljust(Aro::Mancy::NUMERALS[:XIV] * Aro::Mancy::OS)}=#{Aro::Config.ivar(k)}"
523
+ dump << "#{Aro::Config.ivar_k(k).ljust(Aro::Mancy::NUMERALS[:XIV] * Aro::Mancy::OS)}=#{Aro::Config.ivar(k)}"
480
524
  else
481
- dump << "$#{Aro::Config.ovar_k(k).ljust(Aro::Mancy::NUMERALS[:XIV] * Aro::Mancy::OS)}=#{Aro::Config.ovar(k)}"
525
+ dump << "#{Aro::Config.ovar_k(k).ljust(Aro::Mancy::NUMERALS[:XIV] * Aro::Mancy::OS)}=#{Aro::Config.ovar(k)}"
482
526
  end
483
527
  }
484
528
 
@@ -488,15 +532,15 @@ module Aro
488
532
  def source_config
489
533
  Aro::D.say(I18n.t("cli.config.source", name: Aro::Config.config_filepath))
490
534
  File.read(Aro::Config.config_filepath).split("\n").select{|line|
491
- line.match?(/export #{Aro::Config::ARO_CONFIG_PREFIX}/)
492
- }.map{|line|
535
+ line.match?(/export #{Aro::Config::ARO_IVA_PREFIX}/)
536
+ }.map{|line|
493
537
  line.gsub("export ", "").split("=")
494
538
  }.each{|kv|
495
539
  Aro::V.say("variable to set: #{kv}")
496
540
  ENV[kv[0]] = kv[1] # source
497
541
  Aro::V.say("value actually set: #{ENV[kv[0]]}")
498
542
  }
499
-
543
+
500
544
  # todo: implement
501
545
  invalid_defs = validate_config
502
546
  Aro::Config.dump_config.each{|l| Aro::V.say(l)}
@@ -510,155 +554,164 @@ module Aro
510
554
  }
511
555
  end
512
556
 
557
+ # from_memory true means write current config to file
513
558
  def generate_config(from_memory = false)
514
559
  # todo: localize generated config text
515
560
  Aro::D.say(I18n.t("cli.config.generate", name: Aro::Config.config_filepath))
516
- File.open(Aro::Config.config_filepath, "w+") do |file|
517
- # intro
518
- Aro::Mancy::OS.times do
519
- print_div file.object_id
520
- end
521
- # header
522
- print_div file.object_id
523
- print_sr file.object_id
524
- print_config_header file.object_id
525
- print_sr file.object_id
526
- print_div file.object_id
527
-
528
- print_osr file.object_id
529
-
530
- # def_types
531
- print_div file.object_id
532
- print_sr file.object_id
533
- print_def_types file.object_id
534
- print_sr file.object_id
535
- print_div file.object_id
536
-
537
- print_osr file.object_id
538
-
539
- # var section
540
- print_div file.object_id
541
- print_sr file.object_id
542
- print_var_section file.object_id
543
- print_sr file.object_id
544
- print_div file.object_id
545
-
546
- print_osr file.object_id
547
-
548
- # vars
549
- Aro::Config::DEF.each{|k, v|
550
- print_var file.object_id, k, v, (from_memory ? ENV[Aro::Config.ivar_k(k)] : nil)
551
- }
552
561
 
553
- print_osr file.object_id
554
-
555
- # var section
556
- print_div file.object_id
557
- print_sr file.object_id
558
- print_var_section file.object_id
559
- print_sr file.object_id
560
- print_div file.object_id
561
-
562
- print_osr file.object_id
563
- # outro
564
- Aro::Mancy::OS.times do
565
- print_div file.object_id
566
- end
562
+ lines = []
563
+
564
+ # intro
565
+ Aro::Mancy::OS.times do
566
+ lines += lines_div
567
+ end
568
+
569
+ # header
570
+ lines += lines_div
571
+ lines += lines_newline_comment
572
+ lines += lines_config_header
573
+ lines += lines_newline_comment
574
+ lines += lines_div
575
+
576
+ lines += lines_newline_comment_os
577
+
578
+ # def_types
579
+ lines += lines_div
580
+ lines += lines_newline_comment
581
+ lines += lines_def_type_description
582
+ lines += lines_newline_comment
583
+ lines += lines_div
584
+
585
+ lines += lines_newline_comment_os
586
+
587
+ # var section
588
+ lines += lines_div
589
+ lines += lines_newline_comment
590
+ lines += lines_var_section_div
591
+ lines += lines_newline_comment
592
+ lines += lines_div
593
+
594
+ lines += lines_newline_comment_os
595
+
596
+ # vars
597
+ Aro::Config::DEF.each{|k, v|
598
+ lines += lines_var(k, v, (from_memory ? ENV[Aro::Config.ivar_k(k)] : nil))
599
+ }
600
+
601
+ lines += lines_newline_comment_os
602
+
603
+ # var section
604
+ lines += lines_div
605
+ lines += lines_newline_comment
606
+ lines += lines_var_section_div
607
+ lines += lines_newline_comment
608
+ lines += lines_div
609
+
610
+ lines += lines_newline_comment_os
611
+ # outro
612
+ Aro::Mancy::OS.times do
613
+ lines += lines_div
614
+ end
615
+ write_config(lines)
616
+ end
617
+
618
+ def write_config(lines)
619
+ File.open(Aro::Config.config_filepath, "w+") do |file|
620
+ file.write(lines.join("\n"))
567
621
  file.write("\n")
568
622
  end
569
623
  end
570
624
 
571
- def print_div f_object_id
572
- file = ObjectSpace._id2ref f_object_id
573
- file.write("#{"#" * Aro::Mancy::NUMERALS[:VIII].pow(2)}\n")
625
+ def lines_div
626
+ ["#" * Aro::Mancy::NUMERALS[:VIII].pow(Aro::Mancy::OS)]
574
627
  end
575
628
 
576
- def print_sr f_object_id
577
- file = ObjectSpace._id2ref f_object_id
578
- Aro::Mancy::S.times do
579
- file.write("#\n")
580
- end
629
+ def lines_newline_comment
630
+ ["#"]
581
631
  end
582
632
 
583
- def print_osr f_object_id
633
+ def lines_newline_comment_os
634
+ lines = []
584
635
  Aro::Mancy::OS.times do
585
- print_sr f_object_id
636
+ lines += lines_newline_comment
586
637
  end
638
+ lines
587
639
  end
588
640
 
589
- def print_config_header f_object_id
590
- file = ObjectSpace._id2ref f_object_id
591
- file.write("# #{Aro::Mancy::PS1} configuration file.\n")
592
- file.write("# this file was auto generated by the aro cli.\n")
641
+ def lines_config_header
642
+ [
643
+ "# #{Aro::Mancy::PS1} configuration file.",
644
+ "# this file was auto generated by the aro cli."
645
+ ]
593
646
  end
594
647
 
595
- def print_var_section f_object_id
596
- file = ObjectSpace._id2ref f_object_id
597
- file.write("# VARIABLE SECTION!\n")
648
+ def lines_var_section_div
649
+ ["# VARIABLE SECTION!"]
598
650
  end
599
651
 
600
- def print_def_types f_object_id
601
- file = ObjectSpace._id2ref f_object_id
602
- file.write("# Aro::Config::DEF_TYPES\n")
603
- file.write("# describes the possible types of variables.\n")
652
+ def lines_def_type_description
653
+ lines = []
654
+ lines << "# Aro::Config::DEF_TYPES"
655
+ lines << "# describes the possible types of variables."
604
656
  Aro::Config::DEF_TYPES.each{|k, v|
605
- file.write("# #{k}: #{v[:description]}\n")
657
+ lines << "# #{k}: #{v[:description]}"
606
658
  }
607
- print_osr f_object_id
608
- file.write("# Aro::Config::DEF\n")
609
- file.write("# define & expose an aro bash api via ENV variables.\n")
610
- file.write("# there are two types of bash vars in aro.\n")
611
- file.write("# 1) in vars (ivars). \n")
612
- file.write("# => ivars enter aro from this file during aro init.\n")
613
- file.write("# => aro validates them and uses them unless unvalid.\n")
614
- file.write("# => otherwise aro will use the defaults listed below.\n")
615
- file.write("# 2) out vars (ovars).\n")
616
- file.write("# => ovars are read-only vars that aro exposes to bash.\n")
617
- file.write("# => this is useful because it provides a bash interface\n")
618
- file.write("# => which can be used to write programs on top of aro.\n")
619
- end
620
-
621
- def print_var f_object_id, k, v, mem_v
622
- file = ObjectSpace._id2ref f_object_id
659
+ lines += lines_newline_comment_os
660
+ lines << "# Aro::Config::DEF"
661
+ lines << "# define & expose an aro bash api via ENV variables."
662
+ lines << "# there are two types of bash vars in aro."
663
+ lines << "# 1) in vars (ivars). "
664
+ lines << "# => ivars enter aro from this file during aro init."
665
+ lines << "# => aro validates them and uses them unless unvalid."
666
+ lines << "# => otherwise aro will use the defaults listed below."
667
+ lines << "# 2) out vars (ovars)."
668
+ lines << "# => ovars are read-only vars that aro exposes to bash."
669
+ lines << "# => this is useful because it provides a bash interface"
670
+ lines << "# => which can be used to write programs on top of aro."
671
+ end
623
672
 
673
+ def lines_var(k, v, mem_v = nil)
674
+ lines = []
624
675
  is_ovar = Aro::Config::DEF[k][:access] == Aro::Config::DEF_ACCESS[:READ]
625
676
  if is_ovar
626
- var_name = k
677
+ var_name = Aro::Config.ovar_k(k)
627
678
  else
628
679
  var_name = Aro::Config.ivar_k(k)
629
680
  end
630
681
  Aro::V.say("access for #{k} is #{Aro::Config::DEF[k][:access]}")
631
682
  Aro::V.say("using var_name: #{var_name}")
632
- file.write("# [#{var_name}] (#{is_ovar ? :ovar : :ivar})\n")
633
- file.write("# => Aro::Config::DEF_TYPES: #{v[:type]}\n")
683
+ lines << "# [#{var_name}] (#{is_ovar ? :ovar : :ivar})"
684
+ lines << "# => Aro::Config::DEF_TYPES: #{v[:type]}"
634
685
  case v[:type]
686
+ when Aro::Config::DEF_TYPES[:BOOL][:name]
687
+ lines << "# => #{I18n.t("cli.config.type.bool_description")}"
635
688
  when Aro::Config::DEF_TYPES[:INT][:name]
636
- file.write("# => #{I18n.t("cli.config.type.int_description")}\n")
637
- file.write("# => #{I18n.t("cli.config.minimum")}: #{v[:min]}\n")
638
- file.write("# => #{I18n.t("cli.config.maximum")}: #{v[:max]}\n")
689
+ lines << "# => #{I18n.t("cli.config.type.int_description")}"
690
+ lines << "# => #{I18n.t("cli.config.minimum")}: #{v[:min]}"
691
+ lines << "# => #{I18n.t("cli.config.maximum")}: #{v[:max]}"
639
692
  when Aro::Config::DEF_TYPES[:STRING][:name]
640
- file.write("# => #{I18n.t("cli.config.type.string_description")}\n")
641
- file.write("# => use \"double quotes\" if there are any spaces.\n")
693
+ lines << "# => #{I18n.t("cli.config.type.string_description")}"
694
+ lines << "# => use \"double quotes\" if there are any spaces."
642
695
  when Aro::Config::DEF_TYPES[:VALUES][:name]
643
- file.write("# => #{I18n.t("cli.config.type.values_description")}\n")
644
- file.write("# => #{I18n.t("cli.config.possible_values")}:\n")
645
- print_sr f_object_id
696
+ lines << "# => #{I18n.t("cli.config.type.values_description")}"
697
+ lines << "# => #{I18n.t("cli.config.possible_values")}:"
698
+ lines += lines_newline_comment
646
699
  v[:possible_values].each{|name, description|
647
- file.write("# => #{name}\n")
648
- print_sr f_object_id
649
- file.write("# =>#{description}\n")
650
- print_sr f_object_id
700
+ lines << "# => #{name}"
701
+ lines += lines_newline_comment
702
+ lines << "# =>#{description}"
703
+ lines += lines_newline_comment
651
704
  }
652
705
  end
653
- print_osr f_object_id
654
- file.write("# => description:\n")
655
- file.write("# => #{v[:description]}\n")
706
+ lines += lines_newline_comment_os
707
+ lines << "# => description:"
708
+ lines << "# => #{v[:description]}"
656
709
  if is_ovar && Aro::Config::DEF_TYPES[:STRING][:name] == v[:type]
657
- file.write("export #{var_name}=\"#{v[:value]}\"\n")
710
+ lines << "export #{var_name}=\"#{v[:value]}\""
658
711
  else
659
- file.write("export #{var_name}=#{mem_v || v[:value]}\n")
712
+ lines << "export #{var_name}=#{mem_v || v[:value]}"
660
713
  end
661
- print_osr f_object_id
714
+ lines += lines_newline_comment_os
662
715
  end
663
716
 
664
717
  end
data/sys/dom/d.rb CHANGED
@@ -9,6 +9,7 @@
9
9
  =end
10
10
 
11
11
  require_relative :dom.to_s
12
+ require_relative :"../shr/prompt".to_s
12
13
 
13
14
  module Aro
14
15
  class Dom::D
@@ -26,6 +27,8 @@ module Aro
26
27
  WINGS = {
27
28
  WELCOME: {
28
29
  WAITE: {
30
+ # todo: make a wai/wait/wae learning tool for practicing
31
+ # command usage in a sandbox.
29
32
  name: Aro::Dom::WAITE,
30
33
  description: I18n.t("dom.rooms.waite.description"),
31
34
  },
@@ -52,24 +55,32 @@ module Aro
52
55
  description: I18n.t("dom.rooms.vipps.description"),
53
56
  },
54
57
  },
55
- KNOW: {
56
- LIBRARY: {
57
- name: Aro::Dom::LIBRARY,
58
- description: I18n.t("dom.rooms.library.description"),
58
+ KNOW: {
59
+ BODY: {
60
+ name: Aro::Dom::BODY,
61
+ description: I18n.t("dom.rooms.body.description"),
62
+ },
63
+ MIND: {
64
+ name: Aro::Dom::MIND,
65
+ description: I18n.t("dom.rooms.mind.description"),
59
66
  },
60
- TEMPLE: {
61
- name: Aro::Dom::TEMPLE,
62
- description: I18n.t("dom.rooms.temple.description"),
67
+ SPIRIT: {
68
+ name: Aro::Dom::SPIRIT,
69
+ description: I18n.t("dom.rooms.spirit.description"),
63
70
  },
64
71
  },
65
- SETUP: {
72
+ ROOT: {
73
+ AMG: {
74
+ name: Aro::Dom::AMG,
75
+ description: I18n.t("dom.rooms.amg.description"),
76
+ },
66
77
  CONFIG: {
67
78
  name: Aro::Dom::CONFIG,
68
79
  description: I18n.t("dom.rooms.config.description"),
69
80
  },
70
- AMG: {
71
- name: Aro::Dom::AMG,
72
- description: I18n.t("dom.rooms.amg.description"),
81
+ DATA: {
82
+ name: Aro::Dom::DATA,
83
+ description: I18n.t("dom.rooms.data.description"),
73
84
  },
74
85
  },
75
86
  }
@@ -98,19 +109,21 @@ module Aro
98
109
  name: Aro::Dom::KNOW,
99
110
  description: I18n.t("dom.wings.know.description"),
100
111
  rooms: [
101
- Aro::Dom::D::WINGS[:KNOW][:LIBRARY],
102
- Aro::Dom::D::WINGS[:KNOW][:TEMPLE],
112
+ Aro::Dom::D::WINGS[:KNOW][:BODY],
113
+ Aro::Dom::D::WINGS[:KNOW][:MIND],
114
+ Aro::Dom::D::WINGS[:KNOW][:SPIRIT],
103
115
  ],
104
116
  },
105
- SETUP: {
106
- name: Aro::Dom::SETUP,
107
- description: I18n.t("dom.wings.setup.description"),
117
+ ROOT: {
118
+ name: Aro::Dom::ROOT,
119
+ description: I18n.t("dom.wings.root.description"),
108
120
  rooms: [
109
- Aro::Dom::D::WINGS[:SETUP][:CONFIG],
110
- Aro::Dom::D::WINGS[:SETUP][:AMG],
121
+ Aro::Dom::D::WINGS[:ROOT][:AMG],
122
+ Aro::Dom::D::WINGS[:ROOT][:CONFIG],
123
+ Aro::Dom::D::WINGS[:ROOT][:DATA],
111
124
  ],
112
125
  }
113
126
  }
114
127
 
115
128
  end
116
- end
129
+ end