aro 0.2.3 → 0.2.5

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +101 -42
  3. data/LICENSE +1 -1
  4. data/README.md +1 -1
  5. data/aro.gemspec +10 -10
  6. data/bin/aro +8 -12
  7. data/bin/ino +22 -0
  8. data/checksums/aro-0.2.4.gem.sha512 +1 -0
  9. data/ino_rules_todo.txt +28 -0
  10. data/locale/en.abot.yml +15 -15
  11. data/locale/en.amg.yml +7 -7
  12. data/locale/en.aos.yml +7 -7
  13. data/locale/en.cards.yml +360 -313
  14. data/locale/en.data.yml +1 -1
  15. data/locale/en.dom.yml +3 -2
  16. data/locale/en.flie.yml +1 -1
  17. data/locale/en.ino.yml +9 -0
  18. data/locale/en.usage.yml +152 -69
  19. data/locale/en.yml +5 -3
  20. data/sys/aos/abot.rb +18 -20
  21. data/sys/aos/aos.rb +60 -48
  22. data/sys/aos/cor.rb +11 -14
  23. data/sys/aos/db.rb +1 -3
  24. data/sys/aos/models/agodo.rb +9 -2
  25. data/sys/aos/models/fpxy.rb +0 -2
  26. data/sys/aos/models/ilib.rb +0 -2
  27. data/sys/aos/models/ilog.rb +0 -2
  28. data/sys/aos/models/you.rb +46 -6
  29. data/sys/aos/vws/base.rb +13 -14
  30. data/sys/aos/vws/games/ino.rb +21 -0
  31. data/sys/aos/vws/games/teck.rb +19 -17
  32. data/sys/aos/vws/welcome.rb +1 -1
  33. data/sys/aro/db/migrate/1768856981_create_scrolls.rb +20 -0
  34. data/sys/aro/db/migrate/1768858841_create_legends.rb +16 -0
  35. data/sys/aro/db/migrate/1768858967_create_stories.rb +17 -0
  36. data/sys/aro/db/migrate/1768859060_create_chapters.rb +15 -0
  37. data/sys/aro/db/migrate/1768859126_create_statements.rb +22 -0
  38. data/sys/aro/db/migrate/1768859144_create_players.rb +18 -0
  39. data/sys/aro/db.rb +3 -5
  40. data/sys/aro/ino.rb +64 -0
  41. data/sys/aro/models/chapter.rb +18 -0
  42. data/sys/aro/models/legend.rb +28 -0
  43. data/sys/aro/models/player.rb +17 -0
  44. data/sys/aro/models/scroll.rb +46 -0
  45. data/sys/aro/models/statement.rb +14 -0
  46. data/sys/aro/models/story.rb +28 -0
  47. data/sys/aro/models/teck.rb +44 -13
  48. data/sys/cli/create.rb +1 -1
  49. data/sys/cli/dom.rb +2 -2
  50. data/sys/cli/nterface.rb +15 -9
  51. data/sys/cli/teck.rb +4 -6
  52. data/sys/cli/usage.rb +15 -1
  53. data/sys/dom/dom.rb +6 -2
  54. data/sys/fpx.rb +25 -37
  55. data/sys/shr/ilib/crs/crs.o +0 -0
  56. data/sys/shr/ilib/crs/libcrs.so +0 -0
  57. data/sys/shr/t.rb +2 -2
  58. data/sys/shr/version.rb +1 -1
  59. metadata +38 -22
  60. data/.ruby-version +0 -1
  61. data/sys/aos/models/base_model.rb +0 -13
  62. data/sys/aro/models/base_model.rb +0 -13
@@ -0,0 +1,17 @@
1
+ =begin
2
+
3
+ player.rb
4
+
5
+ player object.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ # require_relative :scroll.to_s
12
+ # require_relative :statement.to_s
13
+
14
+ class Aro::Player < ActiveRecord::Base
15
+ has_many :statements
16
+ belongs_to :scroll
17
+ end
@@ -0,0 +1,46 @@
1
+ =begin
2
+
3
+ scroll.rb
4
+
5
+ scroll object.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::Scroll < ActiveRecord::Base
12
+
13
+ HISTORY_FILE = :".ino_history"
14
+
15
+ has_many :players
16
+ belongs_to :legend
17
+ belongs_to :player
18
+
19
+ before_create :create_history_file, :create_legend
20
+
21
+ def history_file
22
+ File.join(Aro::Db.base_aro_dir, Aro::Scroll::HISTORY_FILE.to_s)
23
+ end
24
+
25
+ def history
26
+ File.read(history_file).split("\n").compact
27
+ end
28
+
29
+ def add_history(entry)
30
+ return if entry.nil? || entry.to_s.empty?
31
+ File.open(history_file, "a+") do |ino_history|
32
+ ino_history.write(entry)
33
+ ino_history.write("\n")
34
+ end
35
+ end
36
+
37
+ private
38
+
39
+ def create_legend
40
+ self.legend = Aro::Legend.create()
41
+ end
42
+
43
+ def create_history_file
44
+ File.open(history_file, "w+")
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ =begin
2
+
3
+ statement.rb
4
+
5
+ statement object.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::Statement < ActiveRecord::Base
12
+ belongs_to :player
13
+ belongs_to :chapter
14
+ end
@@ -0,0 +1,28 @@
1
+ =begin
2
+
3
+ story.rb
4
+
5
+ story object.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require_relative :"./legend".to_s
12
+ require_relative :"./chapter".to_s
13
+ require_relative :"./player".to_s
14
+
15
+ class Aro::Story < ActiveRecord::Base
16
+ has_many :chapters
17
+ belongs_to :legend
18
+ belongs_to :chapter, class_name: Aro::Chapter.name
19
+ # belongs_to :dealer, class_name: Aro::Player.name
20
+
21
+ after_create :create_chapter
22
+
23
+ private
24
+
25
+ def create_chapter
26
+ self.chapter = Aro::Chapter.create()
27
+ end
28
+ end
@@ -9,7 +9,6 @@
9
9
  =end
10
10
 
11
11
  require :base64.to_s
12
- require_relative :"./base_model".to_s
13
12
 
14
13
  class Aro::Teck < ActiveRecord::Base
15
14
  has_many :tlogs
@@ -48,6 +47,7 @@ class Aro::Teck < ActiveRecord::Base
48
47
  end
49
48
 
50
49
  def self.display_selection_menu
50
+ Aro::Db.load
51
51
  unless Aro::Teck.any?
52
52
  Aro::P.say(I18n.t("cli.messages.no_tecks"))
53
53
  exit(CLI::EXIT_CODES[:SUCCESS])
@@ -97,6 +97,7 @@ class Aro::Teck < ActiveRecord::Base
97
97
  end
98
98
 
99
99
  # perform query
100
+ Aro::Db.load
100
101
  tlog_records = tlogs.order(created_at: order_o).first(count_n)
101
102
 
102
103
  # todo: this is doing more work than it needs to. needs debugging.
@@ -121,20 +122,48 @@ class Aro::Teck < ActiveRecord::Base
121
122
  Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
122
123
  # formatted for tty-prompt gem
123
124
  cards.split(Aro::Teck::CARD_DELIM.to_s).map{|c| [I18n.t("cards.#{Aro::Teck.card_strip(c)}.name"), c]}.to_h,
124
- per_page: Aos::Cor.display_configuration[:HEIGHT] - Aro::Mancy::S,
125
+ per_page: Aos::Cor.discon[:HEIGHT] - Aro::Mancy::S,
125
126
  cycle: true,
126
127
  default: Aro::Mancy::S
127
128
  )
128
- # {name: "four of swords", tag_list: ["lord of rest from strife", "libra", "jupiter", "introspection", "recuperation", "regain strength", "rest", "solitude", "stability"], reversed_tag_list: ["lord of rest from strife", "libra", "jupiter", "burnt out", "inundated", "need a break", "overwhelmed"], summary: "", reversed_summary: ""}
129
- definition = I18n.t("cards.#{Aro::Teck.card_strip(answer)}")
130
- indent = Aro::Mancy::N
131
- Aro::P.say(definition[:name])
132
- Aro::P.say(definition[:summary])
133
- Aro::P.say("tags:")
134
- definition[:tag_list].sort.each{|tl| Aro::P.say("".rjust(indent) + tl)}
135
- Aro::P.say(definition[:reversed_summary])
136
- Aro::P.say("reverse tags:")
137
- definition[:reversed_tag_list].sort.each{|tl| Aro::P.say("".rjust(indent) + tl)}
129
+
130
+ Aro::Teck.print_card(answer)
131
+ end
132
+
133
+ def self.print_card(card_code)
134
+ card_code = card_code.to_s.upcase
135
+ orientation = "+"
136
+ if card_code.include?("-")
137
+ orientation = "-"
138
+ end
139
+
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]
143
+ card_lookup = Aro::Teck.card_strip(card_code)
144
+ suit_lookup = card_lookup[Aro::Mancy::O]
145
+ definition = I18n.t("cards.#{card_lookup}")
146
+ suit_definition = I18n.t("suits.#{suit_lookup}")
147
+ output = []
148
+ output << "".ljust(width, divider)
149
+ output << ""
150
+ output << "(#{orientation}) #{definition[:name].upcase}"
151
+ output << ""
152
+ unless suit_definition.nil?
153
+ suit_definition[:summary].split(".").each{|sentence| output << sentence + ".\n"}
154
+ output << suit_definition[:tags].sort.join(" | ")
155
+ end
156
+ output << "".ljust(width, divider)
157
+ output << ""
158
+ card_tags = definition["#{orientation}tags".to_sym].sort
159
+ max_word = card_tags.max_by{|t| t.length}.length
160
+ card_tags.each{|t|
161
+ output << t.center(max_word)
162
+ }
163
+ # todo: add an actual summary
164
+ # Aro::P.say(definition["#{orientation}summary".to_sym])
165
+ output << "".ljust(width, divider)
166
+ Aro::P.say("#{card_code}\n#{output.map{|l| l.center(width)}.join("\n")}")
138
167
  end
139
168
 
140
169
  def shuffle
@@ -185,7 +214,7 @@ class Aro::Teck < ActiveRecord::Base
185
214
  # find a card that is not already drawn
186
215
  while sleeps <= sleeps_max && dev_tarot.nil? do
187
216
  # use fallback randomness if /dev/tarot unavailable
188
- if !is_dt_dimension || !File.exist?(Aro::T::DEV_TAROT_FILE.to_s)
217
+ unless Aro::T.is_dev_tarot? && Aro::T.is_dev_tarot_avail?
189
218
  dev_tarot = Aro::T.summon_ruby_facot.split("")
190
219
  else
191
220
  # preferred randomness
@@ -219,6 +248,8 @@ class Aro::Teck < ActiveRecord::Base
219
248
 
220
249
  # insert dev_tarot to drawn
221
250
  drawn_arr << dev_tarot
251
+ Aro::Teck.print_card(dev_tarot)
252
+ Aro::Db.load
222
253
 
223
254
  # update database
224
255
  update(
data/sys/cli/create.rb CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  module CLI
12
12
  def self.create
13
- CLI::Nterface.exit_error_missing_args! if CLI::ARGV1.nil?
13
+ CLI::Nterface.exit_error_missing_args!(:var_aro_name) if CLI::ARGV1.nil?
14
14
 
15
15
  name = CLI::ARGV1&.to_s
16
16
  Aro::P.say(I18n.t("cli.messages.creation_attempt", name: name))
data/sys/cli/dom.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  module CLI
12
12
  def self.dom
13
13
  if CLI::FLAGS[:HELP].include?(CLI::ARGV1)
14
- CLI.usage::usage
14
+ CLI.usage_dom
15
15
  exit(CLI::EXIT_CODES[:SUCCESS])
16
16
  end
17
17
 
@@ -30,7 +30,7 @@ module CLI
30
30
  CLI::Nterface.exit_error_invalid_usage!
31
31
  end
32
32
  when CLI::CMDS[:DOM][:NEW]
33
- CLI::Nterface.exit_error_missing_args! if CLI::ARGV2.nil?
33
+ CLI::Nterface.exit_error_missing_args!(:var_dom_name) if CLI::ARGV2.nil?
34
34
  if Aro::Dom.in_arodom?
35
35
  Aro::P.say(I18n.t("dom.errors.failed_already_in_arodom"))
36
36
  elsif Aro::Mancy.in_aro?
data/sys/cli/nterface.rb CHANGED
@@ -10,22 +10,28 @@
10
10
 
11
11
  module CLI
12
12
  class Nterface
13
- def self.exit_error_missing_args!
14
- Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy::I2097I))
15
- Aro::P.say(I18n.t("cli.errors.missing_args", cmd: Aro::Mancy::I2097I))
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))
16
16
  exit(CLI::EXIT_CODES[:INVALID_ARG])
17
17
  end
18
18
 
19
- def self.exit_error_invalid_usage!
20
- Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy::I2097I))
21
- Aro::P.say(I18n.t("cli.errors.invalid_usage", cmd: Aro::Mancy::I2097I))
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))
22
22
  exit(CLI::EXIT_CODES[:INVALID_ARG])
23
23
  end
24
24
 
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))
28
+ exit(CLI::EXIT_CODES[:GENERAL_ERROR])
29
+ end
30
+
25
31
  def self.exit_error_not_initialized!
26
- Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy::I2097I))
27
- Aro::P.say(I18n.t("cli.errors.not_initialized", cmd: Aro::Mancy::I2097I))
28
- exit(CLI::EXIT_CODES[:INVALID_ARG])
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))
34
+ exit(CLI::EXIT_CODES[:GENERAL_ERROR])
29
35
  end
30
36
  end
31
37
  end
data/sys/cli/teck.rb CHANGED
@@ -12,10 +12,8 @@ module CLI
12
12
  def self.teck
13
13
  Aro::Mancy.init
14
14
  action = CLI::ARGV1&.to_sym
15
-
16
- if CLI::FLAGS[:HELP].include?(action.to_s)
17
- # todo: breakout usage into subcommand-specific verbiage
18
- CLI.usage::usage
15
+ if CLI::FLAGS[:HELP].include?(action)
16
+ CLI.usage_teck
19
17
  exit(CLI::EXIT_CODES[:SUCCESS])
20
18
  elsif action.nil? || action == :aos
21
19
  # no args, open teck menu
@@ -25,7 +23,7 @@ module CLI
25
23
  Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
26
24
  end
27
25
  elsif action == CLI::CMDS[:TECK][:NEW]
28
- CLI::Nterface.exit_error_missing_args! if CLI::ARGV2.nil?
26
+ CLI::Nterface.exit_error_missing_args!(:var_teck_name) if CLI::ARGV2.nil?
29
27
  if Aro::Mancy.in_aro?
30
28
  teck = Aro::Teck.make(CLI::ARGV2.to_s)
31
29
  Aro::P.say(I18n.t("cli.messages.teck_created_sucessfully", name: teck.name))
@@ -47,6 +45,7 @@ module CLI
47
45
  Aro::P.say(I18n.t("cli.messages.shuffling", name: Aro::Mancy.teck.name))
48
46
  Aro::Mancy.teck.shuffle
49
47
  when CLI::CMDS[:TECK][:DRAW]
48
+ Aos::Cor.instance.load
50
49
  Aro::P.say(I18n.t("cli.messages.drawing", name: Aro::Mancy.teck.name))
51
50
  Aro::P.say(I18n.t("cli.messages.drawing_from_dimension", dimension: "#{Aos::Cor.ivar(:DIMENSION)}"))
52
51
  Aro::Mancy.teck.draw(
@@ -59,7 +58,6 @@ module CLI
59
58
  Aro::Mancy.teck.replace
60
59
  when CLI::CMDS[:TECK][:RESET]
61
60
  Aro::P.say("#{I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.teck.name)}")
62
- Aro::P.say("\n")
63
61
  if Aro::Mancy::YES.to_s != Aos::S.p.ask("\n#{Aro::Mancy::PS1}$")
64
62
  Aro::P.say(I18n.t("cli.messages.understood", name: Aro::Mancy.teck.name))
65
63
  exit(CLI::EXIT_CODES[:SUCCESS])
data/sys/cli/usage.rb CHANGED
@@ -9,7 +9,21 @@
9
9
  =end
10
10
 
11
11
  module CLI
12
- def self.usage
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
+ def self.usage_main
13
22
  Aro::P.less(I18n.t("usage.main"))
14
23
  end
24
+
25
+ def self.usage_teck
26
+ Aro::P.less(I18n.t("usage.teck"))
27
+ end
28
+
15
29
  end
data/sys/dom/dom.rb CHANGED
@@ -115,7 +115,6 @@ module Aro
115
115
  end
116
116
  }
117
117
  found_space = nil if found_room.nil?
118
-
119
118
  [found_space, found_room].compact.join("/")
120
119
  end
121
120
 
@@ -207,5 +206,10 @@ module Aro
207
206
  end
208
207
  end
209
208
  end
209
+
210
+ def generate_agodo_home(agodo)
211
+ Aro::Dom::P.say(I18n.t("dom.messages.generating_agodo_home", name: agodo.you.name))
212
+ FileUtils.mkdir_r(agodo.home)
213
+ end
210
214
  end
211
- end # aroadhome
215
+ end
data/sys/fpx.rb CHANGED
@@ -13,15 +13,6 @@ require :sinatra.to_s
13
13
 
14
14
  module Aos
15
15
  module Fpx
16
- def self.read_you(you_name)
17
- url = URI.parse(File.join(Aos::Fpx::Server::URL, :"you/#{you_name}".to_s))
18
- req = Net::HTTP::Get.new(url.to_s)
19
- res = Net::HTTP.start(url.host, url.port) {|http|
20
- http.request(req)
21
- }
22
- res.body
23
- end
24
-
25
16
  class Server < Sinatra::Base
26
17
  PORT = 7474
27
18
  HOST = :localhost
@@ -29,54 +20,51 @@ module Aos
29
20
  URL = :"http://#{Aos::Fpx::Server::HOST}:#{Aos::Fpx::Server::PORT}/".to_s
30
21
  TIMEOUT = Aro::Mancy::NUMERALS[:VI] * Aro::Mancy::NUMERALS[:X]
31
22
 
32
- def self.serve_pid_file
33
- return "" if Aro::Dom.dom_root.nil? || Aro::Dom.room_path(:abot).nil?
23
+ def self.log_filepath
24
+ File.join(
25
+ Aro::Dom.dom_root,
26
+ Aro::Dom.room_path(:flie),
27
+ "fpx.log"
28
+ )
29
+ end
30
+
31
+ def self.server_pid_file
32
+ return "" if Aro::Dom.dom_root.nil? || Aro::Dom.room_path(:flie).nil?
34
33
  File.join(Aro::Dom.dom_root, Aro::Dom.room_path(:flie), "fpx.pid")
35
34
  end
36
35
 
37
- # def self.log_file
38
- # File.new(
39
- # File.join(
40
- # Aro::Dom.dom_root,
41
- # Aro::Dom.room_path(:flie),
42
- # "fpx.log"
43
- # ),
44
- # "a+"
45
- # )
46
- # end
47
36
 
48
37
  def self.start
49
- return if File.exist?(Aos::Fpx::Server.serve_pid_file)
38
+ return if File.exist?(Aos::Fpx::Server.server_pid_file)
50
39
 
51
40
  serve_pid = fork {Aos::Fpx::Server.run!}
52
41
  Process.detach(serve_pid)
53
- File.open(Aos::Fpx::Server.serve_pid_file, "w") do |f|
42
+ File.open(Aos::Fpx::Server.server_pid_file, "w") do |f|
54
43
  f.write(serve_pid)
55
44
  end
56
45
  end
57
46
 
58
47
  def self.stop
59
- if File.exist?(Aos::Fpx::Server.serve_pid_file)
60
- system("kill -9 #{File.read(Aos::Fpx::Server.serve_pid_file)}")
61
- FileUtils.rm(Aos::Fpx::Server.serve_pid_file)
48
+ if File.exist?(Aos::Fpx::Server.server_pid_file)
49
+ system("kill -9 #{File.read(Aos::Fpx::Server.server_pid_file)}")
50
+ FileUtils.rm(Aos::Fpx::Server.server_pid_file)
62
51
  end
63
52
  end
64
53
 
54
+ # todo: make this work
55
+ # aos fpx -h localhost -p 7474 -t 60 -l root/flie/fpx.log --flie localhost:3000
56
+
65
57
  set :port, Aos::Fpx::Server::PORT
66
58
  # set :bind, "0.0.0.0"
67
59
  set :server_settings, timeout: Aos::Fpx::Server::TIMEOUT
68
60
 
69
- # configure do
70
- # enable :logging
71
- # file = Aos::Fpx::Server.log_file
72
- # file.sync = true
73
- # use Rack::CommonLogger, file
74
- # set :logging, Logger::DEBUG
75
- # end
76
-
77
- # after do
78
- # ActiveRecord::Base.clear_active_connections!
79
- # end
61
+ configure do
62
+ enable :logging
63
+ file = File.new(Aos::Fpx::Server.log_filepath, "w+")
64
+ file.sync = true
65
+ use Rack::CommonLogger, file
66
+ set :logging, Logger::DEBUG
67
+ end
80
68
 
81
69
  use Rack::Cors do |config|
82
70
  config.allow do |allow|
Binary file
Binary file
data/sys/shr/t.rb CHANGED
@@ -52,7 +52,7 @@ module Aro
52
52
  # get orientation
53
53
  rf = ["+","-"].sample
54
54
 
55
- # get suite
55
+ # get suit
56
56
  rf += ruby_facot[1]
57
57
 
58
58
  # calculate the sym
@@ -60,7 +60,7 @@ module Aro
60
60
  # loops through the characters in ruby_facot
61
61
  # return all characters not matching:
62
62
  # => character[0]: orientation
63
- # => character[1]: suite
63
+ # => character[1]: suit
64
64
 
65
65
  # the first two characters in the dev_tarot format designate the
66
66
  !ruby_facot.first(Aro::Mancy::OS).include?(c)
data/sys/shr/version.rb CHANGED
@@ -9,6 +9,6 @@
9
9
  =end
10
10
 
11
11
  module Aro
12
- VERSION = :"0.2.3"
12
+ VERSION = :"0.2.5"
13
13
  RELEASE_NOTES = :"this version".to_s + [].join(",")
14
14
  end