aro 0.1.9 → 0.2.0

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.
data/sys/cli/config.rb CHANGED
@@ -154,7 +154,6 @@ module CLI
154
154
  def validate_config
155
155
  invalid_vars = []
156
156
  CLI::Config::DEF.each{|k, v|
157
- Aro::V.say(v[:access])
158
157
  is_valid = v[:access] == CLI::Config::DEF_ACCESS[:READ]
159
158
  unless is_valid
160
159
  is_valid = valid_var?(CLI::Config.ivar(k), k, v)
@@ -205,6 +204,18 @@ module CLI
205
204
  value: CLI::Config::BOOLS[:FALSE],
206
205
  description: I18n.t("cli.config.verbose_description"),
207
206
  },
207
+ LOG_AOS_DB: {
208
+ type: CLI::Config::TYPES[:BOOL],
209
+ access: CLI::Config::DEF_ACCESS[:WRITE],
210
+ value: CLI::Config::BOOLS[:FALSE],
211
+ description: I18n.t("cli.config.log_aos_db_description"),
212
+ },
213
+ LOG_ARO_DB: {
214
+ type: CLI::Config::TYPES[:BOOL],
215
+ access: CLI::Config::DEF_ACCESS[:WRITE],
216
+ value: CLI::Config::BOOLS[:FALSE],
217
+ description: I18n.t("cli.config.log_aro_db_description"),
218
+ },
208
219
  FORMAT: { # not implemented yet.
209
220
  type: CLI::Config::TYPES[:VALUES],
210
221
  implemented: false,
@@ -343,12 +354,13 @@ module CLI
343
354
  def initialize
344
355
  @@context = nil
345
356
  if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
346
- @@context = Aro::Mancy.name
357
+ @@context = Aro::Db
347
358
  elsif Aro::Dom.in_arodom? && Aro::Dom.is_initialized?
348
- @@context = Aro::Dom.name
359
+ @@context = Aos::Db
349
360
  end
350
361
 
351
362
  return if @@context.nil?
363
+ Aro::V.say(@@context)
352
364
 
353
365
  unless File.exist?(CLI::Config.config_filepath)
354
366
  generate_config
@@ -358,9 +370,24 @@ module CLI
358
370
  setup_env
359
371
  end
360
372
 
373
+ def self.context
374
+ @@context
375
+ end
376
+
361
377
  def self.config_filepath
362
- db_cls = @@context == Aro::Dom.name ? Aos::Db : Aro::Db
363
- File.join(db_cls.base_aro_dir, CLI::Config::CONFIG_FILE.to_s)
378
+ cfp = nil
379
+ if @@context == Aro::Db &&
380
+ Aro::Dom.in_arodom? &&
381
+ Aro::Dom.is_initialized?
382
+
383
+ # override when in arodome game room
384
+ # this ensures the arodome config is being used
385
+ cfp = File.join(Aos::Db.base_aro_dir, CLI::Config::CONFIG_FILE.to_s)
386
+ else
387
+ cfp = File.join(@@context.base_aro_dir, CLI::Config::CONFIG_FILE.to_s)
388
+ end
389
+
390
+ cfp
364
391
  end
365
392
 
366
393
  def self.is_test?
@@ -368,13 +395,10 @@ module CLI
368
395
  end
369
396
 
370
397
  def self.display_config
371
- # Aro::V.say(__method__)
372
- width = CLI::Config.ivar(:WIDTH).to_i
373
- columns = width.pow(Aro::Mancy::S.to_f / Aro::Mancy::OS.to_f).to_i
398
+ height, width = IO.console.winsize
374
399
  result = {
375
- COLUMNS: columns,
376
- HEIGHT: CLI::Config.ivar(:HEIGHT).to_i,
377
- WIDTH: width,
400
+ HEIGHT: height, #CLI::Config.ivar(:HEIGHT).to_i,
401
+ WIDTH: width - Aro::Mancy::O,
378
402
  DIVIDER: :"_".to_s
379
403
  }
380
404
  # Aro::V.say(result)
@@ -382,6 +406,10 @@ module CLI
382
406
  result
383
407
  end
384
408
 
409
+ def self.is_format_text?
410
+ CLI::Config.ivar(:FORMAT)&.to_sym == CLI::Config::FORMATS[:TEXT]
411
+ end
412
+
385
413
  def self.process_config_command(args)
386
414
  if args[1].nil? || args[1] == :aos.to_s
387
415
  # print config
@@ -418,16 +446,18 @@ module CLI
418
446
  current_value = CLI::Config.ivar(k)
419
447
  # ensure the var name is valid
420
448
  unless current_value.nil?
421
- Aro::V.say("validating #{k} with value #{new_value}")
449
+ Aro::Dom::P.say("validating #{k} with value #{new_value}")
422
450
  if CLI::Config.instance.valid_var?(new_value, k, CLI::Config::DEF[k])
423
451
  # set ENV value
424
452
  ENV[CLI::Config.ivar_k(k)] = new_value
453
+ Aro::Dom::P.say("#{k} set to #{new_value}")
425
454
  Aro::V.say(ENV[CLI::Config.ivar_k(k)])
426
455
 
427
456
  # flush existing config and regen
428
457
  CLI::Config.instance.generate_config(true)
429
458
  CLI::Config.instance.source_config
430
459
  CLI::Config.instance.setup_env
460
+ @@context.configure_logger
431
461
  else
432
462
  Aro::Dom::P.say("the ivar value you entered is invalid. ignoring.")
433
463
  end
data/sys/cli/deck.rb CHANGED
@@ -19,13 +19,22 @@ module CLI
19
19
  exit(CLI::EXIT_CODES[:SUCCESS])
20
20
  elsif action.nil? || action == :aos
21
21
  # no args, open deck menu
22
- Aro::Db.new
23
- Aro::Deck.display_selection_menu
22
+ if Aro::Mancy.in_aro?
23
+ Aro::Db.new
24
+ Aro::Deck.display_selection_menu
25
+ else
26
+ Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
27
+ end
24
28
  elsif action == CLI::CMDS[:DECK][:NEW]
25
29
  CLI::Nterface.exit_error_missing_args! if CLI::ARGV2.nil?
26
- deck = Aro::Deck.make(CLI::ARGV2.to_s)
27
- Aro::P.say(I18n.t("cli.messages.deck_created_sucessfully", name: Aro::Mancy.game.name))
28
- Aro::Deck.display_selection_menu
30
+ if Aro::Mancy.in_aro?
31
+ Aro::Db.new
32
+ deck = Aro::Deck.make(CLI::ARGV2.to_s)
33
+ Aro::P.say(I18n.t("cli.messages.deck_created_sucessfully", name: Aro::Mancy.game.name))
34
+ Aro::Deck.display_selection_menu
35
+ else
36
+ Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
37
+ end
29
38
  elsif CLI::CMDS[:DECK].values.include?(action)
30
39
  if Aro::Mancy.game.nil?
31
40
  Aro::P.say(I18n.t("cli.errors.missing_deck", cmd: Aro::Mancy::I2097I))
data/sys/dom/dom.rb CHANGED
@@ -68,6 +68,8 @@ module Aro
68
68
  end
69
69
 
70
70
  def self.is_initialized?
71
+ return false if !Aro::Dom.in_arodom?
72
+
71
73
  File.exist?(File.join(Aro::Dom::ethergeist_path, Aos::Db::SQL_FILE.to_s))
72
74
  end
73
75
 
@@ -111,6 +113,7 @@ module Aro
111
113
  search_path.any?{|step|
112
114
  search_pwd = File.join(search_pwd, step)
113
115
  ls = Dir.glob("#{search_pwd}/#{ETHER_FILE}", File::FNM_DOTMATCH)
116
+
114
117
  path = ls.first if ls.any?
115
118
  !path.nil?
116
119
  }
@@ -155,7 +158,7 @@ module Aro
155
158
  FileUtils.mkdir(room_path)
156
159
 
157
160
  if wing[:name] == Aro::Dom::GAMES
158
- File.open(File.join(room_path, Aro::Mancy::NAME_FILE.to_s), "w+") do |f|
161
+ File.open(File.join(room_path, Aro::Mancy::NAME_FILE.to_s), "w") do |f|
159
162
  f.write(room[:name])
160
163
  end
161
164
  end
data/sys/models/deck.rb CHANGED
@@ -56,7 +56,8 @@ class Aro::Deck < ActiveRecord::Base
56
56
  exit(CLI::EXIT_CODES[:SUCCESS])
57
57
  end
58
58
 
59
- selection = Aro::P.p.select("choose a deck:") do |menu|
59
+ choose_deck_text = Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_deck")
60
+ selection = Aro::P.p.select(choose_deck_text) do |menu|
60
61
  Aro::Deck.all.each{|d|
61
62
  if d.id == Aro::Deck.current_deck&.id
62
63
  menu.default d.id
@@ -119,15 +120,23 @@ class Aro::Deck < ActiveRecord::Base
119
120
  def explore
120
121
  # allows user to browse each card in the current deck.
121
122
  answer = Aro::P.p.select(
122
- I18n.t("cli.messages.choose_card"),
123
+ Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
123
124
  # formatted for tty-prompt gem
124
125
  cards.split(Aro::Deck::CARD_DELIM.to_s).map{|c| [I18n.t("cards.#{Aro::Deck.card_strip(c)}.name"), c]}.to_h,
125
- per_page: Aro::Mancy::NUMERALS[:VII],
126
+ per_page: CLI::Config.display_config[:HEIGHT] - Aro::Mancy::S,
126
127
  cycle: true,
127
128
  default: Aro::Mancy::S
128
129
  )
129
-
130
- Aro::P.say(I18n.t("cards.#{Aro::Deck.card_strip(answer)}"))
130
+ # {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: ""}
131
+ definition = I18n.t("cards.#{Aro::Deck.card_strip(answer)}")
132
+ indent = Aro::Mancy::N
133
+ Aro::P.say(definition[:name])
134
+ Aro::P.say(definition[:summary])
135
+ Aro::P.say("tags:")
136
+ definition[:tag_list].sort.each{|tl| Aro::P.say("".rjust(indent) + tl)}
137
+ Aro::P.say(definition[:reversed_summary])
138
+ Aro::P.say("reverse tags:")
139
+ definition[:reversed_tag_list].sort.each{|tl| Aro::P.say("".rjust(indent) + tl)}
131
140
  end
132
141
 
133
142
  def shuffle
data/sys/reiquire.rb CHANGED
@@ -13,6 +13,7 @@ require :active_record.to_s
13
13
  require :"active_record/schema_dumper".to_s
14
14
  require :base64.to_s
15
15
  require :fileutils.to_s
16
+ require :"io/console".to_s
16
17
  require :i18n.to_s
17
18
  require :readline.to_s
18
19
  require :"tty-prompt".to_s
data/sys/shr/t.rb CHANGED
@@ -21,14 +21,22 @@ module Aro
21
21
  # read dev_tarot
22
22
  def self.read_dev_tarot
23
23
  dt = nil
24
- if Aro::T.is_dev_tarot? && File.exist?(Aro::T::DEV_TAROT_FILE.to_s)
25
- File.open(Aro::T::DEV_TAROT_FILE.to_s, "r"){|dtf| dt = dtf.read(Aro::Mancy::N)}
26
- # VERY IMPORTANT!
27
- Aro::V.say(I18n.t("cli.very_important", dev_tarot: dt))
28
- else
24
+ if Aro::T.is_dev_tarot?
25
+ if File.exist?(Aro::T::DEV_TAROT_FILE.to_s)
26
+ File.open(Aro::T::DEV_TAROT_FILE.to_s, "r"){|dtf| dt = dtf.read(Aro::Mancy::N)}
27
+ # VERY IMPORTANT!
28
+ Aro::V.say(I18n.t("cli.very_important", dev_tarot: dt))
29
+ else
30
+ Aro::D.say("error: /dev/tarot not installed.")
31
+ end
32
+ end
33
+
34
+ if dt.nil?
35
+ # fallback on ruby_facot
29
36
  Aro::V.say("warning: summoning ruby_facot in #{__method__}")
30
- dt = Aro::T.summon_ruby_facot unless Aro::T.is_dev_tarot?
37
+ dt = Aro::T.summon_ruby_facot
31
38
  end
39
+
32
40
  return dt
33
41
  end
34
42
 
data/sys/shr/version.rb CHANGED
@@ -9,10 +9,6 @@
9
9
  =end
10
10
 
11
11
  module Aro
12
- VERSION = :"0.1.9"
13
- RELEASE_NOTES = :"this version".to_s + [
14
- "adds improved views.",
15
- "adds aro gameplay within an arodome game room.",
16
- "adds ability to set config ivars from aos."
17
- ].join(",")
12
+ VERSION = :"0.2.0"
13
+ RELEASE_NOTES = :"this version".to_s + [].join(",")
18
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - i2097i
@@ -194,6 +194,7 @@ files:
194
194
  - checksums/aro-0.1.7.gem.sha512
195
195
  - checksums/aro-0.1.8.gem.sha512
196
196
  - checksums/aro-0.1.9.gem.sha512
197
+ - checksums/aro-0.2.0.gem.sha512
197
198
  - db/migrate/1763374647_create_decks.rb
198
199
  - db/migrate/1763432541_create_logs.rb
199
200
  - db/migrate/1765148774_create_yous.rb
@@ -270,6 +271,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
271
  requirements: []
271
272
  rubygems_version: 3.6.9
272
273
  specification_version: 4
273
- summary: this versionadds improved views.,adds aro gameplay within an arodome game
274
- room.,adds ability to set config ivars from aos.
274
+ summary: this version
275
275
  test_files: []