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/ma_ain.rb ADDED
@@ -0,0 +1,54 @@
1
+ =begin
2
+
3
+ ma_ain.rb
4
+
5
+ aro dom ma_ain.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ module Aro
12
+ module Dom
13
+ class Ma_ain < Aro::Mancy
14
+ # inherits Singleton
15
+
16
+ attr_accessor :current_menu
17
+ attr_accessor :data_mutex, :store_mutex
18
+ attr_accessor :stores
19
+
20
+ def reign!
21
+ Aro::P.say("opening #{Aro::Dom::Designer.name}...")
22
+ Aro::Dom::Designer.design
23
+ end
24
+
25
+ def initialize
26
+ self.data_mutex = Mutex.new
27
+ self.store_mutex = Mutex.new
28
+ @stores = {}
29
+ end
30
+
31
+ def self.domain
32
+ self.instance.current_menu.nil? ? super : "#{Aro::Mancy.aro_mancy_name}#{Aro::Mancy::A}#{Aro::Dom::Ma_ain}"
33
+ end
34
+
35
+ def self.ps1_display(cls_name = nil)
36
+ super(domain)
37
+ end
38
+
39
+ def get_store_for(aro_file)
40
+ return if aro_file.nil?
41
+
42
+ # todo validate aro_file
43
+ if @stores[aro_file.uuid].nil?
44
+ new_store = Aro::Dom::Store.new
45
+ new_store.open_file_path = aro_file.aro_file_path
46
+ @stores[aro_file.uuid] = new_store
47
+ end
48
+
49
+ return Aro::Dom::Ma_ain.instance.stores[aro_file.uuid]
50
+ end
51
+
52
+ end
53
+ end
54
+ end
data/sys/aro/mancy.rb CHANGED
@@ -8,21 +8,25 @@
8
8
 
9
9
  =end
10
10
 
11
+ #
12
+
11
13
  module Aro
12
14
  class Mancy
13
15
  include Singleton
14
16
 
15
- attr_accessor :current
17
+ attr_accessor :current, :db_busy, :db_thread
16
18
 
19
+ A = :"@"
17
20
  O = 0
18
21
  S = 1
19
22
  OS = 2
20
23
  E = 3
21
24
  N = 4
22
25
  V = 5
23
- PS1 = :">[#{Aro::Mancy.name}]>: "
26
+ DATE_FORMAT = "%A %d %b %Y %I:%M:%S %p"
24
27
  NAME_FILE = :".aro_space"
25
- ARO_FILE = :".aro"
28
+ ARO_DIRECTORY = :".oss_om"
29
+
26
30
  I2097I = :i2097i
27
31
  YES = :aroyes
28
32
  ALL = :all
@@ -58,49 +62,46 @@ module Aro
58
62
  MMXCVII: Aro::Mancy::I2097I[Aro::Mancy::S..Aro::Mancy::N].to_i,
59
63
  }
60
64
 
65
+ def remember!
66
+ # start monitoring
67
+ self.start_db_thread
68
+ end
69
+
61
70
  def self.teck
71
+ self.init(root_dir)
62
72
  if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
63
73
  self.instance.current = Aro::Teck.current_teck
64
74
  end
65
75
  self.instance.current
66
76
  end
67
77
 
68
- def self.create(name)
69
- return false if Aro::Mancy.in_aro? || name.nil?
70
-
71
- # explicitly only allow String/Symbol types for name
72
- return false unless name.kind_of?(String) || name.kind_of?(Symbol)
73
- name = name.to_s.strip
74
- # create the new aro directory and database
75
- if !Dir.exist?(name)
76
- Aro::P.say(I18n.t("cli.messages.no_tecks"))
77
- FileUtils.mkdir(name)
78
- else
79
- return false
80
- end
81
-
82
- Dir.chdir(name) do
83
- Aos::Cor.instance.load
84
- Aro::Mancy.init
85
- end
78
+ def self.create(aro_name, is_test: false)
79
+ Aro::D.say(__method__)
80
+ Aro::D.say(:depricated)
86
81
  return true
87
82
  end
88
83
 
89
- def self.init
90
- unless Aro::Mancy.in_aro? || Aos::Cor.is_test?
91
- Aro::P.say("init aro running in present directory...")
92
- new_name = File.basename(Dir.pwd)
84
+ def self.init(root_dir_path)
85
+ unless Aro::Mancy.in_aro? || Aro::Cor.is_test?
86
+ Aro::P.say("init aro running in #{root_dir_path} directory...")
87
+ new_name = File.basename(root_dir_path)
93
88
  Aro::P.say("echo #{new_name} > #{Aro::Mancy::NAME_FILE.to_s}")
94
89
  File.open(Aro::Mancy::NAME_FILE.to_s, "w") do |file|
95
90
  file.write(new_name)
91
+ file.write("\n")
96
92
  end
97
93
  end
94
+ end
98
95
 
99
- Aro::Db.load
96
+ def self.root_dir
97
+ ::File.join(
98
+ Aro::Cor.ivar(:OSS_OM_HOME) || Dir.pwd,
99
+ Aro::Mancy::ARO_DIRECTORY.to_s
100
+ )
100
101
  end
101
102
 
102
103
  def self.is_initialized?
103
- !Aro::Db.base_aro_dir.nil? && Dir.exist?(Aro::Db.base_aro_dir)
104
+ in_aro? && in_aro? && Aro::Db.instance.connected?
104
105
  end
105
106
 
106
107
  def self.in_aro?
@@ -108,11 +109,35 @@ module Aro
108
109
  end
109
110
 
110
111
  def self.domain
111
- "#{Aro::Mancy}#{Aos::Os::A}#{Aro::Mancy.aro_mancy_name}"
112
+ is_initialized? ? "#{Aro::Mancy.aro_mancy_name}#{Aro::Mancy::A}#{Aro::Mancy}" : `whoami`.strip
112
113
  end
113
114
 
114
115
  def self.aro_mancy_name
115
116
  File.read(Aro::Mancy::NAME_FILE.to_s).strip
116
117
  end
118
+
119
+ def self.ps1_display(cls_name = nil)
120
+ :">[#{cls_name || Aro::Mancy.domain || aro_mancy_name}]>: ".to_s
121
+ end
122
+
123
+ private
124
+
125
+ def start_db_thread
126
+ return if @db_busy
127
+ @db_busy = true
128
+ self.db_thread&.exit
129
+ self.db_thread&.kill
130
+ self.db_thread = Thread.new do
131
+ loop do
132
+ @db_busy = true
133
+ Aro::V.say(Aro::Mancy.instance.db_thread.inspect)
134
+ Aro::V.say(__method__)
135
+ Aro::Db.ensure_connected!
136
+ @db_busy = false
137
+ sleep(Aro::Db::HEARTBEAT_DURATION)
138
+ end
139
+ end
140
+ end
141
+
117
142
  end
118
143
  end
File without changes
@@ -0,0 +1,29 @@
1
+ =begin
2
+
3
+ uuid.rb
4
+
5
+ basic uuid generator for active record
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require "securerandom"
12
+
13
+ module Aro::Dom::Uuid
14
+ extend ActiveSupport::Concern
15
+
16
+ included do
17
+ before_create :generate_uuid
18
+ end
19
+
20
+ private
21
+
22
+ def generate_uuid
23
+ self.uuid = SecureRandom.send([
24
+ :uuid,
25
+ :uuid_v7,
26
+ :uuid_v4
27
+ ].sample) if self.uuid.nil?
28
+ end
29
+ end
@@ -0,0 +1,97 @@
1
+ =begin
2
+
3
+ data.rb
4
+
5
+ aro dom data.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::Dom::DataBase < ActiveRecord::Base
12
+ include Aro::Dom::Uuid
13
+ self.table_name = :data_bases
14
+
15
+ has_many :data_base_directories, class_name: "Aro::Dom::DataBase::Directory"
16
+
17
+ after_commit :sync
18
+
19
+ def self.open_menu(menu_sym)
20
+ # get the menu directory
21
+ data_base_directory = menu_data_base.data_base_directories.find_or_create_by(
22
+ unix_path: menu_sym
23
+ )
24
+
25
+ menu = Aro::Dom::Menu.find_by(uuid: data_base_directory.uuid)
26
+ if menu.nil?
27
+ # find or create the new menu
28
+ menu = Aro::Dom::Menu.create(uuid: data_base_directory.uuid)
29
+ Aro::Dom::Locale.add_i18n_key(
30
+ menu_sym.to_s,
31
+ new_i18n_display_key: menu.uuid
32
+ )
33
+ end
34
+
35
+ # return the menu
36
+ return menu
37
+ end
38
+
39
+ def self.menu_data_base
40
+ Aro::Dom::DataBase.find_or_create_by(unix_path: Aro::Dom::Menu.table_name)
41
+ end
42
+
43
+ def self.sync_menu_item(menu_item)
44
+ # todo:
45
+ puts "todo: #{__method__} #{menu_item.inspect}"
46
+ end
47
+
48
+ def self.ensure_data_base_exist!
49
+ unless Dir.exist?(root_aro_unix_data_dir)
50
+ Aro::P.say(__method__)
51
+ Aro::P.say("creating #{root_aro_unix_data_dir}")
52
+ FileUtils.mkdir(root_aro_unix_data_dir)
53
+ ensure_data_base_git!
54
+ end
55
+ end
56
+
57
+
58
+ def self.ensure_data_base_git!
59
+ ensure_data_base_exist! unless Dir.exist?(root_aro_unix_data_dir)
60
+ FileUtils.chdir(root_aro_unix_data_dir) do
61
+ Aro::P.say("todo:")
62
+ Aro::P.say(__method__)
63
+ # system("git init")
64
+ end
65
+ end
66
+
67
+ def unix_path_valid?
68
+ unix_path.kind_of?(String) && !unix_path.empty?
69
+ end
70
+
71
+ def aro_data_base_path
72
+ ::File.join(Aro::Dom::DataBase.root_aro_unix_data_dir, unix_path)
73
+ end
74
+
75
+ def self.root_aro_unix_data_dir
76
+ ::File.join(Aro::Mancy.root_dir, table_name)
77
+ end
78
+
79
+ def ensure_unix_exists!
80
+ raise "unix_path invalid! #{(unix_path)}" unless unix_path_valid?
81
+ unless Dir.exist?(aro_data_base_path)
82
+ Aro::P.say(__method__)
83
+ Aro::P.say("creating #{aro_data_base_path}")
84
+ FileUtils.mkdir(aro_data_base_path)
85
+ ::File.write(::File.join(aro_data_base_path, ".uuid"), uuid)
86
+ end
87
+ end
88
+
89
+ private
90
+
91
+ def sync
92
+ Aro::Dom::Ma_ain.instance.data_mutex.synchronize do
93
+ self.class.ensure_data_base_git!
94
+ ensure_unix_exists!
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,44 @@
1
+ =begin
2
+
3
+ data.rb
4
+
5
+ aro dom table.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::Dom::DataBase::Directory < ActiveRecord::Base
12
+ include Aro::Dom::Uuid
13
+ self.table_name = :data_base_directories
14
+ belongs_to :data_base, class_name: "Aro::Dom::DataBase"
15
+
16
+ has_many :data_base_files, class_name: "Aro::Dom::DataBase::File"
17
+
18
+ after_create :sync
19
+ after_commit :sync
20
+
21
+ def ensure_unix_exists!
22
+ unless Dir.exist?(aro_directory_path)
23
+ Aro::P.say("creating #{Aro::Dom::DataBase::Directory} for #{aro_directory_path}")
24
+ FileUtils.mkdir(aro_directory_path)
25
+ ::File.write(::File.join(aro_directory_path, ".uuid"), uuid)
26
+ end
27
+ end
28
+
29
+ def aro_directory_path
30
+ ::File.join(data_base.aro_data_base_path, unix_path)
31
+ end
32
+
33
+ def schema
34
+ ::File.join(aro_directory_path, :def_directory, ".json")
35
+ end
36
+
37
+ private
38
+
39
+ def sync
40
+ Aro::Dom::Ma_ain.instance.data_mutex.synchronize do
41
+ ensure_unix_exists!
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,27 @@
1
+ =begin
2
+
3
+ row.rb
4
+
5
+ aro dom data file.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::Dom::DataBase::File < ActiveRecord::Base
12
+ include Aro::Dom::Uuid
13
+ self.table_name = :data_base_files
14
+ belongs_to :data_base_directory, class_name: "Aro::Dom::DataBase::Directory"
15
+
16
+ def write!(updates = {})
17
+ Aro::Dom::Store.edit(self, updates)
18
+ end
19
+
20
+ def aro_file_path
21
+ ::File.join(
22
+ data_base_directory.aro_directory_path,
23
+ "#{uuid}.json"
24
+ )
25
+ end
26
+
27
+ end
@@ -0,0 +1,27 @@
1
+ =begin
2
+
3
+ menu.rb
4
+
5
+ aro dom menu.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::Dom::Menu < ActiveRecord::Base
12
+ include Aro::Dom::Uuid
13
+
14
+ has_many :menu_items, class_name: "Aro::Dom::MenuItem"
15
+
16
+ def localized_name
17
+ I18n.t(full_i18n_path)
18
+ end
19
+
20
+ def full_i18n_path
21
+ "#{self.class.table_name}.#{uuid}"
22
+ end
23
+
24
+ def directory
25
+ Aro::Dom::DataBase::Directory.find_by(uuid: uuid)
26
+ end
27
+ end
@@ -0,0 +1,47 @@
1
+ =begin
2
+
3
+ menu.rb
4
+
5
+ aro dom menu item.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::Dom::MenuItem < ActiveRecord::Base
12
+ include Aro::Dom::Uuid
13
+ belongs_to :menu, class_name: "Aro::Dom::Menu"
14
+
15
+ after_create :sync
16
+
17
+ def as_tty
18
+ {name: localized_name, value: uuid}
19
+ end
20
+
21
+ def localized_name
22
+ I18n.t(full_i18n_path)
23
+ end
24
+
25
+ def full_i18n_path
26
+ "#{self.class.table_name}.#{uuid}"
27
+ end
28
+
29
+ def aro_directory
30
+ return if menu.nil?
31
+ Aro::Dom::DataBase::Directory.find_by(uuid: menu.uuid)
32
+ end
33
+
34
+ def aro_file
35
+ return if aro_directory.nil?
36
+ Aro::Dom::DataBase::File.find_or_create_by(
37
+ uuid: uuid,
38
+ data_base_directory: aro_directory
39
+ )
40
+ end
41
+
42
+ private
43
+
44
+ def sync
45
+ Aro::Dom::DataBase.sync_menu_item(self)
46
+ end
47
+ end
@@ -20,7 +20,6 @@ class Aro::Teck < ActiveRecord::Base
20
20
  after_commit :generate_log
21
21
 
22
22
  def self.make(new_name)
23
- Aro::Db.load
24
23
  return nil unless Aro::Mancy.is_initialized?
25
24
  new_teck = Aro::Teck.create(name: new_name)
26
25
  Aro::Teck.select_teck(new_teck) if Aro::Teck.current_teck.nil?
@@ -32,13 +31,14 @@ class Aro::Teck < ActiveRecord::Base
32
31
  end
33
32
 
34
33
  def populate_cards
35
- Aro::Db.load
36
34
  self.cards = Aro::Teck.fresh_cards
37
35
  end
38
36
 
39
37
  def generate_log
40
38
  prev_cards = Base64::decode64(tlogs.last.card_data) if tlogs.any?
41
- if (prev_cards.present? && prev_cards != cards) || (prev_cards.nil? || prev_cards.empty?)
39
+ if (prev_cards.present? && prev_cards != cards) ||
40
+ (prev_cards.nil? || prev_cards.empty?)
41
+
42
42
  tlogs.create(
43
43
  card_data: Base64::encode64(cards || ""),
44
44
  drawn_data: Base64::encode64(drawn || "")
@@ -47,9 +47,8 @@ class Aro::Teck < ActiveRecord::Base
47
47
  end
48
48
 
49
49
  def self.display_selection_menu
50
- Aro::Db.load
51
50
  unless Aro::Teck.any?
52
- Aro::P.say(I18n.t("cli.messages.no_tecks"))
51
+ Aro::P.say(I18n.t("messages.no_tecks"))
53
52
  exit(CLI::EXIT_CODES[:SUCCESS])
54
53
  end
55
54
  c_d = Aro::Teck.current_teck
@@ -60,16 +59,15 @@ class Aro::Teck < ActiveRecord::Base
60
59
 
61
60
  def self.select_teck(teck)
62
61
  return unless teck.present?
63
- Aro::P.say(I18n.t("cli.messages.teck_selected", name: teck.name, room: Aro::Mancy::aro_mancy_name))
64
- File.open(File.join(Aro::Db.base_aro_dir, Aro::Teck::TECK_FILE.to_s), "w") do |file|
62
+ Aro::P.say(I18n.t("messages.teck_selected", name: teck.name, room: Aro::Mancy::aro_mancy_name))
63
+ File.open(File.join(Aro::Mancy.root_dir, Aro::Teck::TECK_FILE.to_s), "w") do |file|
65
64
  file.write(teck.id)
66
65
  end
67
66
  end
68
67
 
69
68
  def self.current_teck
70
- Aro::Db.load
71
- if File.exist?(File.join(Aro::Db.base_aro_dir, TECK_FILE.to_s))
72
- current_teck_id = File.read(File.join(Aro::Db.base_aro_dir, TECK_FILE.to_s))
69
+ if File.exist?(File.join(Aro::Mancy.root_dir, TECK_FILE.to_s))
70
+ current_teck_id = File.read(File.join(Aro::Mancy.root_dir, TECK_FILE.to_s))
73
71
  return Aro::Teck.find_by(id: current_teck_id)
74
72
  end
75
73
  end
@@ -92,37 +90,31 @@ class Aro::Teck < ActiveRecord::Base
92
90
  Aro::V.say("order_o: #{order_o}")
93
91
 
94
92
  unless Aro::Tlog::ORDERING.values.include?(order_o)
95
- Aro::P.say(I18n.t("cli.warnings.invalid_order"))
93
+ Aro::P.say(I18n.t("warnings.invalid_order"))
96
94
  order_o = Aro::Tlog::ORDERING[:DESC]
97
95
  end
98
96
 
99
97
  # perform query
100
- Aro::Db.load
101
98
  tlog_records = tlogs.order(created_at: order_o).first(count_n)
102
99
 
103
100
  # todo: this is doing more work than it needs to. needs debugging.
104
101
  # Aro::V.say("tlog_records.count: #{tlog_records.count}")
105
102
 
106
103
  # for now tests just expect count
107
- return tlog_records if Aos::Cor.is_test?
104
+ return tlog_records if Aro::Cor.is_test?
108
105
 
109
- Aro::D.say(I18n.t("cli.messages.showing", name: name, count: count_n, order: order_o))
106
+ Aro::D.say(I18n.t("messages.showing", name: name, count: count_n, order: order_o))
110
107
 
111
- Aos::Vw::Teck.show_game({
112
- teck: self,
113
- tlog_records: tlog_records,
114
- count_n: count_n,
115
- order_o: order_o
116
- })
108
+ Aro::Views::Teck.show
117
109
  end
118
110
 
119
111
  def explore
120
112
  # allows user to browse each card in the current teck.
121
- answer = Aos::S.p.select(
122
- Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
113
+ answer = Aro::P.p.select(
114
+ Aro::Mancy::ps1_display.to_s + I18n.t("messages.choose_card"),
123
115
  # formatted for tty-prompt gem
124
116
  cards.split(Aro::Teck::CARD_DELIM.to_s).map{|c| [I18n.t("cards.#{Aro::Teck.card_strip(c)}.name"), c]}.to_h,
125
- per_page: Aos::Cor.discon[:HEIGHT] - Aro::Mancy::S,
117
+ per_page: TTY::Screen.height - Aro::Mancy::OS,
126
118
  cycle: true,
127
119
  default: Aro::Mancy::S
128
120
  )
@@ -137,9 +129,9 @@ class Aro::Teck < ActiveRecord::Base
137
129
  orientation = "-"
138
130
  end
139
131
 
140
- Aro::P.say(I18n.t("cli.messages.printing_card", card: card_code))
141
- width = Aos::Cor.discon[:WIDTH]
142
- divider = Aos::Cor.discon[:DIVIDER]
132
+ Aro::P.say(I18n.t("messages.printing_card", card: card_code))
133
+ width = Aro::Cor.discon[:WIDTH]
134
+ divider = Aro::Cor.discon[:DIVIDER]
143
135
  card_lookup = Aro::Teck.card_strip(card_code)
144
136
  suit_lookup = card_lookup[Aro::Mancy::O]
145
137
  definition = I18n.t("cards.#{card_lookup}")
@@ -190,7 +182,7 @@ class Aro::Teck < ActiveRecord::Base
190
182
  update(drawn: "", cards: cards_arr.join(Aro::Teck::CARD_DELIM.to_s))
191
183
  end
192
184
 
193
- def draw(is_dt_dimension: true, z_max: 7, z: 1)
185
+ def draw(z_max: 7, z: 1)
194
186
  # the true card
195
187
  abs_dev_tarot = nil
196
188
 
@@ -249,7 +241,6 @@ class Aro::Teck < ActiveRecord::Base
249
241
  # insert dev_tarot to drawn
250
242
  drawn_arr << dev_tarot
251
243
  Aro::Teck.print_card(dev_tarot)
252
- Aro::Db.load
253
244
 
254
245
  # update database
255
246
  update(
data/sys/aro/p.rb CHANGED
@@ -14,10 +14,13 @@ require_relative :"./r".to_s
14
14
  module Aro
15
15
  class P < Aro::Prompt
16
16
  def self.say(message)
17
- if Aro::Mancy.in_aro? && !Aro::T.is_dev_tarot?
18
- Aro::R.say(message)
17
+ if Aro::Dom::Ma_ain.instance.nil? &&
18
+ Aro::Mancy.in_aro? &&
19
+ !Aro::T.is_dev_tarot?
20
+
21
+ Aro::R.say(normalize_message(message))
19
22
  else
20
- super(["#{Aro::Mancy::PS1}#{message}"])
23
+ super("#{Aro::Dom::Ma_ain.ps1_display || Aro::Mancy.ps1_display}#{normalize_message(message)}")
21
24
  end
22
25
  end
23
26
  end
data/sys/aro/r.rb CHANGED
@@ -12,9 +12,8 @@ require_relative :"../shr/prompt".to_s
12
12
 
13
13
  module Aro
14
14
  class R < Aro::Prompt
15
- PS1 = :">[#{Aro::T::RUBY_FACOT}]>:"
16
15
  def self.say(message)
17
- super(["#{Aro::R::PS1} #{message}"])
16
+ super("#{Aro::Mancy.ps1_display(Aro::R.name)} #{normalize_message(message)}")
18
17
  end
19
18
  end
20
19
  end