aro 0.1.8 → 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.
- checksums.yaml +4 -4
- data/bin/aos +8 -3
- data/bin/aro +5 -2
- data/checksums/aro-0.1.9.gem.sha512 +1 -0
- data/checksums/aro-0.2.0.gem.sha512 +1 -0
- data/db/migrate/1763374647_create_decks.rb +2 -2
- data/listen.rb +1 -1
- data/locale/en.aos.yml +5 -1
- data/locale/en.cards.yml +156 -156
- data/locale/en.cngelog.yml +1 -1
- data/locale/en.dom.yml +42 -0
- data/locale/en.usage.yml +15 -10
- data/locale/en.yml +12 -15
- data/sys/aos/aos.rb +249 -114
- data/sys/aos/db.rb +13 -6
- data/sys/aos/views/base.rb +72 -45
- data/sys/aos/views/dom.rb +1 -10
- data/sys/aos/views/games/game.rb +92 -0
- data/sys/aos/views/setup/settings.rb +3 -16
- data/sys/aos/you.rb +4 -0
- data/sys/aro/db.rb +12 -7
- data/sys/aro/mancy.rb +16 -9
- data/sys/aro/p.rb +2 -2
- data/sys/cli/config.rb +131 -44
- data/sys/cli/constants.rb +3 -3
- data/sys/cli/deck.rb +27 -13
- data/sys/cli/dom.rb +11 -4
- data/sys/dom/d.rb +24 -14
- data/sys/dom/dom.rb +41 -27
- data/sys/dom/p.rb +1 -1
- data/sys/models/deck.rb +25 -12
- data/sys/reiquire.rb +2 -0
- data/sys/shr/prompt.rb +4 -0
- data/sys/shr/t.rb +19 -9
- data/sys/shr/version.rb +2 -4
- metadata +5 -3
- data/sys/aos/views/games/deck.rb +0 -95
data/sys/cli/config.rb
CHANGED
|
@@ -12,7 +12,7 @@ module CLI
|
|
|
12
12
|
|
|
13
13
|
# cli entrypoint
|
|
14
14
|
def self.config
|
|
15
|
-
|
|
15
|
+
CLI::Config.process_config_command(ARGV)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
class Config
|
|
@@ -83,7 +83,7 @@ module CLI
|
|
|
83
83
|
name: CLI::Config::TYPES[:BOOL],
|
|
84
84
|
description: I18n.t("cli.config.type.bool_description"),
|
|
85
85
|
converter: Proc.new{|v|
|
|
86
|
-
if
|
|
86
|
+
if [CLI::Config::BOOLS[:TRUE].to_s, Aro::Mancy::S].include?(v)
|
|
87
87
|
CLI::Config::BOOLS[:TRUE]
|
|
88
88
|
else
|
|
89
89
|
CLI::Config::BOOLS[:FALSE]
|
|
@@ -99,14 +99,14 @@ module CLI
|
|
|
99
99
|
description: I18n.t("cli.config.type.int_description"),
|
|
100
100
|
converter: Proc.new{|v| v.to_i},
|
|
101
101
|
validator: Proc.new{|unvalid, k, v|
|
|
102
|
+
Aro::V.say("validating #{k} (#{CLI::Config::DEF_TYPES[:INT][:name]})")
|
|
103
|
+
Aro::V.say("unvalid = #{unvalid}")
|
|
104
|
+
Aro::V.say("[min, max] = [#{v[:min]}, #{v[:max]}]")
|
|
102
105
|
int_valid = CLI::Config.def_valid?(k, v) &&
|
|
103
106
|
CLI::Config.int_valid?(unvalid) &&
|
|
104
107
|
unvalid.to_i >= v[:min] &&
|
|
105
108
|
unvalid.to_i <= v[:max]
|
|
106
|
-
|
|
107
|
-
Aro::V.say("validating #{k} (#{CLI::Config::DEF_TYPES[:INT][:name]})")
|
|
108
|
-
Aro::V.say("unvalid = #{unvalid}")
|
|
109
|
-
Aro::V.say("unvalid is#{int_valid ? " " : :" not ".to_s}valid.")
|
|
109
|
+
Aro::V.say("unvalid(#{unvalid}) is#{int_valid ? " " : :" not ".to_s}valid.")
|
|
110
110
|
int_valid
|
|
111
111
|
}
|
|
112
112
|
},
|
|
@@ -131,7 +131,7 @@ module CLI
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
def self.bool_valid?(unvalid)
|
|
134
|
-
CLI::Config::BOOLS.include?(unvalid&.to_s&.to_sym)
|
|
134
|
+
CLI::Config::BOOLS.values.map{|b| b.to_s.to_sym}.include?(unvalid&.to_s&.to_sym)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def self.int_valid?(unvalid)
|
|
@@ -154,13 +154,19 @@ module CLI
|
|
|
154
154
|
def validate_config
|
|
155
155
|
invalid_vars = []
|
|
156
156
|
CLI::Config::DEF.each{|k, v|
|
|
157
|
-
is_valid =
|
|
157
|
+
is_valid = v[:access] == CLI::Config::DEF_ACCESS[:READ]
|
|
158
|
+
unless is_valid
|
|
159
|
+
is_valid = valid_var?(CLI::Config.ivar(k), k, v)
|
|
160
|
+
end
|
|
158
161
|
invalid_vars << k unless is_valid
|
|
159
162
|
}
|
|
160
163
|
invalid_vars
|
|
161
164
|
end
|
|
162
165
|
|
|
163
166
|
def valid_var?(var_value, k, v)
|
|
167
|
+
Aro::V.say(v)
|
|
168
|
+
return true if v[:access] == CLI::Config::DEF_ACCESS[:READ]
|
|
169
|
+
|
|
164
170
|
CLI::Config::DEF_TYPES[
|
|
165
171
|
v[:type].to_s.upcase.to_sym
|
|
166
172
|
][:validator].call(var_value, k, v)
|
|
@@ -192,6 +198,24 @@ module CLI
|
|
|
192
198
|
test: I18n.t("cli.config.env.test_description"),
|
|
193
199
|
}
|
|
194
200
|
},
|
|
201
|
+
VERBOSE: {
|
|
202
|
+
type: CLI::Config::TYPES[:BOOL],
|
|
203
|
+
access: CLI::Config::DEF_ACCESS[:WRITE],
|
|
204
|
+
value: CLI::Config::BOOLS[:FALSE],
|
|
205
|
+
description: I18n.t("cli.config.verbose_description"),
|
|
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
|
+
},
|
|
195
219
|
FORMAT: { # not implemented yet.
|
|
196
220
|
type: CLI::Config::TYPES[:VALUES],
|
|
197
221
|
implemented: false,
|
|
@@ -218,7 +242,7 @@ module CLI
|
|
|
218
242
|
access: CLI::Config::DEF_ACCESS[:WRITE],
|
|
219
243
|
value: Aro::Mancy::NUMERALS[:XLII],
|
|
220
244
|
min: Aro::Mancy::NUMERALS[:I],
|
|
221
|
-
max: Aro::Mancy::NUMERALS[:
|
|
245
|
+
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
222
246
|
description: I18n.t(
|
|
223
247
|
"cli.config.height_description",
|
|
224
248
|
min: Aro::Mancy::NUMERALS[:I],
|
|
@@ -230,7 +254,7 @@ module CLI
|
|
|
230
254
|
access: CLI::Config::DEF_ACCESS[:WRITE],
|
|
231
255
|
value: Aro::Mancy::NUMERALS[:C] + Aro::Mancy::NUMERALS[:XXXVII] - Aro::Mancy::S,
|
|
232
256
|
min: Aro::Mancy::NUMERALS[:I],
|
|
233
|
-
max: Aro::Mancy::NUMERALS[:
|
|
257
|
+
max: Aro::Mancy::NUMERALS[:MMXCVII],
|
|
234
258
|
description: I18n.t(
|
|
235
259
|
"cli.config.width_description",
|
|
236
260
|
min: Aro::Mancy::NUMERALS[:I],
|
|
@@ -261,12 +285,6 @@ module CLI
|
|
|
261
285
|
max: Aro::Mancy::NUMERALS[:XXII],
|
|
262
286
|
),
|
|
263
287
|
},
|
|
264
|
-
VERBOSE: {
|
|
265
|
-
type: CLI::Config::TYPES[:BOOL],
|
|
266
|
-
access: CLI::Config::DEF_ACCESS[:WRITE],
|
|
267
|
-
value: CLI::Config::BOOLS[:FALSE],
|
|
268
|
-
description: I18n.t("cli.config.verbose_description"),
|
|
269
|
-
},
|
|
270
288
|
|
|
271
289
|
#
|
|
272
290
|
# => ovars
|
|
@@ -335,13 +353,14 @@ module CLI
|
|
|
335
353
|
|
|
336
354
|
def initialize
|
|
337
355
|
@@context = nil
|
|
338
|
-
if Aro::Mancy.
|
|
339
|
-
@@context = Aro::
|
|
340
|
-
elsif Aro::Dom.in_arodom?
|
|
341
|
-
@@context =
|
|
356
|
+
if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
|
|
357
|
+
@@context = Aro::Db
|
|
358
|
+
elsif Aro::Dom.in_arodom? && Aro::Dom.is_initialized?
|
|
359
|
+
@@context = Aos::Db
|
|
342
360
|
end
|
|
343
361
|
|
|
344
362
|
return if @@context.nil?
|
|
363
|
+
Aro::V.say(@@context)
|
|
345
364
|
|
|
346
365
|
unless File.exist?(CLI::Config.config_filepath)
|
|
347
366
|
generate_config
|
|
@@ -351,26 +370,58 @@ module CLI
|
|
|
351
370
|
setup_env
|
|
352
371
|
end
|
|
353
372
|
|
|
373
|
+
def self.context
|
|
374
|
+
@@context
|
|
375
|
+
end
|
|
376
|
+
|
|
354
377
|
def self.config_filepath
|
|
355
|
-
|
|
356
|
-
|
|
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
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
def self.is_test?
|
|
394
|
+
ENV[:ARO_ENV.to_s] == CLI::Config::ENVS[:TEST].to_s
|
|
357
395
|
end
|
|
358
396
|
|
|
359
397
|
def self.display_config
|
|
360
|
-
|
|
361
|
-
width = CLI::Config.ivar(:WIDTH).to_i
|
|
362
|
-
columns = width.pow(Aro::Mancy::S.to_f / Aro::Mancy::OS.to_f).to_i
|
|
398
|
+
height, width = IO.console.winsize
|
|
363
399
|
result = {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
DIVIDER: :"-".to_s
|
|
400
|
+
HEIGHT: height, #CLI::Config.ivar(:HEIGHT).to_i,
|
|
401
|
+
WIDTH: width - Aro::Mancy::O,
|
|
402
|
+
DIVIDER: :"_".to_s
|
|
368
403
|
}
|
|
369
|
-
Aro::V.say(result)
|
|
404
|
+
# Aro::V.say(result)
|
|
370
405
|
|
|
371
406
|
result
|
|
372
407
|
end
|
|
373
408
|
|
|
409
|
+
def self.is_format_text?
|
|
410
|
+
CLI::Config.ivar(:FORMAT)&.to_sym == CLI::Config::FORMATS[:TEXT]
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
def self.process_config_command(args)
|
|
414
|
+
if args[1].nil? || args[1] == :aos.to_s
|
|
415
|
+
# print config
|
|
416
|
+
Aro::P.say((
|
|
417
|
+
["config loaded from #{CLI::Config.config_filepath}"] +
|
|
418
|
+
CLI::Config.dump_config
|
|
419
|
+
).join("\n"))
|
|
420
|
+
elsif [args[2],args[3]].compact.any? && args[1] == Aos::Os::CMDS[:CONFIG][:cmds][:SET][:key].to_s
|
|
421
|
+
CLI::Config.set_ivar(args[2], args[3])
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
|
|
374
425
|
# out vars
|
|
375
426
|
def self.ovar(suffix)
|
|
376
427
|
CLI::Config::DEF[suffix][:value]
|
|
@@ -389,6 +440,32 @@ module CLI
|
|
|
389
440
|
"#{CLI::Config::ARO_CONFIG_PREFIX}#{suffix}"
|
|
390
441
|
end
|
|
391
442
|
|
|
443
|
+
def self.set_ivar(k, new_value)
|
|
444
|
+
k = k.upcase.to_sym
|
|
445
|
+
|
|
446
|
+
current_value = CLI::Config.ivar(k)
|
|
447
|
+
# ensure the var name is valid
|
|
448
|
+
unless current_value.nil?
|
|
449
|
+
Aro::Dom::P.say("validating #{k} with value #{new_value}")
|
|
450
|
+
if CLI::Config.instance.valid_var?(new_value, k, CLI::Config::DEF[k])
|
|
451
|
+
# set ENV value
|
|
452
|
+
ENV[CLI::Config.ivar_k(k)] = new_value
|
|
453
|
+
Aro::Dom::P.say("#{k} set to #{new_value}")
|
|
454
|
+
Aro::V.say(ENV[CLI::Config.ivar_k(k)])
|
|
455
|
+
|
|
456
|
+
# flush existing config and regen
|
|
457
|
+
CLI::Config.instance.generate_config(true)
|
|
458
|
+
CLI::Config.instance.source_config
|
|
459
|
+
CLI::Config.instance.setup_env
|
|
460
|
+
@@context.configure_logger
|
|
461
|
+
else
|
|
462
|
+
Aro::Dom::P.say("the ivar value you entered is invalid. ignoring.")
|
|
463
|
+
end
|
|
464
|
+
else
|
|
465
|
+
Aro::Dom::P.say("the ivar name you entered is invalid. ignoring.")
|
|
466
|
+
end
|
|
467
|
+
end
|
|
468
|
+
|
|
392
469
|
def setup_env
|
|
393
470
|
# do not change - update $ARO_CONFIG_ENV .aro/.config file
|
|
394
471
|
#
|
|
@@ -399,8 +476,17 @@ module CLI
|
|
|
399
476
|
Aro::D.say("setup_env: #{ENV[:ARO_ENV.to_s]}")
|
|
400
477
|
end
|
|
401
478
|
|
|
402
|
-
def self.
|
|
403
|
-
|
|
479
|
+
def self.dump_config
|
|
480
|
+
dump = []
|
|
481
|
+
CLI::Config::DEF.each{|k, v|
|
|
482
|
+
if v[:access] == CLI::Config::DEF_ACCESS[:WRITE]
|
|
483
|
+
dump << "$#{CLI::Config.ivar_k(k).ljust(Aro::Mancy::NUMERALS[:XIV] * Aro::Mancy::OS)}=#{CLI::Config.ivar(k)}"
|
|
484
|
+
else
|
|
485
|
+
dump << "$#{CLI::Config.ovar_k(k).ljust(Aro::Mancy::NUMERALS[:XIV] * Aro::Mancy::OS)}=#{CLI::Config.ovar(k)}"
|
|
486
|
+
end
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
dump
|
|
404
490
|
end
|
|
405
491
|
|
|
406
492
|
def source_config
|
|
@@ -417,17 +503,18 @@ module CLI
|
|
|
417
503
|
|
|
418
504
|
# todo: implement
|
|
419
505
|
invalid_defs = validate_config
|
|
420
|
-
CLI::Config
|
|
421
|
-
|
|
506
|
+
CLI::Config.dump_config.each{|l| Aro::V.say(l)}
|
|
507
|
+
invalid_defs.each{|k|
|
|
508
|
+
v = CLI::Config::DEF[k.to_sym]
|
|
509
|
+
if v[:access] == CLI::Config::DEF_ACCESS[:WRITE]
|
|
510
|
+
ENV[CLI::Config.ivar_k(k)] = v[:value]
|
|
511
|
+
else
|
|
512
|
+
ENV[CLI::Config.ovar_k(k)] = v[:value]
|
|
513
|
+
end
|
|
422
514
|
}
|
|
423
|
-
Aro::V.say("todo: invalid_defs: #{invalid_defs}")
|
|
424
|
-
# todo: set all invalid_refs to default in ENV
|
|
425
|
-
# invalid_defs.each{|id|
|
|
426
|
-
|
|
427
|
-
# }
|
|
428
515
|
end
|
|
429
516
|
|
|
430
|
-
def generate_config
|
|
517
|
+
def generate_config(from_memory = false)
|
|
431
518
|
# todo: localize generated config text
|
|
432
519
|
Aro::D.say(I18n.t("cli.config.generate", name: CLI::Config.config_filepath))
|
|
433
520
|
File.open(CLI::Config.config_filepath, "w+") do |file|
|
|
@@ -464,7 +551,7 @@ module CLI
|
|
|
464
551
|
|
|
465
552
|
# vars
|
|
466
553
|
CLI::Config::DEF.each{|k, v|
|
|
467
|
-
print_var file.object_id, k, v
|
|
554
|
+
print_var file.object_id, k, v, (from_memory ? ENV[CLI::Config.ivar_k(k)] : nil)
|
|
468
555
|
}
|
|
469
556
|
|
|
470
557
|
print_osr file.object_id
|
|
@@ -535,7 +622,7 @@ module CLI
|
|
|
535
622
|
file.write("# => which can be used to write programs on top of aro.\n")
|
|
536
623
|
end
|
|
537
624
|
|
|
538
|
-
def print_var f_object_id, k, v
|
|
625
|
+
def print_var f_object_id, k, v, mem_v
|
|
539
626
|
file = ObjectSpace._id2ref f_object_id
|
|
540
627
|
|
|
541
628
|
is_ovar = CLI::Config::DEF[k][:access] == CLI::Config::DEF_ACCESS[:READ]
|
|
@@ -547,7 +634,7 @@ module CLI
|
|
|
547
634
|
Aro::V.say("access for #{k} is #{CLI::Config::DEF[k][:access]}")
|
|
548
635
|
Aro::V.say("using var_name: #{var_name}")
|
|
549
636
|
file.write("# [#{var_name}] (#{is_ovar ? :ovar : :ivar})\n")
|
|
550
|
-
file.write("# =>
|
|
637
|
+
file.write("# => CLI::Config::DEF_TYPES: #{v[:type]}\n")
|
|
551
638
|
case v[:type]
|
|
552
639
|
when CLI::Config::DEF_TYPES[:INT][:name]
|
|
553
640
|
file.write("# => #{I18n.t("cli.config.type.int_description")}\n")
|
|
@@ -573,7 +660,7 @@ module CLI
|
|
|
573
660
|
if is_ovar && CLI::Config::DEF_TYPES[:STRING][:name] == v[:type]
|
|
574
661
|
file.write("export #{var_name}=\"#{v[:value]}\"\n")
|
|
575
662
|
else
|
|
576
|
-
file.write("export #{var_name}=#{v[:value]}\n")
|
|
663
|
+
file.write("export #{var_name}=#{mem_v || v[:value]}\n")
|
|
577
664
|
end
|
|
578
665
|
print_osr f_object_id
|
|
579
666
|
end
|
data/sys/cli/constants.rb
CHANGED
data/sys/cli/deck.rb
CHANGED
|
@@ -13,19 +13,28 @@ module CLI
|
|
|
13
13
|
def self.deck
|
|
14
14
|
action = CLI::ARGV1&.to_sym
|
|
15
15
|
|
|
16
|
-
if CLI::FLAGS[:HELP].include?(
|
|
16
|
+
if CLI::FLAGS[:HELP].include?(action.to_s)
|
|
17
17
|
# todo: breakout usage into subcommand-specific verbiage
|
|
18
18
|
CLI.usage::usage
|
|
19
19
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
20
|
-
elsif
|
|
20
|
+
elsif action.nil? || action == :aos
|
|
21
21
|
# no args, open deck menu
|
|
22
|
-
Aro::
|
|
23
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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))
|
|
@@ -51,7 +60,7 @@ module CLI
|
|
|
51
60
|
Aro::P.say(I18n.t("cli.messages.replacing_drawn", name: Aro::Mancy.game.name))
|
|
52
61
|
Aro::Mancy.game.replace
|
|
53
62
|
when CLI::CMDS[:DECK][:RESET]
|
|
54
|
-
if Aro::Mancy::YES.to_s != Aro::P.p.ask(I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.game.name))
|
|
63
|
+
if Aro::Mancy::YES.to_s != Aro::P.p.ask("#{Aro::Mancy::PS1}#{I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.game.name)}")
|
|
55
64
|
Aro::P.say(I18n.t("cli.messages.understood", name: Aro::Mancy.game.name))
|
|
56
65
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
57
66
|
end
|
|
@@ -60,6 +69,11 @@ module CLI
|
|
|
60
69
|
Aro::Mancy.game.reset
|
|
61
70
|
end
|
|
62
71
|
|
|
72
|
+
if ARGV.include?(:aos.to_s)
|
|
73
|
+
# run silent
|
|
74
|
+
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
75
|
+
end
|
|
76
|
+
|
|
63
77
|
Aro::Mancy.game.show(**CLI::shoptions)
|
|
64
78
|
end
|
|
65
79
|
end
|
|
@@ -70,23 +84,23 @@ module CLI
|
|
|
70
84
|
show_options_count = Aro::Mancy::S
|
|
71
85
|
show_options_order = Aro::Log::ORDERING[:DESC]
|
|
72
86
|
|
|
73
|
-
# Aro::
|
|
87
|
+
# Aro::D.say("ARGV.map{|a| a.to_sym} => #{ARGV.map{|a| a.to_sym}}")
|
|
74
88
|
|
|
75
89
|
count_option_flags = ARGV.map{|a| a.to_sym} & CLI::FLAGS[:SHOW_COUNT]
|
|
76
|
-
# Aro::
|
|
90
|
+
# Aro::D.say("count_option_flags: #{count_option_flags}")
|
|
77
91
|
if count_option_flags.any?
|
|
78
92
|
# get the ARGV index element after flag index
|
|
79
93
|
show_options_count = ARGV[ARGV.index(count_option_flags.first.to_s) + 1]
|
|
80
94
|
show_options_count = show_options_count.to_i unless [0, nil].include?(show_options_count&.to_i)
|
|
81
|
-
# Aro::
|
|
95
|
+
# Aro::D.say("show_options_count: #{show_options_count}")
|
|
82
96
|
end
|
|
83
97
|
|
|
84
98
|
order_option_flags = ARGV.map{|a| a.to_sym} & CLI::FLAGS[:SHOW_ORDER]
|
|
85
|
-
# Aro::
|
|
99
|
+
# Aro::D.say("count_option_flags: #{order_option_flags}")
|
|
86
100
|
if order_option_flags.any?
|
|
87
101
|
# get the ARGV index element after flag index
|
|
88
102
|
show_options_order = ARGV[ARGV.index(order_option_flags.first.to_s) + 1].to_sym
|
|
89
|
-
Aro::
|
|
103
|
+
# Aro::D.say("show_options_order: #{show_options_order}")
|
|
90
104
|
end
|
|
91
105
|
|
|
92
106
|
{
|
data/sys/cli/dom.rb
CHANGED
|
@@ -22,13 +22,20 @@ module CLI
|
|
|
22
22
|
|
|
23
23
|
case action
|
|
24
24
|
when CLI::CMDS[:DOM][:INIT]
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if Aro::Dom.is_initialized?
|
|
26
|
+
Aro::P.say(I18n.t("dom.errors.failed_already_initialized"))
|
|
27
|
+
elsif Aro::Dom.in_arodom? && !Aro::Dom.is_initialized?
|
|
28
|
+
arodome = Aro::Dom.new
|
|
29
|
+
arodome.generate
|
|
30
|
+
else
|
|
31
|
+
CLI::Nterface.exit_error_invalid_usage!
|
|
32
|
+
end
|
|
27
33
|
when CLI::CMDS[:DOM][:NEW]
|
|
28
34
|
CLI::Nterface.exit_error_missing_args! if CLI::ARGV2.nil?
|
|
29
35
|
if Aro::Dom.in_arodom?
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
Aro::P.say(I18n.t("dom.errors.failed_already_in_arodom"))
|
|
37
|
+
elsif Aro::Mancy.in_aro?
|
|
38
|
+
Aro::P.say(I18n.t("dom.errors.failed_in_aro_space"))
|
|
32
39
|
else
|
|
33
40
|
Aro::Dom.create(CLI::ARGV2.to_s)
|
|
34
41
|
end
|
data/sys/dom/d.rb
CHANGED
|
@@ -12,50 +12,60 @@ require_relative :dom.to_s
|
|
|
12
12
|
|
|
13
13
|
module Aro
|
|
14
14
|
class Dom::D
|
|
15
|
-
|
|
15
|
+
def self.reserved_words
|
|
16
|
+
reserved = []
|
|
17
|
+
Aro::Dom::D::LAYOUT.values.each{|wing|
|
|
18
|
+
reserved << wing[:name].to_s
|
|
19
|
+
wing[:rooms].each{|room| reserved << room[:name].to_s}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
reserved.sort
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# definition of rooms in each layout wing
|
|
16
26
|
WINGS = {
|
|
17
27
|
WELCOME: {
|
|
18
28
|
WAITE: {
|
|
19
29
|
name: Aro::Dom::WAITE,
|
|
20
|
-
description: "
|
|
30
|
+
description: I18n.t("dom.rooms.waite.description"),
|
|
21
31
|
},
|
|
22
32
|
WINNER: {
|
|
23
33
|
name: Aro::Dom::WINNER,
|
|
24
|
-
description: "
|
|
34
|
+
description: I18n.t("dom.rooms.winner.description"),
|
|
25
35
|
},
|
|
26
36
|
},
|
|
27
37
|
GAMES: {
|
|
28
38
|
ABPPS: {
|
|
29
39
|
name: Aro::Dom::ABPPS,
|
|
30
|
-
description: "
|
|
40
|
+
description: I18n.t("dom.rooms.abpps.description"),
|
|
31
41
|
},
|
|
32
42
|
HBPPS: {
|
|
33
43
|
name: Aro::Dom::HBPPS,
|
|
34
|
-
description: "
|
|
44
|
+
description: I18n.t("dom.rooms.hbpps.description"),
|
|
35
45
|
},
|
|
36
46
|
SHPPS: {
|
|
37
47
|
name: Aro::Dom::SHPPS,
|
|
38
|
-
description: "
|
|
48
|
+
description: I18n.t("dom.rooms.shpps.description"),
|
|
39
49
|
},
|
|
40
50
|
VIPPS: {
|
|
41
51
|
name: Aro::Dom::VIPPS,
|
|
42
|
-
description: "
|
|
52
|
+
description: I18n.t("dom.rooms.vipps.description"),
|
|
43
53
|
},
|
|
44
54
|
},
|
|
45
55
|
KNOW: {
|
|
46
56
|
LIBRARY: {
|
|
47
57
|
name: Aro::Dom::LIBRARY,
|
|
48
|
-
description: "
|
|
58
|
+
description: I18n.t("dom.rooms.library.description"),
|
|
49
59
|
},
|
|
50
60
|
TEMPLE: {
|
|
51
61
|
name: Aro::Dom::TEMPLE,
|
|
52
|
-
description: "
|
|
62
|
+
description: I18n.t("dom.rooms.temple.description"),
|
|
53
63
|
},
|
|
54
64
|
},
|
|
55
65
|
SETUP: {
|
|
56
66
|
SETTINGS: {
|
|
57
67
|
name: Aro::Dom::SETTINGS,
|
|
58
|
-
description: "
|
|
68
|
+
description: I18n.t("dom.rooms.settings.description"),
|
|
59
69
|
},
|
|
60
70
|
},
|
|
61
71
|
}
|
|
@@ -64,7 +74,7 @@ module Aro
|
|
|
64
74
|
LAYOUT = {
|
|
65
75
|
WELCOME: {
|
|
66
76
|
name: Aro::Dom::WELCOME,
|
|
67
|
-
description: "
|
|
77
|
+
description: I18n.t("dom.wings.welcome.description"),
|
|
68
78
|
rooms: [
|
|
69
79
|
Aro::Dom::D::WINGS[:WELCOME][:WAITE],
|
|
70
80
|
Aro::Dom::D::WINGS[:WELCOME][:WINNER],
|
|
@@ -72,7 +82,7 @@ module Aro
|
|
|
72
82
|
},
|
|
73
83
|
GAMES: {
|
|
74
84
|
name: Aro::Dom::GAMES,
|
|
75
|
-
description: "
|
|
85
|
+
description: I18n.t("dom.wings.games.description"),
|
|
76
86
|
rooms: [
|
|
77
87
|
Aro::Dom::D::WINGS[:GAMES][:ABPPS],
|
|
78
88
|
Aro::Dom::D::WINGS[:GAMES][:HBPPS],
|
|
@@ -82,7 +92,7 @@ module Aro
|
|
|
82
92
|
},
|
|
83
93
|
KNOW: {
|
|
84
94
|
name: Aro::Dom::KNOW,
|
|
85
|
-
description: "
|
|
95
|
+
description: I18n.t("dom.wings.know.description"),
|
|
86
96
|
rooms: [
|
|
87
97
|
Aro::Dom::D::WINGS[:KNOW][:LIBRARY],
|
|
88
98
|
Aro::Dom::D::WINGS[:KNOW][:TEMPLE]
|
|
@@ -90,7 +100,7 @@ module Aro
|
|
|
90
100
|
},
|
|
91
101
|
SETUP: {
|
|
92
102
|
name: Aro::Dom::SETUP,
|
|
93
|
-
description: "
|
|
103
|
+
description: I18n.t("dom.wings.setup.description"),
|
|
94
104
|
rooms: [
|
|
95
105
|
Aro::Dom::D::WINGS[:SETUP][:SETTINGS]
|
|
96
106
|
],
|