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/aos/vws/base.rb CHANGED
@@ -8,8 +8,6 @@
8
8
 
9
9
  =end
10
10
 
11
- require :aro.to_s
12
-
13
11
  module Aos
14
12
  module Vw
15
13
  class Base
@@ -22,44 +20,13 @@ module Aos
22
20
  draw([self.name])
23
21
  end
24
22
 
25
- def self.get_json(lines)
26
- {
27
- body: lines,
28
- you: Aos::Os.instance.you.to_json,
29
- domain: self.get_domain,
30
- clock: self.get_clock,
31
- dimension: self.get_dimension,
32
- dev_tarot: self.get_dt,
33
- }
34
- end
35
-
36
23
  def self.draw(body_lines)
37
- unless Aro::Config.is_format_text?
38
- Aos::S.say(self.get_json(lines))
39
- return true
40
- end
41
-
42
24
  return false unless body_lines.kind_of?(Array)
43
25
  lines = []
44
26
  dc = Aro::Config.display_configuration
45
27
  height = dc[:HEIGHT]
46
28
  width = dc[:WIDTH]
47
29
 
48
- # header
49
- # lines << "".center(width, "=")
50
- # lines << "".center(width)
51
-
52
- # half = ((width - self.name.length) / Aro::Mancy::OS.to_f).ceil
53
- # domain = self.get_domain
54
- # clock = self.get_clock
55
- # lines << (
56
- # (
57
- # domain.ljust(half) + self.name.to_s.upcase
58
- # ).ljust(width - clock.length) + clock
59
- # )
60
-
61
- # lines << "".center(width, dc[:DIVIDER])
62
-
63
30
  # top vertical margin
64
31
  Aos::Vw::Base::MARGIN_V.times do
65
32
  lines << get_body_line("")
@@ -70,15 +37,7 @@ module Aos
70
37
  lines << get_body_line(line)
71
38
  }
72
39
 
73
- lines += get_aos_display_lines
74
-
75
- # footer
76
- # display_dim = self.get_display_dimension
77
- # lines << (
78
- # (
79
- # ">[#{domain}]>#{Aos::Os::osify(Aos::Os.instance.you&.pwd || Dir.pwd)}"
80
- # ).ljust(width - display_dim.length) + display_dim
81
- # )
40
+ lines += get_aos_display_lines if Aro::Dom.in_arodom?
82
41
 
83
42
  # print everything
84
43
  Aos::S.say(lines.join("\n"))
@@ -100,8 +59,8 @@ module Aos
100
59
  }
101
60
  lines << "".center(width)
102
61
  lines << "v#{Aro::VERSION.to_s}".ljust(width - display_dim.length) + display_dim
103
- # lines << "".center(width, "=")
104
62
  end
63
+
105
64
  lines
106
65
  end
107
66
 
@@ -144,21 +103,13 @@ module Aos
144
103
 
145
104
  def self.lines_for_cmd(cmd)
146
105
  just_cmds = Aro::Mancy::NUMERALS[:IX]
147
- cmd_lines = []
148
- key_proc = Proc.new{|k| "$ #{k}"}
149
- desc_proc = Proc.new{|desc| "#{"desc:".rjust(just_cmds)} #{desc}"}
150
- usage_proc = Proc.new{|usage| "#{"usage:".rjust(just_cmds)} #{usage}"}
151
-
152
- cmd_lines << key_proc.call(cmd[:key])
153
- cmd_lines << desc_proc.call(cmd[:description])
154
- cmd_lines << usage_proc.call(cmd[:usage])
155
- (cmd[:cmds] || []).each{|k, v|
156
- cmd_lines << key_proc.call("#{cmd[:key]} #{v[:key]}")
157
- cmd_lines << desc_proc.call(v[:description])
158
- cmd_lines << usage_proc.call(v[:usage])
159
- }
160
-
161
- cmd_lines
106
+ lines = []
107
+ lines << "\"#{cmd[:key]}\""
108
+ lines << " => #{cmd[:description]}"
109
+ lines << ""
110
+ lines << "#{" ".rjust(just_cmds)} #{cmd[:usage]}"
111
+ lines << ""
112
+ lines
162
113
  end
163
114
 
164
115
  def self.debug_log(lines)
data/sys/aos/vws/dom.rb CHANGED
@@ -13,7 +13,6 @@ require_relative :"./base".to_s
13
13
  module Aos
14
14
  module Vw
15
15
  class Dom < Aos::Vw::Base
16
-
17
16
  def self.show
18
17
  lines = []
19
18
  lines << I18n.t("aos.views.dom.title")
@@ -8,7 +8,7 @@
8
8
 
9
9
  =end
10
10
 
11
- require_relative :"../../../models/deck".to_s
11
+ require_relative :"../../../aro/models/teck".to_s
12
12
  require_relative :"../base".to_s
13
13
 
14
14
  module Aos
@@ -16,8 +16,8 @@ module Aos
16
16
  class Game < Aos::Vw::Base
17
17
 
18
18
  DECK_PARAMS = [
19
- :deck,
20
- :h_logs,
19
+ :teck,
20
+ :tlog_records,
21
21
  :count_n,
22
22
  :order_o,
23
23
  ]
@@ -49,8 +49,8 @@ module Aos
49
49
  return nil unless (mk & dp).count == dp.count
50
50
  return nil unless model.values.all?{|v| v != nil}
51
51
 
52
- deck = model[:deck]
53
- h_logs = model[:h_logs]
52
+ teck = model[:teck]
53
+ tlog_records = model[:tlog_records]
54
54
  count_n = model[:count_n]
55
55
  order_o = model[:order_o]
56
56
 
@@ -59,22 +59,22 @@ module Aos
59
59
  divider = dc[:DIVIDER] * width
60
60
  lines = []
61
61
  lines << divider
62
- lines << "#{deck.name.upcase.center(width)}"
63
- h_logs.each_with_index{|l, i|
62
+ lines << "#{teck.name.upcase.center(width)}"
63
+ tlog_records.each_with_index{|l, i|
64
64
  lines << divider
65
65
  lines << ""
66
66
  timestamp = l.created_at.strftime(Aro::Config::DATE_FORMAT)
67
- of_text = "#{order_o.to_sym == Aro::Log::ORDERING[:DESC] ? deck.logs.count - i : 1 + i} of #{deck.logs.count}"
67
+ of_text = "#{order_o.to_sym == Aro::Tlog::ORDERING[:DESC] ? teck.tlogs.count - i : 1 + i} of #{teck.tlogs.count}"
68
68
  lines << of_text.ljust(width - timestamp.length) + timestamp
69
69
  lines << divider
70
- cards = Base64::decode64(l.card_data).split(Aro::Deck::CARD_DELIM.to_s)
70
+ cards = Base64::decode64(l.card_data).split(Aro::Teck::CARD_DELIM.to_s)
71
71
  if !cards.nil? && cards.any?
72
72
  # lines << ""
73
73
  lines += self.get_display_for_cards(cards)
74
74
  # lines << divider
75
75
  end
76
76
 
77
- drawn_cards = Base64::decode64(l.drawn_data).split(Aro::Deck::CARD_DELIM.to_s)
77
+ drawn_cards = Base64::decode64(l.drawn_data).split(Aro::Teck::CARD_DELIM.to_s)
78
78
  if !drawn_cards.nil? && drawn_cards.any?
79
79
  lines << ""
80
80
  lines << I18n.t("cli.messages.history_drawn").center(width)
@@ -1,8 +1,8 @@
1
1
  =begin
2
2
 
3
- vws/know/temple.rb
3
+ vws/know/body.rb
4
4
 
5
- the temple view.
5
+ the body view.
6
6
 
7
7
  by i2097i
8
8
 
@@ -12,7 +12,7 @@ require_relative :"../base".to_s
12
12
 
13
13
  module Aos
14
14
  module Vw
15
- class Temple < Aos::Vw::Base
15
+ class Body < Aos::Vw::Base
16
16
 
17
17
  end
18
18
  end
@@ -1,8 +1,8 @@
1
1
  =begin
2
2
 
3
- vws/know/library.rb
3
+ vws/know/mind.rb
4
4
 
5
- the library view.
5
+ the mind view.
6
6
 
7
7
  by i2097i
8
8
 
@@ -12,7 +12,7 @@ require_relative :"../base".to_s
12
12
 
13
13
  module Aos
14
14
  module Vw
15
- class Library < Aos::Vw::Base
15
+ class Mind < Aos::Vw::Base
16
16
 
17
17
  end
18
18
  end
@@ -0,0 +1,19 @@
1
+ =begin
2
+
3
+ vws/know/spirit.rb
4
+
5
+ the spirit view.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require_relative :"../base".to_s
12
+
13
+ module Aos
14
+ module Vw
15
+ class Spirit < Aos::Vw::Base
16
+
17
+ end
18
+ end
19
+ end
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
 
3
- vws/setup/amg.rb
3
+ vws/root/amg.rb
4
4
 
5
5
  the amg view.
6
6
 
@@ -14,7 +14,6 @@ module Aos
14
14
  module Vw
15
15
  class Amg < Aos::Vw::Base
16
16
  def self.show
17
- # draw output
18
17
  draw(Aos::Amg.instance.display_lines)
19
18
  end
20
19
  end
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
 
3
- vws/setup/config.rb
3
+ vws/root/config.rb
4
4
 
5
5
  the config view.
6
6
 
@@ -0,0 +1,21 @@
1
+ =begin
2
+
3
+ vws/root/data.rb
4
+
5
+ the data view.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require_relative :"../base".to_s
12
+
13
+ module Aos
14
+ module Vw
15
+ class Data < Aos::Vw::Base
16
+ def self.show
17
+ draw(Aos::Data.instance.display_lines)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,8 +1,8 @@
1
1
  =begin
2
2
 
3
- vws/setup.rb
3
+ vws/root.rb
4
4
 
5
- the setup view.
5
+ the root view.
6
6
 
7
7
  by i2097i
8
8
 
@@ -12,7 +12,7 @@ require_relative :"./base".to_s
12
12
 
13
13
  module Aos
14
14
  module Vw
15
- class Setup < Aos::Vw::Base
15
+ class Root < Aos::Vw::Base
16
16
 
17
17
  end
18
18
  end
@@ -18,6 +18,7 @@ module Aos
18
18
  lines = []
19
19
  lines << ""
20
20
  lines << I18n.t("aos.constants.commands")
21
+ lines << ""
21
22
  Aos::Os::CMDS.values.each{|v|
22
23
  lines += lines_for_cmd(v)
23
24
  }
@@ -13,7 +13,18 @@ require_relative :"./base".to_s
13
13
  module Aos
14
14
  module Vw
15
15
  class Welcome < Aos::Vw::Base
16
+ def self.show
17
+ lines = []
16
18
 
19
+ dc = Aro::Config.display_configuration
20
+ height = dc[:HEIGHT]
21
+ width = dc[:WIDTH]
22
+
23
+
24
+ lines << "welcome to #{Aro::Dom.ethergeist_name}".center(width)
25
+ lines <<
26
+ draw(lines)
27
+ end
17
28
  end
18
29
  end
19
30
  end
@@ -1,7 +1,7 @@
1
- class CreateDecks < ActiveRecord::Migration[8.1]
1
+ class CreateTecks < ActiveRecord::Migration[8.1]
2
2
 
3
3
  def self.up
4
- create_table :decks do |t|
4
+ create_table :tecks do |t|
5
5
  t.string :name
6
6
  t.string :cards, null: false, default: ""
7
7
  t.string :drawn, null: false, default: ""
@@ -9,12 +9,12 @@ class CreateDecks < ActiveRecord::Migration[8.1]
9
9
  t.timestamps
10
10
  end
11
11
 
12
- add_index :decks, :name, unique: true
12
+ add_index :tecks, :name, unique: true
13
13
  end
14
14
 
15
15
  def self.down
16
- remove_index :decks, :name
17
- drop_table :decks
16
+ remove_index :tecks, :name
17
+ drop_table :tecks
18
18
  end
19
19
 
20
20
  end
@@ -0,0 +1,20 @@
1
+ class CreateTlogs < ActiveRecord::Migration[8.1]
2
+
3
+ def self.up
4
+ create_table :tlogs do |t|
5
+ t.string :card_data
6
+ t.string :drawn_data
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ add_column :tlogs, :teck_id, :integer
12
+ add_index :tlogs, :teck_id
13
+ end
14
+
15
+ def self.down
16
+ remove_index :tlogs, :teck_id
17
+ drop_table :tlogs
18
+ end
19
+
20
+ end
data/sys/aro/db.rb CHANGED
@@ -10,16 +10,18 @@
10
10
 
11
11
  module Aro
12
12
  class Db
13
+ include Singleton
14
+
13
15
  DATABASE_YML = :"database.yml"
14
16
  GEM_DB_PATH = :"sys/aro/db"
15
17
  MIGRATIONS_DIR = :"db/migrate"
16
18
  SCHEMA_FILE = :"schema.rb"
17
- SQL_FILE = :"database.sql"
19
+ SQL_FILE = :"aro.sql"
18
20
 
19
- def initialize
21
+ def self.load
20
22
  Aro::Db.configure_logger
21
23
  if Aro::Mancy.in_aro?
22
- setup_local_aro
24
+ self.instance.setup_local_aro
23
25
  end
24
26
  end
25
27
 
@@ -31,14 +33,6 @@ module Aro
31
33
  end
32
34
  end
33
35
 
34
- def connect(name)
35
- ActiveRecord::Base.establish_connection(config)
36
- end
37
-
38
- def config
39
- @config ||= YAML.load_file(db_config_filepath)
40
- end
41
-
42
36
  def self.base_aro_dir
43
37
  base_aro_file = Aro::Mancy::ARO_FILE.to_s
44
38
  Aro::Config.is_test? ? "#{base_aro_file}_test" : base_aro_file
@@ -74,6 +68,12 @@ module Aro
74
68
  migrate(name)
75
69
  end
76
70
 
71
+ def connect(name)
72
+ ActiveRecord::Base.establish_connection(
73
+ YAML.load_file(db_config_filepath)
74
+ )
75
+ end
76
+
77
77
  def migrate(name)
78
78
  local_migrate_dir = File.join(Aro::Db.base_aro_dir, Aro::Db::MIGRATIONS_DIR.to_s)
79
79
  unless Dir.exist?(local_migrate_dir)
data/sys/aro/mancy.rb CHANGED
@@ -60,10 +60,10 @@ module Aro
60
60
  }
61
61
 
62
62
  def initialize
63
- Aro::Config.instance.load
64
63
  if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
64
+ Aro::Config.instance.load
65
65
  Aro::Mancy.init
66
- self.game = Aro::Deck.current_deck
66
+ self.game = Aro::Teck.current_teck
67
67
  end
68
68
  end
69
69
 
@@ -80,7 +80,7 @@ module Aro
80
80
 
81
81
  # create the new aro directory and database
82
82
  if !Dir.exist?(name)
83
- Aro::P.say(I18n.t("cli.messages.no_decks"))
83
+ Aro::P.say(I18n.t("cli.messages.no_tecks"))
84
84
  FileUtils.mkdir(name)
85
85
  else
86
86
  return false
@@ -98,7 +98,7 @@ module Aro
98
98
  end
99
99
 
100
100
  def self.init
101
- Aro::Db.new
101
+ Aro::Db.load
102
102
  end
103
103
 
104
104
  def self.is_initialized?