aro 0.2.0 → 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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +3 -2
- data/README.md +1 -1
- data/aro.gemspec +1 -0
- data/bin/aos +2 -2
- data/bin/aro +4 -4
- data/checksums/aro-0.2.1.gem.sha512 +1 -0
- data/checksums/aro-0.2.2.gem.sha512 +1 -0
- data/listen.rb +1 -1
- data/locale/en.amg.yml +44 -0
- data/locale/en.aos.yml +13 -8
- data/locale/en.data.yml +30 -0
- data/locale/en.dom.yml +10 -8
- data/locale/en.usage.yml +22 -22
- data/locale/en.yml +16 -11
- data/sys/aos/amg.rb +184 -0
- data/sys/aos/aos.rb +203 -89
- data/sys/aos/data.rb +117 -0
- data/{db → sys/aos/db}/migrate/1765148774_create_yous.rb +1 -0
- data/sys/aos/db/migrate/1765762724_create_ilibs.rb +22 -0
- data/sys/aos/db/migrate/1765907766_create_ilogs.rb +18 -0
- data/sys/aos/db.rb +44 -25
- data/sys/aos/models/ilib.rb +46 -0
- data/sys/aos/models/ilog.rb +27 -0
- data/sys/aos/models/you.rb +50 -0
- data/sys/aos/vws/base.rb +120 -0
- data/sys/aos/{views → vws}/dom.rb +6 -10
- data/sys/aos/vws/games/abpps.rb +19 -0
- data/sys/aos/{views → vws}/games/game.rb +26 -25
- data/sys/aos/vws/games/hbpps.rb +19 -0
- data/sys/aos/vws/games/shpps.rb +19 -0
- data/sys/aos/vws/games/vipps.rb +19 -0
- data/sys/aos/{views → vws}/games.rb +3 -3
- data/sys/aos/vws/know/body.rb +19 -0
- data/sys/aos/vws/know/mind.rb +19 -0
- data/sys/aos/vws/know/spirit.rb +19 -0
- data/sys/aos/{views → vws}/know.rb +3 -3
- data/sys/aos/vws/root/amg.rb +21 -0
- data/sys/aos/vws/root/config.rb +21 -0
- data/sys/aos/vws/root/data.rb +21 -0
- data/sys/aos/{views/setup.rb → vws/root.rb} +4 -4
- data/sys/aos/vws/welcome/waite.rb +31 -0
- data/sys/aos/{views → vws}/welcome/winner.rb +3 -3
- data/sys/aos/vws/welcome.rb +30 -0
- data/{db/migrate/1763374647_create_decks.rb → sys/aro/db/migrate/1763374647_create_tecks.rb} +5 -5
- data/sys/aro/db/migrate/1763432541_create_tlogs.rb +20 -0
- data/sys/aro/db.rb +16 -15
- data/sys/aro/mancy.rb +4 -3
- data/sys/{models/deck.rb → aro/models/teck.rb} +56 -62
- data/sys/aro/models/tlog.rb +20 -0
- data/sys/aro/v.rb +1 -1
- data/sys/cli/constants.rb +1 -1
- data/sys/cli/dom.rb +1 -1
- data/sys/cli/{deck.rb → teck.rb} +20 -15
- data/sys/cli.rb +12 -12
- data/sys/dom/config.rb +718 -0
- data/sys/dom/d.rb +36 -18
- data/sys/dom/dom.rb +24 -14
- data/sys/reiquire.rb +8 -8
- data/sys/shr/ilib/crs/CMakeLists.txt +12 -0
- data/sys/shr/ilib/crs/compile.sh +5 -0
- data/sys/shr/ilib/crs/crs.c +24 -0
- data/sys/shr/ilib/crs/crs.o +0 -0
- data/sys/shr/ilib/crs/libcrs.so +0 -0
- data/sys/shr/prompt.rb +1 -5
- data/sys/shr/t.rb +14 -8
- data/sys/shr/version.rb +1 -1
- metadata +63 -26
- data/db/migrate/1763432541_create_logs.rb +0 -20
- data/locale/en.cngelog.yml +0 -5
- data/sys/aos/views/base.rb +0 -166
- data/sys/aos/views/games/abpps.rb +0 -21
- data/sys/aos/views/games/hbpps.rb +0 -21
- data/sys/aos/views/games/shpps.rb +0 -21
- data/sys/aos/views/games/vipps.rb +0 -21
- data/sys/aos/views/know/library.rb +0 -19
- data/sys/aos/views/know/temple.rb +0 -19
- data/sys/aos/views/setup/settings.rb +0 -37
- data/sys/aos/views/welcome/waite.rb +0 -19
- data/sys/aos/views/welcome.rb +0 -19
- data/sys/aos/you.rb +0 -19
- data/sys/cli/config.rb +0 -669
- data/sys/models/log.rb +0 -20
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
vws/root/amg.rb
|
|
4
|
+
|
|
5
|
+
the amg view.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"../base".to_s
|
|
12
|
+
|
|
13
|
+
module Aos
|
|
14
|
+
module Vw
|
|
15
|
+
class Amg < Aos::Vw::Base
|
|
16
|
+
def self.show
|
|
17
|
+
draw(Aos::Amg.instance.display_lines)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
vws/root/config.rb
|
|
4
|
+
|
|
5
|
+
the config view.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"../base".to_s
|
|
12
|
+
|
|
13
|
+
module Aos
|
|
14
|
+
module Vw
|
|
15
|
+
class Config < Aos::Vw::Base
|
|
16
|
+
def self.show
|
|
17
|
+
draw(Aro::Config.instance.display_lines)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -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
|
-
|
|
3
|
+
vws/root.rb
|
|
4
4
|
|
|
5
|
-
the
|
|
5
|
+
the root view.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
require_relative :"./base".to_s
|
|
12
12
|
|
|
13
13
|
module Aos
|
|
14
|
-
module
|
|
15
|
-
class
|
|
14
|
+
module Vw
|
|
15
|
+
class Root < Aos::Vw::Base
|
|
16
16
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
vws/welcome/waite.rb
|
|
4
|
+
|
|
5
|
+
the welcome waite view.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"../base".to_s
|
|
12
|
+
|
|
13
|
+
module Aos
|
|
14
|
+
module Vw
|
|
15
|
+
class Waite < Aos::Vw::Base
|
|
16
|
+
def self.show
|
|
17
|
+
# print all commands
|
|
18
|
+
lines = []
|
|
19
|
+
lines << ""
|
|
20
|
+
lines << I18n.t("aos.constants.commands")
|
|
21
|
+
lines << ""
|
|
22
|
+
Aos::Os::CMDS.values.each{|v|
|
|
23
|
+
lines += lines_for_cmd(v)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# draw output
|
|
27
|
+
draw(lines)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
vws/welcome/winner.rb
|
|
4
4
|
|
|
5
5
|
the welcome winner view.
|
|
6
6
|
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
require_relative :"../base".to_s
|
|
12
12
|
|
|
13
13
|
module Aos
|
|
14
|
-
module
|
|
15
|
-
class Winner < Aos::
|
|
14
|
+
module Vw
|
|
15
|
+
class Winner < Aos::Vw::Base
|
|
16
16
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
vws/welcome.rb
|
|
4
|
+
|
|
5
|
+
the welcome view.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"./base".to_s
|
|
12
|
+
|
|
13
|
+
module Aos
|
|
14
|
+
module Vw
|
|
15
|
+
class Welcome < Aos::Vw::Base
|
|
16
|
+
def self.show
|
|
17
|
+
lines = []
|
|
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
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/{db/migrate/1763374647_create_decks.rb → sys/aro/db/migrate/1763374647_create_tecks.rb}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateTecks < ActiveRecord::Migration[8.1]
|
|
2
2
|
|
|
3
3
|
def self.up
|
|
4
|
-
create_table :
|
|
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 :
|
|
12
|
+
add_index :tecks, :name, unique: true
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def self.down
|
|
16
|
-
remove_index :
|
|
17
|
-
drop_table :
|
|
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,37 +10,32 @@
|
|
|
10
10
|
|
|
11
11
|
module Aro
|
|
12
12
|
class Db
|
|
13
|
+
include Singleton
|
|
14
|
+
|
|
13
15
|
DATABASE_YML = :"database.yml"
|
|
14
|
-
|
|
15
|
-
SCHEMA_FILE = :"schema.rb"
|
|
16
|
+
GEM_DB_PATH = :"sys/aro/db"
|
|
16
17
|
MIGRATIONS_DIR = :"db/migrate"
|
|
18
|
+
SCHEMA_FILE = :"schema.rb"
|
|
19
|
+
SQL_FILE = :"aro.sql"
|
|
17
20
|
|
|
18
|
-
def
|
|
21
|
+
def self.load
|
|
19
22
|
Aro::Db.configure_logger
|
|
20
23
|
if Aro::Mancy.in_aro?
|
|
21
|
-
setup_local_aro
|
|
24
|
+
self.instance.setup_local_aro
|
|
22
25
|
end
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
def self.configure_logger
|
|
26
|
-
if
|
|
29
|
+
if Aro::Config.ivar(:LOG_ARO_DB).to_s == Aro::Config::BOOLS[:TRUE].to_s
|
|
27
30
|
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
|
28
31
|
else
|
|
29
32
|
ActiveRecord::Base.logger = nil
|
|
30
33
|
end
|
|
31
34
|
end
|
|
32
35
|
|
|
33
|
-
def connect(name)
|
|
34
|
-
ActiveRecord::Base.establish_connection(config)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def config
|
|
38
|
-
@config ||= YAML.load_file(db_config_filepath)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
36
|
def self.base_aro_dir
|
|
42
37
|
base_aro_file = Aro::Mancy::ARO_FILE.to_s
|
|
43
|
-
|
|
38
|
+
Aro::Config.is_test? ? "#{base_aro_file}_test" : base_aro_file
|
|
44
39
|
end
|
|
45
40
|
|
|
46
41
|
def db_config_filepath
|
|
@@ -73,11 +68,17 @@ module Aro
|
|
|
73
68
|
migrate(name)
|
|
74
69
|
end
|
|
75
70
|
|
|
71
|
+
def connect(name)
|
|
72
|
+
ActiveRecord::Base.establish_connection(
|
|
73
|
+
YAML.load_file(db_config_filepath)
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
76
77
|
def migrate(name)
|
|
77
78
|
local_migrate_dir = File.join(Aro::Db.base_aro_dir, Aro::Db::MIGRATIONS_DIR.to_s)
|
|
78
79
|
unless Dir.exist?(local_migrate_dir)
|
|
79
80
|
gem_dir = Dir[Gem.loaded_specs[:aro.to_s]&.full_gem_path || '.'].first
|
|
80
|
-
FileUtils.cp_r(File.join(gem_dir,
|
|
81
|
+
FileUtils.cp_r(File.join(gem_dir, Aro::Db::GEM_DB_PATH.to_s), Aro::Db::base_aro_dir)
|
|
81
82
|
end
|
|
82
83
|
|
|
83
84
|
migration_version = Dir["#{local_migrate_dir}/*.rb"].map{|n|
|
data/sys/aro/mancy.rb
CHANGED
|
@@ -61,8 +61,9 @@ module Aro
|
|
|
61
61
|
|
|
62
62
|
def initialize
|
|
63
63
|
if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
|
|
64
|
+
Aro::Config.instance.load
|
|
64
65
|
Aro::Mancy.init
|
|
65
|
-
self.game = Aro::
|
|
66
|
+
self.game = Aro::Teck.current_teck
|
|
66
67
|
end
|
|
67
68
|
end
|
|
68
69
|
|
|
@@ -79,7 +80,7 @@ module Aro
|
|
|
79
80
|
|
|
80
81
|
# create the new aro directory and database
|
|
81
82
|
if !Dir.exist?(name)
|
|
82
|
-
Aro::P.say(I18n.t("cli.messages.
|
|
83
|
+
Aro::P.say(I18n.t("cli.messages.no_tecks"))
|
|
83
84
|
FileUtils.mkdir(name)
|
|
84
85
|
else
|
|
85
86
|
return false
|
|
@@ -97,7 +98,7 @@ module Aro
|
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
def self.init
|
|
100
|
-
Aro::Db.
|
|
101
|
+
Aro::Db.load
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
def self.is_initialized?
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
teck.rb
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
teck object.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
require :base64.to_s
|
|
12
|
-
require_relative :"../shr/t".to_s
|
|
13
12
|
|
|
14
|
-
class Aro::
|
|
15
|
-
has_many :
|
|
13
|
+
class Aro::Teck < ActiveRecord::Base
|
|
14
|
+
has_many :tlogs
|
|
16
15
|
|
|
17
|
-
DECK_FILE = :".
|
|
16
|
+
DECK_FILE = :".teck"
|
|
18
17
|
CARD_DELIM = :","
|
|
19
18
|
|
|
20
19
|
before_create :populate_cards
|
|
@@ -22,28 +21,24 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
22
21
|
|
|
23
22
|
def self.make(new_name)
|
|
24
23
|
return nil unless Aro::Mancy.is_initialized?
|
|
25
|
-
Aro::Db.
|
|
26
|
-
|
|
27
|
-
if Aro::
|
|
28
|
-
|
|
29
|
-
file.write(new_deck.id)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
new_deck
|
|
24
|
+
Aro::Db.load
|
|
25
|
+
new_teck = Aro::Teck.create(name: new_name)
|
|
26
|
+
Aro::Teck.select_teck(new_teck) if Aro::Teck.current_teck.nil?
|
|
27
|
+
new_teck
|
|
33
28
|
end
|
|
34
29
|
|
|
35
30
|
def self.fresh_cards
|
|
36
|
-
I18n.t("cards.index").map{|c| "+#{c}"}.join(Aro::
|
|
31
|
+
I18n.t("cards.index").map{|c| "+#{c}"}.join(Aro::Teck::CARD_DELIM.to_s)
|
|
37
32
|
end
|
|
38
33
|
|
|
39
34
|
def populate_cards
|
|
40
|
-
self.cards = Aro::
|
|
35
|
+
self.cards = Aro::Teck.fresh_cards
|
|
41
36
|
end
|
|
42
37
|
|
|
43
38
|
def generate_log
|
|
44
|
-
prev_cards = Base64::decode64(
|
|
39
|
+
prev_cards = Base64::decode64(tlogs.last.card_data) if tlogs.any?
|
|
45
40
|
if (prev_cards.present? && prev_cards != cards) || (prev_cards.nil? || prev_cards.empty?)
|
|
46
|
-
|
|
41
|
+
tlogs.create(
|
|
47
42
|
card_data: Base64::encode64(cards || ""),
|
|
48
43
|
drawn_data: Base64::encode64(drawn || "")
|
|
49
44
|
)
|
|
@@ -51,29 +46,28 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
51
46
|
end
|
|
52
47
|
|
|
53
48
|
def self.display_selection_menu
|
|
54
|
-
unless Aro::
|
|
55
|
-
Aro::P.say(I18n.t("cli.messages.
|
|
49
|
+
unless Aro::Teck.any?
|
|
50
|
+
Aro::P.say(I18n.t("cli.messages.no_tecks"))
|
|
56
51
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
57
52
|
end
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Aro::Deck.all.each{|d|
|
|
62
|
-
if d.id == Aro::Deck.current_deck&.id
|
|
63
|
-
menu.default d.id
|
|
64
|
-
end
|
|
65
|
-
menu.choice(d.name, d.id)
|
|
66
|
-
}
|
|
53
|
+
c_d = Aro::Teck.current_teck
|
|
54
|
+
Aro::Teck.all.each do |d|
|
|
55
|
+
Aro::P.say("#{d.id == c_d.id ? :*.to_s : " "}#{d.id}): #{d.name}")
|
|
67
56
|
end
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.select_teck(teck)
|
|
60
|
+
return unless teck.present?
|
|
61
|
+
Aro::P.say(I18n.t("cli.messages.teck_selected", name: teck.name, room: Aro::Mancy::aro_mancy_name))
|
|
62
|
+
File.open(Aro::Teck::DECK_FILE.to_s, "w") do |file|
|
|
63
|
+
file.write(teck.id)
|
|
70
64
|
end
|
|
71
65
|
end
|
|
72
66
|
|
|
73
|
-
def self.
|
|
67
|
+
def self.current_teck
|
|
74
68
|
if File.exist?(DECK_FILE.to_s)
|
|
75
|
-
|
|
76
|
-
return Aro::
|
|
69
|
+
current_teck_id = File.read(DECK_FILE.to_s)
|
|
70
|
+
return Aro::Teck.find_by(id: current_teck_id)
|
|
77
71
|
end
|
|
78
72
|
end
|
|
79
73
|
|
|
@@ -81,54 +75,54 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
81
75
|
card.gsub(/[+-]/, "").strip
|
|
82
76
|
end
|
|
83
77
|
|
|
84
|
-
def show(count_n: Aro::Mancy::S, order_o: Aro::
|
|
78
|
+
def show(count_n: Aro::Mancy::S, order_o: Aro::Tlog::ORDERING[:DESC])
|
|
85
79
|
unless count_n.kind_of?(Numeric) && count_n.to_i > Aro::Mancy::O
|
|
86
80
|
if count_n&.to_s&.to_sym == Aro::Mancy::ALL
|
|
87
|
-
count_n =
|
|
81
|
+
count_n = tlogs.count
|
|
88
82
|
else
|
|
89
83
|
count_n = Aro::Mancy::S
|
|
90
84
|
end
|
|
91
85
|
end
|
|
92
|
-
count_n = [[Aro::Mancy::S, count_n.to_i].max,
|
|
86
|
+
count_n = [[Aro::Mancy::S, count_n.to_i].max, tlogs.count].min
|
|
93
87
|
Aro::V.say("count_n: #{count_n}")
|
|
94
88
|
Aro::V.say("order_o: #{order_o}")
|
|
95
89
|
|
|
96
|
-
unless Aro::
|
|
90
|
+
unless Aro::Tlog::ORDERING.values.include?(order_o)
|
|
97
91
|
Aro::P.say(I18n.t("cli.warnings.invalid_order"))
|
|
98
|
-
order_o = Aro::
|
|
92
|
+
order_o = Aro::Tlog::ORDERING[:DESC]
|
|
99
93
|
end
|
|
100
94
|
|
|
101
95
|
# perform query
|
|
102
|
-
|
|
96
|
+
tlog_records = tlogs.order(created_at: order_o).first(count_n)
|
|
103
97
|
|
|
104
98
|
# todo: this is doing more work than it needs to. needs debugging.
|
|
105
|
-
# Aro::V.say("
|
|
99
|
+
# Aro::V.say("tlog_records.count: #{tlog_records.count}")
|
|
106
100
|
|
|
107
101
|
# for now tests just expect text output
|
|
108
|
-
return
|
|
102
|
+
return tlog_records if Aro::Config.is_test?
|
|
109
103
|
|
|
110
104
|
Aro::D.say(I18n.t("cli.messages.showing", name: name, count: count_n, order: order_o))
|
|
111
105
|
|
|
112
|
-
Aos::
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
Aos::Vw::Game.show_game({
|
|
107
|
+
teck: self,
|
|
108
|
+
tlog_records: tlog_records,
|
|
115
109
|
count_n: count_n,
|
|
116
110
|
order_o: order_o
|
|
117
111
|
})
|
|
118
112
|
end
|
|
119
113
|
|
|
120
114
|
def explore
|
|
121
|
-
# allows user to browse each card in the current
|
|
115
|
+
# allows user to browse each card in the current teck.
|
|
122
116
|
answer = Aro::P.p.select(
|
|
123
117
|
Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
|
|
124
118
|
# formatted for tty-prompt gem
|
|
125
|
-
cards.split(Aro::
|
|
126
|
-
per_page:
|
|
119
|
+
cards.split(Aro::Teck::CARD_DELIM.to_s).map{|c| [I18n.t("cards.#{Aro::Teck.card_strip(c)}.name"), c]}.to_h,
|
|
120
|
+
per_page: Aro::Config.display_configuration[:HEIGHT] - Aro::Mancy::S,
|
|
127
121
|
cycle: true,
|
|
128
122
|
default: Aro::Mancy::S
|
|
129
123
|
)
|
|
130
124
|
# {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::
|
|
125
|
+
definition = I18n.t("cards.#{Aro::Teck.card_strip(answer)}")
|
|
132
126
|
indent = Aro::Mancy::N
|
|
133
127
|
Aro::P.say(definition[:name])
|
|
134
128
|
Aro::P.say(definition[:summary])
|
|
@@ -140,27 +134,27 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
140
134
|
end
|
|
141
135
|
|
|
142
136
|
def shuffle
|
|
143
|
-
# shuffles the current
|
|
144
|
-
update(cards: cards.split(Aro::
|
|
137
|
+
# shuffles the current teck and generates a log record.
|
|
138
|
+
update(cards: cards.split(Aro::Teck::CARD_DELIM.to_s).shuffle.join(Aro::Teck::CARD_DELIM.to_s))
|
|
145
139
|
end
|
|
146
140
|
|
|
147
141
|
def reset
|
|
148
|
-
# completely reset the
|
|
142
|
+
# completely reset the teck. replace all drawn and reset order.
|
|
149
143
|
# all orientations will be set to upright.
|
|
150
|
-
update(cards: Aro::
|
|
144
|
+
update(cards: Aro::Teck.fresh_cards, drawn: "")
|
|
151
145
|
end
|
|
152
146
|
|
|
153
147
|
def replace
|
|
154
148
|
# replaces all drawn cards FIFO and puts them on the bottom of
|
|
155
|
-
# the
|
|
156
|
-
cards_arr = cards.split(Aro::
|
|
157
|
-
drawn_arr = drawn&.split(Aro::
|
|
149
|
+
# the teck. this will preserve all card orientations.
|
|
150
|
+
cards_arr = cards.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
151
|
+
drawn_arr = drawn&.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
158
152
|
|
|
159
153
|
# append each drawn card to cards
|
|
160
154
|
drawn_arr.each{|dc| cards_arr << dc }
|
|
161
155
|
|
|
162
156
|
# clear drawn
|
|
163
|
-
update(drawn: "", cards: cards_arr.join(Aro::
|
|
157
|
+
update(drawn: "", cards: cards_arr.join(Aro::Teck::CARD_DELIM.to_s))
|
|
164
158
|
end
|
|
165
159
|
|
|
166
160
|
def draw(is_dt_dimension: true, z_max: 7, z: 1)
|
|
@@ -171,11 +165,11 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
171
165
|
dev_tarot = nil
|
|
172
166
|
|
|
173
167
|
# get cards
|
|
174
|
-
cards_arr = cards.split(Aro::
|
|
168
|
+
cards_arr = cards.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
175
169
|
# get abs_cards
|
|
176
|
-
abs_cards_arr = cards_arr.map{|c| Aro::
|
|
170
|
+
abs_cards_arr = cards_arr.map{|c| Aro::Teck.card_strip(c)}
|
|
177
171
|
# get drawn
|
|
178
|
-
drawn_arr = drawn&.split(Aro::
|
|
172
|
+
drawn_arr = drawn&.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
179
173
|
|
|
180
174
|
if cards_arr.empty?
|
|
181
175
|
Aro::P.say("there are no cards left to draw.")
|
|
@@ -224,8 +218,8 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
224
218
|
|
|
225
219
|
# update database
|
|
226
220
|
update(
|
|
227
|
-
cards: cards_arr.join(Aro::
|
|
228
|
-
drawn: drawn_arr.join(Aro::
|
|
221
|
+
cards: cards_arr.join(Aro::Teck::CARD_DELIM.to_s),
|
|
222
|
+
drawn: drawn_arr.join(Aro::Teck::CARD_DELIM.to_s)
|
|
229
223
|
)
|
|
230
224
|
end
|
|
231
225
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
tlog.rb
|
|
4
|
+
|
|
5
|
+
teck tlog object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"./teck".to_s
|
|
12
|
+
|
|
13
|
+
class Aro::Tlog < ActiveRecord::Base
|
|
14
|
+
belongs_to :teck, :class_name => :"#{Aro::Teck.name}".to_s
|
|
15
|
+
|
|
16
|
+
ORDERING = {
|
|
17
|
+
ASC: :asc,
|
|
18
|
+
DESC: :desc
|
|
19
|
+
}
|
|
20
|
+
end
|
data/sys/aro/v.rb
CHANGED
data/sys/cli/constants.rb
CHANGED
data/sys/cli/dom.rb
CHANGED
|
@@ -26,7 +26,7 @@ module CLI
|
|
|
26
26
|
Aro::P.say(I18n.t("dom.errors.failed_already_initialized"))
|
|
27
27
|
elsif Aro::Dom.in_arodom? && !Aro::Dom.is_initialized?
|
|
28
28
|
arodome = Aro::Dom.new
|
|
29
|
-
arodome.generate
|
|
29
|
+
arodome.generate(ARGV[Aro::Mancy::OS], ARGV[Aro::Mancy::E])
|
|
30
30
|
else
|
|
31
31
|
CLI::Nterface.exit_error_invalid_usage!
|
|
32
32
|
end
|