aro 0.2.5 → 0.2.6

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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.ruby-version +1 -0
  4. data/Gemfile.lock +106 -89
  5. data/aro.gemspec +10 -11
  6. data/bin/oss_om +15 -0
  7. data/checksums/aro-0.2.5.gem.sha512 +1 -0
  8. data/checksums/aro-0.2.6.gem.sha512 +1 -0
  9. data/locale/en.cards.yml +1 -1
  10. data/locale/en.cmd.yml +34 -0
  11. data/locale/en.cor.yml +5 -8
  12. data/locale/en.menu_items.yml +2 -0
  13. data/locale/en.menus.yml +2 -0
  14. data/locale/en.usage.yml +21 -98
  15. data/locale/en.yml +61 -50
  16. data/sys/aro/cmd.rb +96 -0
  17. data/sys/{aos → aro}/cor.rb +224 -268
  18. data/sys/aro/d.rb +4 -3
  19. data/sys/aro/db/migrate/.DS_Store +0 -0
  20. data/sys/aro/db/migrate/1793913747_create_data_bases.rb +13 -0
  21. data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +14 -0
  22. data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +12 -0
  23. data/sys/aro/db/migrate/1793913841_create_menus.rb +11 -0
  24. data/sys/aro/db/migrate/1793913861_create_menu_items.rb +14 -0
  25. data/sys/aro/db.rb +72 -33
  26. data/sys/aro/designer.rb +281 -0
  27. data/sys/aro/locale.rb +136 -0
  28. data/sys/aro/ma_ain.rb +54 -0
  29. data/sys/aro/mancy.rb +53 -28
  30. data/sys/aro/models/concerns/.keep +0 -0
  31. data/sys/aro/models/concerns/uuid.rb +29 -0
  32. data/sys/aro/models/data_base.rb +97 -0
  33. data/sys/aro/models/directory.rb +44 -0
  34. data/sys/aro/models/file.rb +27 -0
  35. data/sys/aro/models/menu.rb +27 -0
  36. data/sys/aro/models/menu_item.rb +47 -0
  37. data/sys/aro/models/teck.rb +19 -28
  38. data/sys/aro/p.rb +6 -3
  39. data/sys/aro/r.rb +1 -2
  40. data/sys/aro/store.rb +147 -0
  41. data/sys/aro/v.rb +2 -2
  42. data/sys/aro/views/base.rb +25 -0
  43. data/sys/aro/views/teck.rb +30 -0
  44. data/sys/aro.rb +1 -2
  45. data/sys/cli/constants.rb +1 -6
  46. data/sys/cli/create.rb +3 -3
  47. data/sys/cli/nterface.rb +8 -8
  48. data/sys/cli/teck.rb +17 -18
  49. data/sys/cli/usage.rb +4 -8
  50. data/sys/cli.rb +0 -1
  51. data/sys/reiquire.rb +146 -25
  52. data/sys/shr/.DS_Store +0 -0
  53. data/sys/shr/prompt.rb +8 -2
  54. data/sys/shr/t.rb +5 -5
  55. data/sys/shr/version.rb +9 -2
  56. data/tasks/make.rake +2 -1
  57. metadata +53 -116
  58. data/bin/aos +0 -31
  59. data/bin/aro +0 -50
  60. data/bin/ino +0 -22
  61. data/ino_rules_todo.txt +0 -28
  62. data/locale/en.abot.yml +0 -81
  63. data/locale/en.amg.yml +0 -44
  64. data/locale/en.aos.yml +0 -40
  65. data/locale/en.data.yml +0 -30
  66. data/locale/en.dom.yml +0 -47
  67. data/locale/en.flie.yml +0 -29
  68. data/locale/en.ino.yml +0 -9
  69. data/sys/aos/abot.rb +0 -254
  70. data/sys/aos/amg.rb +0 -184
  71. data/sys/aos/aos.rb +0 -672
  72. data/sys/aos/data.rb +0 -117
  73. data/sys/aos/db/migrate/1765148774_create_yous.rb +0 -20
  74. data/sys/aos/db/migrate/1765762724_create_ilibs.rb +0 -22
  75. data/sys/aos/db/migrate/1765907766_create_ilogs.rb +0 -18
  76. data/sys/aos/db/migrate/1765933985_create_agodos.rb +0 -22
  77. data/sys/aos/db/migrate/1766203888_create_fpxies.rb +0 -18
  78. data/sys/aos/db.rb +0 -105
  79. data/sys/aos/flie.rb +0 -144
  80. data/sys/aos/models/agodo.rb +0 -103
  81. data/sys/aos/models/fpxy.rb +0 -26
  82. data/sys/aos/models/ilib.rb +0 -46
  83. data/sys/aos/models/ilog.rb +0 -27
  84. data/sys/aos/models/you.rb +0 -138
  85. data/sys/aos/s.rb +0 -26
  86. data/sys/aos/vws/base.rb +0 -159
  87. data/sys/aos/vws/dom.rb +0 -32
  88. data/sys/aos/vws/games/abot.rb +0 -21
  89. data/sys/aos/vws/games/ino.rb +0 -21
  90. data/sys/aos/vws/games/teck.rb +0 -122
  91. data/sys/aos/vws/games.rb +0 -19
  92. data/sys/aos/vws/home.rb +0 -23
  93. data/sys/aos/vws/know/body.rb +0 -19
  94. data/sys/aos/vws/know/mind.rb +0 -19
  95. data/sys/aos/vws/know/spirit.rb +0 -19
  96. data/sys/aos/vws/know.rb +0 -19
  97. data/sys/aos/vws/root/amg.rb +0 -21
  98. data/sys/aos/vws/root/config.rb +0 -21
  99. data/sys/aos/vws/root/data.rb +0 -21
  100. data/sys/aos/vws/root/flie.rb +0 -21
  101. data/sys/aos/vws/root.rb +0 -19
  102. data/sys/aos/vws/welcome/waite.rb +0 -31
  103. data/sys/aos/vws/welcome/winner.rb +0 -19
  104. data/sys/aos/vws/welcome.rb +0 -66
  105. data/sys/aro/db/migrate/1768856981_create_scrolls.rb +0 -20
  106. data/sys/aro/db/migrate/1768858841_create_legends.rb +0 -16
  107. data/sys/aro/db/migrate/1768858967_create_stories.rb +0 -17
  108. data/sys/aro/db/migrate/1768859060_create_chapters.rb +0 -15
  109. data/sys/aro/db/migrate/1768859126_create_statements.rb +0 -22
  110. data/sys/aro/db/migrate/1768859144_create_players.rb +0 -18
  111. data/sys/aro/ino.rb +0 -64
  112. data/sys/aro/models/chapter.rb +0 -18
  113. data/sys/aro/models/legend.rb +0 -28
  114. data/sys/aro/models/player.rb +0 -17
  115. data/sys/aro/models/scroll.rb +0 -46
  116. data/sys/aro/models/statement.rb +0 -14
  117. data/sys/aro/models/story.rb +0 -28
  118. data/sys/cli/dom.rb +0 -43
  119. data/sys/dom/d.rb +0 -138
  120. data/sys/dom/dom.rb +0 -215
  121. data/sys/dom/p.rb +0 -17
  122. data/sys/fpx.rb +0 -104
  123. data/sys/shr/ilib/crs/CMakeLists.txt +0 -12
  124. data/sys/shr/ilib/crs/compile.sh +0 -5
  125. data/sys/shr/ilib/crs/crs.c +0 -24
  126. data/sys/shr/ilib/crs/crs.o +0 -0
  127. data/sys/shr/ilib/crs/libcrs.so +0 -0
data/sys/aro/store.rb ADDED
@@ -0,0 +1,147 @@
1
+ # frozen_string_literal: true
2
+
3
+ =begin
4
+
5
+ store.rb
6
+
7
+ json data store
8
+
9
+ by i2097i
10
+
11
+ =end
12
+
13
+ class Aro::Dom::Store
14
+ attr_accessor :is_open, :cache, :clear_flag, :parser_error, :open_file_path
15
+
16
+ def initialize
17
+ open_file_path = nil
18
+ clear_cache!
19
+ end
20
+
21
+ def clear_cache!
22
+ if @is_open
23
+ @clear_flag = true
24
+ return
25
+ end
26
+ @clear_flag = false
27
+ @is_open = false
28
+
29
+ @cache = {} # clear'd
30
+ end
31
+
32
+ def self.edit(aro_file, updates)
33
+ return if aro_file.nil?
34
+ unless ::File.exist?(aro_file.aro_file_path)
35
+ ::File.write(aro_file.aro_file_path, "{}")
36
+ end
37
+
38
+ # todo: validate updates
39
+ Aro::Dom::Ma_ain.instance.store_mutex.synchronize do
40
+ store_instance = Aro::Dom::Ma_ain.instance.get_store_for(aro_file)
41
+ updates.each{|k, v|
42
+ store_instance.set_key(k, v)
43
+ Aro::P.say([
44
+ "reading in #{k} after setting to #{v} in #{aro_file.aro_file_path}",
45
+ "got value => #{store_instance.get_key(k)}"
46
+ ])
47
+ }
48
+ end
49
+ end
50
+
51
+ def get_key(key)
52
+ return if open_file_path.nil?
53
+
54
+ key = key.to_s
55
+
56
+ # ensure default for key exists
57
+ @cache[key] = {value: nil, persisted: false} unless @cache.keys.include?(key)
58
+
59
+ # return cache value if storage open or the cache value is persisted
60
+ return @cache[key][:value] if @is_open || @cache[key][:persisted]
61
+
62
+ # open storage
63
+ @is_open = true
64
+ storage_contents = {}
65
+ begin
66
+ @parser_error = nil
67
+ # read storage
68
+ storage_contents = JSON.parse(
69
+ ::File.read(open_file_path, encoding: "UTF-8")
70
+ )
71
+ rescue StandardError => e
72
+ @is_open = false
73
+ if @parser_error.nil?
74
+ @parser_error = e
75
+ return get_key(key)
76
+ else
77
+ raise @parser_error
78
+ end
79
+ end
80
+
81
+ # only update the cache value if present in storage
82
+ if storage_contents.keys.include?(key)
83
+ @cache[key] = {value: storage_contents[key], persisted: true}
84
+ else
85
+ @cache[key][:persisted] = false
86
+ end
87
+
88
+ value = @cache[key][:value]
89
+ @is_open = false
90
+ clear_cache! if @clear_flag
91
+
92
+ return value
93
+ end
94
+
95
+ def set_key(key, value)
96
+ return if open_file_path.nil?
97
+
98
+ key = key.to_s
99
+
100
+ # ensure default for key exists
101
+ @cache[key] = {value: value, persisted: false} unless @cache.keys.include?(key)
102
+
103
+ # assign new cache value and set persisted to false
104
+ @cache[key][:value] = value
105
+ @cache[key][:persisted] = false
106
+
107
+ # return if storage open
108
+ # non-persisted cache values update next cycle
109
+ return if @is_open
110
+
111
+ # open storage
112
+ @is_open = true
113
+ storage_contents = {}
114
+ begin
115
+ @parser_error = nil
116
+ # read storage
117
+ storage_contents = JSON.parse(
118
+ ::File.read(open_file_path, encoding: "UTF-8")
119
+ )
120
+ rescue StandardError => e
121
+ @is_open = false
122
+ if @parser_error.nil?
123
+ @parser_error = e
124
+ return get_key(key)
125
+ else
126
+ raise @parser_error
127
+ end
128
+ end
129
+
130
+ # update storage and cache
131
+ ([key] + @cache.keys.select{|k|
132
+ !@cache[k][:persisted]
133
+ }).each{|k|
134
+ storage_contents[k] = @cache[k][:value]
135
+ @cache[k][:persisted] = true
136
+ }
137
+
138
+ # write storage
139
+ ::File.open(open_file_path, "w+") do |f|
140
+ f.write(storage_contents.to_json)
141
+ end
142
+
143
+ # close storage
144
+ @is_open = false
145
+ clear_cache! if @clear_flag
146
+ end
147
+ end
data/sys/aro/v.rb CHANGED
@@ -14,11 +14,11 @@ module Aro
14
14
  class V < Aro::D
15
15
  def self.say(message)
16
16
  return unless Aro::V.should_print?
17
- super(message)
17
+ super(normalize_message(message))
18
18
  end
19
19
 
20
20
  def self.should_print?
21
- Aos::Cor.ivar(:VERBOSE).to_s == Aos::Cor::BOOLS[:TRUE].to_s && super
21
+ Aro::Cor.ivar(:VERBOSE).to_s == Aro::Cor::BOOLS[:TRUE].to_s && super
22
22
  end
23
23
  end
24
24
  end
@@ -0,0 +1,25 @@
1
+ =begin
2
+
3
+ views/base.rb
4
+
5
+ the base view (abstract or supposed to be).
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ module Aro
12
+ module Views
13
+ class Base
14
+
15
+ def self.show
16
+ draw([])
17
+ end
18
+
19
+ def self.draw(lines)
20
+ Aro::P.say(lines)
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ =begin
2
+
3
+ vws/games/game.rb
4
+
5
+ the game view.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require_relative :"../models/teck".to_s
12
+ require_relative :"./base".to_s
13
+
14
+ module Aro
15
+ module Views
16
+ class Teck < Aro::Views::Base
17
+
18
+ def self.show
19
+ # if Aro::Mancy.teck.nil?
20
+ # draw(["no teck loaded...exiting..."])
21
+ # return
22
+ # end
23
+
24
+ # Aro::P.say(:"Aro::Dom::Ma_ain.run".to_s)
25
+ # draw(Aro::Dom::Ma_ain.run)
26
+ end
27
+
28
+ end
29
+ end
30
+ end
data/sys/aro.rb CHANGED
@@ -9,8 +9,7 @@
9
9
  =end
10
10
 
11
11
  require_relative :reiquire.to_s
12
- Reiquire::aro
13
12
 
14
13
  module Aro
15
-
14
+ Reiquire::aro
16
15
  end
data/sys/cli/constants.rb CHANGED
@@ -25,13 +25,12 @@ module CLI
25
25
 
26
26
  CMDS = {
27
27
  ARO: {
28
+ CONSOLE: :console,
28
29
  CREATE: :create,
29
30
  COR: :cor,
30
31
  TECK: :teck,
31
- DOM: :dom,
32
32
  INIT: :init,
33
33
  },
34
- COR: {}, # see Aos::Cor
35
34
  TECK: {
36
35
  DRAW: :draw,
37
36
  EXPLORE: :explore,
@@ -41,10 +40,6 @@ module CLI
41
40
  SHOW: :show,
42
41
  SHUFFLE: :shuffle,
43
42
  },
44
- DOM: {
45
- INIT: :init,
46
- NEW: :new,
47
- },
48
43
  }
49
44
 
50
45
  end
data/sys/cli/create.rb CHANGED
@@ -13,11 +13,11 @@ module CLI
13
13
  CLI::Nterface.exit_error_missing_args!(:var_aro_name) if CLI::ARGV1.nil?
14
14
 
15
15
  name = CLI::ARGV1&.to_s
16
- Aro::P.say(I18n.t("cli.messages.creation_attempt", name: name))
16
+ Aro::P.say(I18n.t("messages.creation_attempt", name: name))
17
17
  if Aro::Mancy.create(name)
18
- Aro::P.say(I18n.t("cli.messages.creation_success", name: name))
18
+ Aro::P.say(I18n.t("messages.creation_success", name: name))
19
19
  else
20
- Aro::P.say(I18n.t("cli.messages.creation_failure", name: name))
20
+ Aro::P.say(I18n.t("messages.creation_failure", name: name))
21
21
  end
22
22
  end
23
23
  end
data/sys/cli/nterface.rb CHANGED
@@ -11,26 +11,26 @@
11
11
  module CLI
12
12
  class Nterface
13
13
  def self.exit_error_not_found!(arg)
14
- Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy))
15
- Aro::P.say(I18n.t("cli.errors.not_found", cmd: arg))
14
+ Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
15
+ Aro::P.say(I18n.t("errors.not_found", cmd: arg))
16
16
  exit(CLI::EXIT_CODES[:INVALID_ARG])
17
17
  end
18
18
 
19
19
  def self.exit_error_missing_args!(arg)
20
- Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy))
21
- Aro::P.say(I18n.t("cli.errors.missing_args", cmd: arg))
20
+ Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
21
+ Aro::P.say(I18n.t("errors.missing_args", cmd: arg))
22
22
  exit(CLI::EXIT_CODES[:INVALID_ARG])
23
23
  end
24
24
 
25
25
  def self.exit_error_invalid_usage!
26
- Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy))
27
- Aro::P.say(I18n.t("cli.errors.invalid_usage", cmd: Aro::Mancy))
26
+ Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
27
+ Aro::P.say(I18n.t("errors.invalid_usage", cmd: Aro::Mancy))
28
28
  exit(CLI::EXIT_CODES[:GENERAL_ERROR])
29
29
  end
30
30
 
31
31
  def self.exit_error_not_initialized!
32
- Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy))
33
- Aro::P.say(I18n.t("cli.errors.not_initialized", cmd: Aro::Mancy))
32
+ Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
33
+ Aro::P.say(I18n.t("errors.not_initialized", cmd: Aro::Mancy))
34
34
  exit(CLI::EXIT_CODES[:GENERAL_ERROR])
35
35
  end
36
36
  end
data/sys/cli/teck.rb CHANGED
@@ -10,30 +10,30 @@
10
10
 
11
11
  module CLI
12
12
  def self.teck
13
- Aro::Mancy.init
13
+ Aro::Mancy.init(Aro::Mancy.root_dir)
14
14
  action = CLI::ARGV1&.to_sym
15
15
  if CLI::FLAGS[:HELP].include?(action)
16
16
  CLI.usage_teck
17
17
  exit(CLI::EXIT_CODES[:SUCCESS])
18
- elsif action.nil? || action == :aos
18
+ elsif action.nil?
19
19
  # no args, open teck menu
20
20
  if Aro::Mancy.in_aro?
21
21
  Aro::Teck.display_selection_menu
22
22
  else
23
- Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
23
+ Aro::P.say(I18n.t("errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
24
24
  end
25
25
  elsif action == CLI::CMDS[:TECK][:NEW]
26
26
  CLI::Nterface.exit_error_missing_args!(:var_teck_name) if CLI::ARGV2.nil?
27
27
  if Aro::Mancy.in_aro?
28
28
  teck = Aro::Teck.make(CLI::ARGV2.to_s)
29
- Aro::P.say(I18n.t("cli.messages.teck_created_sucessfully", name: teck.name))
29
+ Aro::P.say(I18n.t("messages.teck_created_sucessfully", name: teck.name))
30
30
  Aro::Teck.display_selection_menu
31
31
  else
32
- Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
32
+ Aro::P.say(I18n.t("errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
33
33
  end
34
34
  elsif CLI::CMDS[:TECK].values.include?(action)
35
35
  if Aro::Mancy.teck.nil?
36
- Aro::P.say(I18n.t("cli.errors.missing_teck", cmd: Aro::Mancy::I2097I))
36
+ Aro::P.say(I18n.t("errors.missing_teck", cmd: Aro::Mancy::I2097I))
37
37
  exit(CLI::EXIT_CODES[:GENERAL_ERROR])
38
38
  end
39
39
 
@@ -42,28 +42,27 @@ module CLI
42
42
  Aro::Mancy.teck.explore
43
43
  exit(CLI::EXIT_CODES[:SUCCESS])
44
44
  when CLI::CMDS[:TECK][:SHUFFLE]
45
- Aro::P.say(I18n.t("cli.messages.shuffling", name: Aro::Mancy.teck.name))
45
+ Aro::P.say(I18n.t("messages.shuffling", name: Aro::Mancy.teck.name))
46
46
  Aro::Mancy.teck.shuffle
47
47
  when CLI::CMDS[:TECK][:DRAW]
48
- Aos::Cor.instance.load
49
- Aro::P.say(I18n.t("cli.messages.drawing", name: Aro::Mancy.teck.name))
50
- Aro::P.say(I18n.t("cli.messages.drawing_from_dimension", dimension: "#{Aos::Cor.ivar(:DIMENSION)}"))
48
+ Aro::Cor.instance.load_env
49
+ Aro::P.say(I18n.t("messages.drawing", name: Aro::Mancy.teck.name))
50
+ Aro::P.say(I18n.t("messages.drawing_from_dimension", dimension: "#{Aro::Cor.ivar(:DIMENSION)}"))
51
51
  Aro::Mancy.teck.draw(
52
- is_dt_dimension: Aro::T::is_dev_tarot?,
53
- z_max: Aos::Cor.ivar(:Z_MAX).to_i,
54
- z: Aos::Cor.ivar(:Z)
52
+ z_max: Aro::Cor.ivar(:Z_MAX).to_i,
53
+ z: Aro::Cor.ivar(:Z)
55
54
  )
56
55
  when CLI::CMDS[:TECK][:REPLACE]
57
- Aro::P.say(I18n.t("cli.messages.replacing_drawn", name: Aro::Mancy.teck.name))
56
+ Aro::P.say(I18n.t("messages.replacing_drawn", name: Aro::Mancy.teck.name))
58
57
  Aro::Mancy.teck.replace
59
58
  when CLI::CMDS[:TECK][:RESET]
60
- Aro::P.say("#{I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.teck.name)}")
61
- if Aro::Mancy::YES.to_s != Aos::S.p.ask("\n#{Aro::Mancy::PS1}$")
62
- Aro::P.say(I18n.t("cli.messages.understood", name: Aro::Mancy.teck.name))
59
+ Aro::P.say("#{I18n.t("messages.confirmation_prompt", name: Aro::Mancy.teck.name)}")
60
+ if Aro::Mancy::YES.to_s != Aro::P.p.ask("\n#{Aro::Mancy.ps1_display}$")
61
+ Aro::P.say(I18n.t("messages.understood", name: Aro::Mancy.teck.name))
63
62
  exit(CLI::EXIT_CODES[:SUCCESS])
64
63
  end
65
64
 
66
- Aro::P.say(I18n.t("cli.messages.resetting", name: Aro::Mancy.teck.name))
65
+ Aro::P.say(I18n.t("messages.resetting", name: Aro::Mancy.teck.name))
67
66
  Aro::Mancy.teck.reset
68
67
  end
69
68
  Aro::Mancy.teck.show(**CLI::shoptions)
data/sys/cli/usage.rb CHANGED
@@ -10,18 +10,14 @@
10
10
 
11
11
  module CLI
12
12
 
13
- def self.usage_dom
14
- Aro::P.less(I18n.t("usage.dom"))
15
- end
16
-
17
- def self.usage_ino
18
- Aro::P.less(I18n.t("usage.ino"))
19
- end
20
-
21
13
  def self.usage_main
22
14
  Aro::P.less(I18n.t("usage.main"))
23
15
  end
24
16
 
17
+ def self.usage_cor
18
+ Aro::P.less(I18n.t("usage.cor"))
19
+ end
20
+
25
21
  def self.usage_teck
26
22
  Aro::P.less(I18n.t("usage.teck"))
27
23
  end
data/sys/cli.rb CHANGED
@@ -9,7 +9,6 @@
9
9
  =end
10
10
 
11
11
  module CLI
12
- # todo: make this filtering better. dom uses :new as well
13
12
  if CLI::CMDS[:TECK].values.filter{|k| ![:new].include?(k)}.include?(ARGV[0]&.to_sym)
14
13
  # enable teck shortcut (skip typing teck while in-game)
15
14
  ARGV0 = :teck
data/sys/reiquire.rb CHANGED
@@ -8,41 +8,162 @@
8
8
 
9
9
  =end
10
10
 
11
- # dependencies
12
- require :active_record.to_s
13
- require :"active_record/schema_dumper".to_s
14
- require :base64.to_s
15
- require :ffi.to_s
16
- require :fileutils.to_s
17
- require :"io/console".to_s
18
- require :i18n.to_s
19
- require :"net/http".to_s
20
- require :readline.to_s
21
- require :"tty-prompt".to_s
22
- require :yaml.to_s
23
-
24
11
  module Reiquire
25
- GEM_PATH = Gem.loaded_specs[:aro.to_s]&.full_gem_path
26
-
27
12
  def self.aro
28
- # configure I18n
13
+ # require runtime dependencies
14
+ require_dependencies!
29
15
 
30
- I18n.load_path += Dir["#{Reiquire::GEM_PATH}/locale/*.yml"]
31
- I18n.available_locales = [:en]
32
- I18n.default_locale = :en
16
+ # require aro library
17
+ require_reiquires!
33
18
 
34
- # require sys folders
35
- Reiquire::requires([:shr, :aro, :aos, :dom, :cli])
19
+ # configure locale
20
+ configure_i18n
36
21
 
37
- # require cli module
38
- require_relative :"./cli".to_s
22
+ # ensure base migrations exist
23
+ copy_db_migrations_from_gem! if Aro::Mancy.in_aro?
39
24
  end
40
25
 
41
26
  def self.requires(dirs)
42
27
  dirs.each{|d|
43
28
  Dir[
44
- File.join(__dir__, d.to_s, :"**/*.rb".to_s)
45
- ].each { |f| require f}
29
+ File.join(__dir__, d.to_s, :"**/**/*.rb".to_s)
30
+ ].each { |f| require f }
46
31
  }
47
32
  end
33
+
34
+ def self.reload_i18n!
35
+ copy_locale_files_from_gem!
36
+ configure_i18n
37
+ end
38
+
39
+ def self.gem_migrations_path
40
+ File.join(gem_dir, :"sys/aro/db".to_s)
41
+ end
42
+
43
+ def self.gem_locale_dir
44
+ File.join(gem_dir, :locale.to_s)
45
+ end
46
+
47
+ def self.gem_locales_filepaths
48
+ File.join(gem_locale_dir, "*.yml")
49
+ end
50
+
51
+ def self.copy_db_migrations_from_gem!
52
+ puts __method__
53
+ puts Aro::Cor.ivar(:OSS_OM_HOME)
54
+ return if Aro::Cor.ivar(:OSS_OM_HOME).nil? || oss_om_up_to_date?(
55
+ Aro::Db.gem_migrations_filepaths,
56
+ Aro::Db.migrations_filepaths
57
+ )
58
+
59
+ FileUtils.mkdir_p(Aro::Db.migrate_dir)
60
+ FileUtils.cp_r(
61
+ gem_migrations_path,
62
+ Aro::Db.migrate_dir
63
+ )
64
+ end
65
+
66
+ private
67
+
68
+ def self.copy_locale_files_from_gem!
69
+ puts __method__
70
+ puts Aro::Cor.ivar(:OSS_OM_HOME)
71
+ return if Aro::Cor.ivar(:OSS_OM_HOME).nil? || oss_om_up_to_date?(
72
+ gem_locales_filepaths,
73
+ Aro::Dom::Locale.locales_filepaths
74
+ )
75
+
76
+ oss_wtf = File.join(Aro::Mancy.root_dir, :locale.to_s, :locale.to_s)
77
+ if Dir.exist?(oss_wtf)
78
+ FileUtils.rm_rf(oss_wtf)
79
+ oss_om_up_to_date!(
80
+ gem_locales_filepaths,
81
+ Aro::Dom::Locale.locale_dir
82
+ )
83
+ return
84
+ end
85
+
86
+ FileUtils.mkdir_p(Aro::Dom::Locale.locale_dir)
87
+ FileUtils.cp_r(
88
+ gem_locale_dir,
89
+ Aro::Dom::Locale.locale_dir
90
+ )
91
+ end
92
+
93
+ def self.oss_om_up_to_date!(gem_filepaths, oss_om_dir)
94
+ puts __method__
95
+ gem_files_abs = Dir[gem_filepaths].map{|fp| File.absolute_path(fp)}
96
+ puts "gem_files_abs: #{gem_files_abs}"
97
+
98
+ puts "FileUtils.mkdir_p(#{oss_om_dir})"
99
+ FileUtils.mkdir_p(oss_om_dir)
100
+ gem_files_abs.each{|gfa|
101
+ puts "FileUtils.cp(#{File.basename(gfa)}, #{File.basename(oss_om_dir)})"
102
+ FileUtils.cp(gfa, oss_om_dir)
103
+ }
104
+ end
105
+
106
+ def self.oss_om_up_to_date?(gem_filepaths, oss_om_filepaths)
107
+ puts __method__
108
+ file_names = Dir[oss_om_filepaths].map{|fp| File.basename(fp)}
109
+ puts "file_names: #{file_names}"
110
+ gem_file_names = Dir[gem_filepaths].map{|fp| File.basename(fp)}
111
+ puts "gem_file_names: #{gem_file_names}"
112
+ mfs_all = gem_file_names.all?{|gfn|
113
+ file_names.include?(gfn)
114
+ }
115
+ puts "mfs_all: #{mfs_all}"
116
+ mfs_all
117
+ end
118
+
119
+ def self.require_reiquires!
120
+ # require sys folders
121
+ Reiquire::requires([:shr, :aro, :cli])
122
+
123
+ # require cli module
124
+ require_relative :"./cli".to_s
125
+ end
126
+
127
+ def self.require_dependencies!
128
+ [
129
+ :active_record,
130
+ :"active_record/schema_dumper",
131
+ :fileutils,
132
+ :i18n,
133
+ :"tty-prompt"
134
+ ].each{|d| require d.to_s}
135
+ end
136
+
137
+ def self.gem_dir
138
+ Dir[
139
+ Gem.loaded_specs[Aro.to_s.downcase]&.full_gem_path
140
+ ].first
141
+ end
142
+
143
+ def self.configure_i18n
144
+ Aro::D.say(__method__)
145
+ gem_dir_variable = gem_dir
146
+ copy_locale_files_from_gem!
147
+ aro_i18n_library = File.join(gem_dir_variable, :locale.to_s, "*.yml")
148
+ if Aro::Mancy.is_initialized?
149
+ I18n.load_path = I18n.load_path.select{|lp|
150
+ # stop using gem locales if in_aro?
151
+ !gem_dir_variable.include?(lp)
152
+ }
153
+ aro_i18n_library = File.join(Aro::Dom::Locale.locale_dir, "*.yml")
154
+ end
155
+ I18n.load_path += Dir[aro_i18n_library]
156
+
157
+ I18n.available_locales = [:en]
158
+ I18n.default_locale = :en
159
+ Aro::D.say("I18n.load_path")
160
+ Aro::D.say(I18n.load_path)
161
+ Aro::D.say("I18n.available_locales")
162
+ Aro::D.say(I18n.available_locales)
163
+ Aro::D.say("I18n.default_locale")
164
+ Aro::D.say(I18n.default_locale)
165
+ Aro::D.say("I18n.reload!")
166
+ Aro::D.say(I18n.reload!)
167
+ end
168
+
48
169
  end
data/sys/shr/.DS_Store ADDED
Binary file
data/sys/shr/prompt.rb CHANGED
@@ -23,15 +23,21 @@ module Aro
23
23
  end
24
24
 
25
25
  def self.should_print?
26
- Aos::Cor::BOOLS[:TRUE]
26
+ Aro::Cor::BOOLS[:TRUE]
27
27
  end
28
28
 
29
29
  def self.say(message)
30
- Aos::Os.say(message)
30
+ p.say(normalize_message(message))
31
31
  end
32
32
 
33
33
  def self.less(message)
34
34
  IO.popen("less -X", "w") { |f| f.puts(message) }
35
35
  end
36
+
37
+ def self.normalize_message(message)
38
+ return message.join("\n") if message.kind_of?(Array)
39
+
40
+ message
41
+ end
36
42
  end
37
43
  end
data/sys/shr/t.rb CHANGED
@@ -15,8 +15,8 @@ module Aro
15
15
  RUBY_FACOT = :"Ruby::Facot".to_s
16
16
 
17
17
  def self.is_dev_tarot?
18
- user_setting_true = Aos::Cor.ivar(:DIMENSION)&.to_sym == Aos::Cor::DMS[:DEV_TAROT]
19
- Aro::T.is_dev_tarot_avail? && (user_setting_true || Aos::Cor.ivar(:DIMENSION).nil?)
18
+ user_setting_true = Aro::Cor.ivar(:DIMENSION)&.to_sym == Aro::Cor::DMS[:DEV_TAROT]
19
+ Aro::T.is_dev_tarot_avail? && (user_setting_true || Aro::Cor.ivar(:DIMENSION).nil?)
20
20
  end
21
21
 
22
22
  def self.is_dev_tarot_avail?
@@ -30,7 +30,7 @@ module Aro
30
30
  # VERY IMPORTANT!
31
31
  File.open(Aro::T::DEV_TAROT_FILE.to_s, "r"){|dtf| dt = dtf.read(Aro::Mancy::N).strip}
32
32
  # VERY IMPORTANT!
33
- Aro::V.say(I18n.t("cli.very_important", dev_tarot: dt))
33
+ Aro::V.say(I18n.t("very_important", dev_tarot: dt))
34
34
  else
35
35
  Aro::D.say("error: #{Aro::T::DEV_TAROT_FILE.to_s} not installed.")
36
36
  end
@@ -46,7 +46,7 @@ module Aro
46
46
 
47
47
  # summon ruby_facot
48
48
  def self.summon_ruby_facot(include_o = true)
49
- Aro::D.say(I18n.t("cli.messages.ruby_facot_random"))
49
+ Aro::D.say(I18n.t("messages.ruby_facot_random"))
50
50
  ruby_facot = I18n.t("cards.index").map{|c| "+#{c}"}.sample.split("")
51
51
 
52
52
  # get orientation
@@ -62,7 +62,7 @@ module Aro
62
62
  # => character[0]: orientation
63
63
  # => character[1]: suit
64
64
 
65
- # the first two characters in the dev_tarot format designate the
65
+ # the first two characters in the dev_tarot format designate the rf os
66
66
  !ruby_facot.first(Aro::Mancy::OS).include?(c)
67
67
  }.join("").to_sym
68
68
  rf += Aro::Mancy::NUMERALS[symm].to_s
data/sys/shr/version.rb CHANGED
@@ -9,6 +9,13 @@
9
9
  =end
10
10
 
11
11
  module Aro
12
- VERSION = :"0.2.5"
13
- RELEASE_NOTES = :"this version".to_s + [].join(",")
12
+ VERSION = :"0.2.6"
13
+ RELEASE_NOTES = [
14
+ :removes_aos,
15
+ :removes_ino,
16
+ :reduces_ruby_4_0_7_to_3_4_7,
17
+ :adds_menus_and_data,
18
+ :removes_aro_cli,
19
+ :adds_oss_om
20
+ ].join("\n:")
14
21
  end
data/tasks/make.rake CHANGED
@@ -1,4 +1,5 @@
1
1
  desc "rake install && rspec"
2
2
  task :make do
3
- exec "rake install && rspec --backtrace"
3
+ exec "rake install && bundle info aro"
4
+ #exec "rake install && rspec --backtrace"
4
5
  end