aro 0.1.7 → 0.1.9
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/aro.gemspec +3 -3
- data/bin/aos +24 -0
- data/bin/aro +5 -2
- data/checksums/aro-0.1.7.gem.sha512 +1 -0
- data/checksums/aro-0.1.8.gem.sha512 +1 -0
- data/checksums/aro-0.1.9.gem.sha512 +1 -0
- data/db/migrate/1763374647_create_decks.rb +5 -2
- data/db/migrate/1763432541_create_logs.rb +1 -0
- data/db/migrate/1765148774_create_yous.rb +19 -0
- data/listen.rb +1 -1
- data/locale/en.aos.yml +31 -0
- data/locale/en.cngelog.yml +5 -0
- data/locale/en.dom.yml +42 -0
- data/locale/en.usage.yml +23 -13
- data/locale/en.yml +43 -34
- data/sys/aos/aos.rb +282 -0
- data/sys/aos/db.rb +80 -0
- data/sys/aos/s.rb +25 -0
- data/sys/aos/views/base.rb +155 -0
- data/sys/aos/views/dom.rb +36 -0
- data/sys/aos/views/games/abpps.rb +21 -0
- data/sys/aos/views/games/game.rb +114 -0
- data/sys/aos/views/games/hbpps.rb +21 -0
- data/sys/aos/views/games/shpps.rb +21 -0
- data/sys/aos/views/games/vipps.rb +21 -0
- data/sys/aos/views/games.rb +19 -0
- data/sys/aos/views/know/library.rb +19 -0
- data/sys/aos/views/know/temple.rb +19 -0
- data/sys/aos/views/know.rb +19 -0
- data/sys/aos/views/setup/settings.rb +37 -0
- data/sys/aos/views/setup.rb +19 -0
- data/sys/aos/views/welcome/waite.rb +19 -0
- data/sys/aos/views/welcome/winner.rb +19 -0
- data/sys/aos/views/welcome.rb +19 -0
- data/sys/aos/you.rb +19 -0
- data/sys/aro/d.rb +1 -1
- data/sys/aro/db.rb +5 -13
- data/sys/aro/mancy.rb +23 -19
- data/sys/aro/p.rb +2 -2
- data/sys/aro/v.rb +2 -3
- data/sys/aro.rb +1 -0
- data/sys/cli/config.rb +244 -123
- data/sys/cli/constants.rb +8 -5
- data/sys/cli/deck.rb +13 -8
- data/sys/cli/dom.rb +16 -17
- data/sys/cli/nterface.rb +6 -0
- data/sys/dom/d.rb +24 -19
- data/sys/dom/dom.rb +74 -96
- data/sys/dom/p.rb +1 -1
- data/sys/models/deck.rb +23 -13
- data/sys/models/log.rb +12 -2
- data/sys/reiquire.rb +3 -2
- data/sys/shr/prompt.rb +12 -4
- data/sys/shr/t.rb +12 -10
- data/sys/shr/version.rb +4 -4
- metadata +52 -27
- data/sys/views/base.rb +0 -29
- data/sys/views/dom.rb +0 -27
- data/sys/views/games/deck.rb +0 -97
- data/sys/views/games/menu.rb +0 -27
- data/sys/views/setup/setup.rb +0 -27
data/sys/cli/dom.rb
CHANGED
|
@@ -10,36 +10,35 @@
|
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
12
|
def self.dom
|
|
13
|
-
action = CLI::ARGV1&.to_sym
|
|
14
|
-
|
|
15
|
-
CLI::Nterface.exit_error_invalid_usage! unless CLI::CMDS[:DOM].values.include?(action)
|
|
16
|
-
|
|
17
13
|
if CLI::FLAGS[:HELP].include?(CLI::ARGV1)
|
|
18
14
|
CLI.usage::usage
|
|
19
15
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
20
|
-
elsif CLI::ARGV1.nil?
|
|
21
|
-
# no args, default dom action
|
|
22
|
-
Aro::Dom.map
|
|
23
16
|
end
|
|
24
17
|
|
|
18
|
+
action = CLI::ARGV1&.to_sym
|
|
19
|
+
|
|
20
|
+
CLI::Nterface.exit_error_invalid_usage! unless !action.nil? &&
|
|
21
|
+
CLI::CMDS[:DOM].values.include?(action)
|
|
22
|
+
|
|
25
23
|
case action
|
|
26
|
-
when CLI::CMDS[:DOM][:MAP]
|
|
27
|
-
Aro::Dom.map
|
|
28
24
|
when CLI::CMDS[:DOM][:INIT]
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
31
33
|
when CLI::CMDS[:DOM][:NEW]
|
|
32
34
|
CLI::Nterface.exit_error_missing_args! if CLI::ARGV2.nil?
|
|
33
35
|
if Aro::Dom.in_arodom?
|
|
34
|
-
|
|
35
|
-
|
|
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"))
|
|
36
39
|
else
|
|
37
40
|
Aro::Dom.create(CLI::ARGV2.to_s)
|
|
38
41
|
end
|
|
39
|
-
else
|
|
40
|
-
if CLI::CMDS[:DOM].values.include?(action)
|
|
41
|
-
# todo:
|
|
42
|
-
end
|
|
43
42
|
end
|
|
44
43
|
end
|
|
45
44
|
end
|
data/sys/cli/nterface.rb
CHANGED
|
@@ -21,5 +21,11 @@ module CLI
|
|
|
21
21
|
Aro::P.say(I18n.t("cli.errors.invalid_usage", cmd: Aro::Mancy::I2097I))
|
|
22
22
|
exit(CLI::EXIT_CODES[:INVALID_ARG])
|
|
23
23
|
end
|
|
24
|
+
|
|
25
|
+
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])
|
|
29
|
+
end
|
|
24
30
|
end
|
|
25
31
|
end
|
data/sys/dom/d.rb
CHANGED
|
@@ -12,54 +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: "
|
|
21
|
-
},
|
|
22
|
-
WELCOME: {
|
|
23
|
-
name: Aro::Dom::WELCOME,
|
|
24
|
-
description: "sign in."
|
|
30
|
+
description: I18n.t("dom.rooms.waite.description"),
|
|
25
31
|
},
|
|
26
32
|
WINNER: {
|
|
27
33
|
name: Aro::Dom::WINNER,
|
|
28
|
-
description: "
|
|
34
|
+
description: I18n.t("dom.rooms.winner.description"),
|
|
29
35
|
},
|
|
30
36
|
},
|
|
31
37
|
GAMES: {
|
|
32
38
|
ABPPS: {
|
|
33
39
|
name: Aro::Dom::ABPPS,
|
|
34
|
-
description: "
|
|
40
|
+
description: I18n.t("dom.rooms.abpps.description"),
|
|
35
41
|
},
|
|
36
42
|
HBPPS: {
|
|
37
43
|
name: Aro::Dom::HBPPS,
|
|
38
|
-
description: "
|
|
44
|
+
description: I18n.t("dom.rooms.hbpps.description"),
|
|
39
45
|
},
|
|
40
46
|
SHPPS: {
|
|
41
47
|
name: Aro::Dom::SHPPS,
|
|
42
|
-
description: "
|
|
48
|
+
description: I18n.t("dom.rooms.shpps.description"),
|
|
43
49
|
},
|
|
44
50
|
VIPPS: {
|
|
45
51
|
name: Aro::Dom::VIPPS,
|
|
46
|
-
description: "
|
|
52
|
+
description: I18n.t("dom.rooms.vipps.description"),
|
|
47
53
|
},
|
|
48
54
|
},
|
|
49
55
|
KNOW: {
|
|
50
56
|
LIBRARY: {
|
|
51
57
|
name: Aro::Dom::LIBRARY,
|
|
52
|
-
description: "
|
|
58
|
+
description: I18n.t("dom.rooms.library.description"),
|
|
53
59
|
},
|
|
54
60
|
TEMPLE: {
|
|
55
61
|
name: Aro::Dom::TEMPLE,
|
|
56
|
-
description: "
|
|
62
|
+
description: I18n.t("dom.rooms.temple.description"),
|
|
57
63
|
},
|
|
58
64
|
},
|
|
59
65
|
SETUP: {
|
|
60
66
|
SETTINGS: {
|
|
61
67
|
name: Aro::Dom::SETTINGS,
|
|
62
|
-
description: "
|
|
68
|
+
description: I18n.t("dom.rooms.settings.description"),
|
|
63
69
|
},
|
|
64
70
|
},
|
|
65
71
|
}
|
|
@@ -68,16 +74,15 @@ module Aro
|
|
|
68
74
|
LAYOUT = {
|
|
69
75
|
WELCOME: {
|
|
70
76
|
name: Aro::Dom::WELCOME,
|
|
71
|
-
description: "
|
|
77
|
+
description: I18n.t("dom.wings.welcome.description"),
|
|
72
78
|
rooms: [
|
|
73
79
|
Aro::Dom::D::WINGS[:WELCOME][:WAITE],
|
|
74
|
-
Aro::Dom::D::WINGS[:WELCOME][:WELCOME],
|
|
75
80
|
Aro::Dom::D::WINGS[:WELCOME][:WINNER],
|
|
76
81
|
]
|
|
77
82
|
},
|
|
78
83
|
GAMES: {
|
|
79
84
|
name: Aro::Dom::GAMES,
|
|
80
|
-
description: "
|
|
85
|
+
description: I18n.t("dom.wings.games.description"),
|
|
81
86
|
rooms: [
|
|
82
87
|
Aro::Dom::D::WINGS[:GAMES][:ABPPS],
|
|
83
88
|
Aro::Dom::D::WINGS[:GAMES][:HBPPS],
|
|
@@ -87,7 +92,7 @@ module Aro
|
|
|
87
92
|
},
|
|
88
93
|
KNOW: {
|
|
89
94
|
name: Aro::Dom::KNOW,
|
|
90
|
-
description: "
|
|
95
|
+
description: I18n.t("dom.wings.know.description"),
|
|
91
96
|
rooms: [
|
|
92
97
|
Aro::Dom::D::WINGS[:KNOW][:LIBRARY],
|
|
93
98
|
Aro::Dom::D::WINGS[:KNOW][:TEMPLE]
|
|
@@ -95,7 +100,7 @@ module Aro
|
|
|
95
100
|
},
|
|
96
101
|
SETUP: {
|
|
97
102
|
name: Aro::Dom::SETUP,
|
|
98
|
-
description: "
|
|
103
|
+
description: I18n.t("dom.wings.setup.description"),
|
|
99
104
|
rooms: [
|
|
100
105
|
Aro::Dom::D::WINGS[:SETUP][:SETTINGS]
|
|
101
106
|
],
|
data/sys/dom/dom.rb
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
|
+
require_relative :"../aos/s".to_s
|
|
12
|
+
|
|
11
13
|
module Aro
|
|
12
14
|
class Dom
|
|
13
|
-
PS1 = Aro::Dom.name
|
|
15
|
+
PS1 = :">[#{Aro::Dom.name}]>: "
|
|
14
16
|
DOT = :"."
|
|
15
17
|
DOTT = :"#{DOT}#{DOT}"
|
|
16
18
|
ETHERGEIST = :ethergeist
|
|
@@ -46,12 +48,11 @@ module Aro
|
|
|
46
48
|
|
|
47
49
|
def self.create(name)
|
|
48
50
|
if Dir.exist?(name) || File.exist?(name)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
Aro::Dom::P.say(I18n.t("dom.errors.failed_directory_exists", name: name))
|
|
52
|
+
return
|
|
51
53
|
end
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
Aro::Dom::P.say("creating arodome named #{name}")
|
|
55
|
+
Aro::Dom::P.say(I18n.t("dom.messages.creating_arodome", name: name))
|
|
55
56
|
FileUtils.mkdir(name)
|
|
56
57
|
ether_file_path = "#{name}/#{Aro::Dom::ETHER_FILE}"
|
|
57
58
|
FileUtils.mkdir(ether_file_path)
|
|
@@ -59,51 +60,87 @@ module Aro
|
|
|
59
60
|
file.write(name)
|
|
60
61
|
end
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
Aro::Dom::P.say("#{name} arodome created. enter the following commands to begin.")
|
|
64
|
-
Aro::Dom::P.say("$ cd #{name}")
|
|
65
|
-
Aro::Dom::P.say("$ aro dom init")
|
|
63
|
+
Aro::Dom::P.say(I18n.t("dom.messages.arodome_created", name: name))
|
|
66
64
|
end
|
|
67
65
|
|
|
68
66
|
def self.in_arodom?
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
!Aro::Dom.ethergeist_path.nil?
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.is_initialized?
|
|
71
|
+
File.exist?(File.join(Aro::Dom::ethergeist_path, Aos::Db::SQL_FILE.to_s))
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.domain
|
|
75
|
+
"#{Aro::Dom}#{Aos::Os::A}#{Aro::Dom.ethergeist_name}"
|
|
76
|
+
end
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
def self.dom_root
|
|
79
|
+
Aro::Dom.in_arodom? ? File.dirname(Aro::Dom::ethergeist_path) : nil
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.room_path(needle)
|
|
83
|
+
return nil if needle.nil?
|
|
84
|
+
needle = needle.to_s.strip
|
|
85
|
+
found_space = nil
|
|
86
|
+
found_room = nil
|
|
87
|
+
Aro::Dom::D::LAYOUT.values.each{|layout|
|
|
88
|
+
next unless found_room.nil?
|
|
89
|
+
found_space = layout[:name].to_s
|
|
90
|
+
if found_space == needle
|
|
91
|
+
found_room = found_space
|
|
92
|
+
found_space = nil
|
|
93
|
+
else
|
|
94
|
+
layout[:rooms].each{|room|
|
|
95
|
+
if room[:name].to_s == needle
|
|
96
|
+
found_room = room[:name].to_s
|
|
97
|
+
end
|
|
98
|
+
}
|
|
99
|
+
end
|
|
76
100
|
}
|
|
101
|
+
found_space = nil if found_room.nil?
|
|
102
|
+
|
|
103
|
+
[found_space, found_room].compact.join("/")
|
|
77
104
|
end
|
|
78
105
|
|
|
79
106
|
def self.ethergeist_path
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
107
|
+
path = nil
|
|
108
|
+
search_path = Dir.pwd.split("/").reject{|p| p.empty?}
|
|
109
|
+
search_pwd = "/"
|
|
110
|
+
|
|
111
|
+
search_path.any?{|step|
|
|
112
|
+
search_pwd = File.join(search_pwd, step)
|
|
113
|
+
ls = Dir.glob("#{search_pwd}/#{ETHER_FILE}", File::FNM_DOTMATCH)
|
|
114
|
+
path = ls.first if ls.any?
|
|
115
|
+
!path.nil?
|
|
116
|
+
}
|
|
83
117
|
|
|
84
|
-
|
|
85
|
-
File.join(Aro::Dom::ETHER_FILE.to_s, Aro::Mancy::NAME_FILE.to_s)
|
|
118
|
+
return path
|
|
86
119
|
end
|
|
87
120
|
|
|
88
|
-
def
|
|
89
|
-
|
|
121
|
+
def self.ethergeist_name
|
|
122
|
+
return nil unless Aro::Dom.in_arodom?
|
|
123
|
+
|
|
124
|
+
File.read(
|
|
125
|
+
File.join(
|
|
126
|
+
Aro::Dom.ethergeist_path, Aro::Mancy::NAME_FILE.to_s
|
|
127
|
+
)
|
|
128
|
+
)
|
|
90
129
|
end
|
|
91
130
|
|
|
92
131
|
def generate
|
|
93
132
|
return unless Aro::Dom.in_arodom?
|
|
94
133
|
|
|
95
134
|
# todo: add file permissions to Aro::Dom::ARODOME and all WINGS
|
|
96
|
-
|
|
97
|
-
Aro::Dom::P.say("generating wings...")
|
|
135
|
+
Aro::Dom::P.say(I18n.t("dom.messages.generating_wings"))
|
|
98
136
|
Aro::Dom::D::LAYOUT.values.each{|w| generate_wing w}
|
|
99
|
-
|
|
100
|
-
Aro::Dom::P.say("
|
|
137
|
+
Aos::Db::new
|
|
138
|
+
Aro::Dom::P.say(I18n.t("dom.messages.initialization_complete", name: Aro::Dom.name))
|
|
101
139
|
end
|
|
102
140
|
|
|
103
141
|
def generate_wing(wing)
|
|
104
142
|
return unless Aro::Dom::D::LAYOUT.values.include?(wing)
|
|
105
|
-
|
|
106
|
-
Aro::Dom::P.say("generating the #{wing[:name]} wing...")
|
|
143
|
+
Aro::Dom::P.say(I18n.t("dom.messages.generating_wing", wing: wing[:name].to_s))
|
|
107
144
|
FileUtils.mkdir(wing[:name].to_s)
|
|
108
145
|
|
|
109
146
|
wing[:rooms].each{|r| generate_room(wing, r)}
|
|
@@ -112,7 +149,8 @@ module Aro
|
|
|
112
149
|
def generate_room(wing, room)
|
|
113
150
|
return unless Aro::Dom::D::WINGS[wing[:name].upcase].values.include?(room)
|
|
114
151
|
|
|
115
|
-
Aro::Dom::P.say("
|
|
152
|
+
Aro::Dom::P.say(I18n.t("dom.messages.generating_room", room: room[:name].to_s))
|
|
153
|
+
|
|
116
154
|
room_path = File.join(wing[:name].to_s, room[:name].to_s)
|
|
117
155
|
FileUtils.mkdir(room_path)
|
|
118
156
|
|
|
@@ -123,72 +161,12 @@ module Aro
|
|
|
123
161
|
end
|
|
124
162
|
end
|
|
125
163
|
|
|
126
|
-
def self.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
map_str = "\n"
|
|
134
|
-
map_str += divider
|
|
135
|
-
|
|
136
|
-
# todo: ethergeist_path
|
|
137
|
-
map_name = File.read(Aro::Dom.ethergeist_path).upcase
|
|
138
|
-
Aro::V.say("map_name: #{map_name}")
|
|
139
|
-
title_divider = dc[:DIVIDER] * ((width - map_name.length) / Aro::Mancy::OS)
|
|
140
|
-
map_str += (title_divider + map_name).ljust(width, dc[:DIVIDER]) + "\n"
|
|
141
|
-
map_str += divider
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Aro::P.say(map_str)
|
|
164
|
+
def self.ethergeist_name
|
|
165
|
+
File.read(
|
|
166
|
+
File.join(
|
|
167
|
+
Aro::Dom.ethergeist_path, Aro::Mancy::NAME_FILE.to_s
|
|
168
|
+
)
|
|
169
|
+
)
|
|
146
170
|
end
|
|
147
|
-
end
|
|
171
|
+
end
|
|
148
172
|
end # aroadhome
|
|
149
|
-
|
|
150
|
-
=begin
|
|
151
|
-
-----------------------------------------------------------------------------
|
|
152
|
-
-----------------------------------------------------------------------------
|
|
153
|
-
-------------------------------ARODOME MAP-----------------------------------
|
|
154
|
-
-----------------------------------------------------------------------------
|
|
155
|
-
-----------------------------------------------------------------------------
|
|
156
|
-
| |
|
|
157
|
-
| |
|
|
158
|
-
| |
|
|
159
|
-
| |
|
|
160
|
-
| |
|
|
161
|
-
| GAMES |
|
|
162
|
-
| |
|
|
163
|
-
| |
|
|
164
|
-
| |
|
|
165
|
-
| |
|
|
166
|
-
| |
|
|
167
|
-
| |
|
|
168
|
-
| |
|
|
169
|
-
| |
|
|
170
|
-
| WELCOME KNOW |
|
|
171
|
-
| |
|
|
172
|
-
| |
|
|
173
|
-
| |
|
|
174
|
-
| |
|
|
175
|
-
| . |
|
|
176
|
-
| |
|
|
177
|
-
| |
|
|
178
|
-
| |
|
|
179
|
-
| |
|
|
180
|
-
| |
|
|
181
|
-
| |
|
|
182
|
-
| |
|
|
183
|
-
| |
|
|
184
|
-
| .. SETUP |
|
|
185
|
-
| |
|
|
186
|
-
| |
|
|
187
|
-
| |
|
|
188
|
-
| |
|
|
189
|
-
-----------------------------------------------------------------------------
|
|
190
|
-
-----------------------------------------------------------------------------
|
|
191
|
-
-----------------------------------------------------------------------------
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
=end
|
data/sys/dom/p.rb
CHANGED
data/sys/models/deck.rb
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
deck.rb
|
|
4
|
+
|
|
5
|
+
deck object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
1
11
|
require :base64.to_s
|
|
2
12
|
require_relative :"../shr/t".to_s
|
|
3
13
|
|
|
@@ -11,6 +21,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
11
21
|
after_commit :generate_log
|
|
12
22
|
|
|
13
23
|
def self.make(new_name)
|
|
24
|
+
return nil unless Aro::Mancy.is_initialized?
|
|
14
25
|
Aro::Db.new
|
|
15
26
|
new_deck = Aro::Deck.create(name: new_name)
|
|
16
27
|
if Aro::Deck.current_deck.nil?
|
|
@@ -31,9 +42,9 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
31
42
|
|
|
32
43
|
def generate_log
|
|
33
44
|
prev_cards = Base64::decode64(logs.last.card_data) if logs.any?
|
|
34
|
-
if prev_cards.present? && prev_cards != cards || prev_cards.nil?
|
|
45
|
+
if (prev_cards.present? && prev_cards != cards) || (prev_cards.nil? || prev_cards.empty?)
|
|
35
46
|
logs.create(
|
|
36
|
-
card_data: Base64::encode64(cards),
|
|
47
|
+
card_data: Base64::encode64(cards || ""),
|
|
37
48
|
drawn_data: Base64::encode64(drawn || "")
|
|
38
49
|
)
|
|
39
50
|
end
|
|
@@ -80,6 +91,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
80
91
|
count_n = [[Aro::Mancy::S, count_n.to_i].max, logs.count].min
|
|
81
92
|
Aro::V.say("count_n: #{count_n}")
|
|
82
93
|
Aro::V.say("order_o: #{order_o}")
|
|
94
|
+
|
|
83
95
|
unless Aro::Log::ORDERING.values.include?(order_o)
|
|
84
96
|
Aro::P.say(I18n.t("cli.warnings.invalid_order"))
|
|
85
97
|
order_o = Aro::Log::ORDERING[:DESC]
|
|
@@ -94,20 +106,14 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
94
106
|
# for now tests just expect text output
|
|
95
107
|
return h_logs if CLI::Config.is_test?
|
|
96
108
|
|
|
97
|
-
Aro::
|
|
109
|
+
Aro::D.say(I18n.t("cli.messages.showing", name: name, count: count_n, order: order_o))
|
|
98
110
|
|
|
99
|
-
|
|
111
|
+
Aos::Vi::Game.show_game({
|
|
100
112
|
deck: self,
|
|
101
113
|
h_logs: h_logs,
|
|
102
114
|
count_n: count_n,
|
|
103
115
|
order_o: order_o
|
|
104
116
|
})
|
|
105
|
-
|
|
106
|
-
if count_n == Aro::Mancy::S
|
|
107
|
-
Aro::Vi::Deck.draw(h_text)
|
|
108
|
-
else
|
|
109
|
-
Aro::P.less(h_text)
|
|
110
|
-
end
|
|
111
117
|
end
|
|
112
118
|
|
|
113
119
|
def explore
|
|
@@ -140,7 +146,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
140
146
|
# the deck. this will preserve all card orientations.
|
|
141
147
|
cards_arr = cards.split(Aro::Deck::CARD_DELIM.to_s) || []
|
|
142
148
|
drawn_arr = drawn&.split(Aro::Deck::CARD_DELIM.to_s) || []
|
|
143
|
-
|
|
149
|
+
|
|
144
150
|
# append each drawn card to cards
|
|
145
151
|
drawn_arr.each{|dc| cards_arr << dc }
|
|
146
152
|
|
|
@@ -148,7 +154,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
148
154
|
update(drawn: "", cards: cards_arr.join(Aro::Deck::CARD_DELIM.to_s))
|
|
149
155
|
end
|
|
150
156
|
|
|
151
|
-
def draw(is_dt_dimension: true, z_max: 7, z: 1)
|
|
157
|
+
def draw(is_dt_dimension: true, z_max: 7, z: 1)
|
|
152
158
|
# the true card
|
|
153
159
|
abs_dev_tarot = nil
|
|
154
160
|
|
|
@@ -162,6 +168,10 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
162
168
|
# get drawn
|
|
163
169
|
drawn_arr = drawn&.split(Aro::Deck::CARD_DELIM.to_s) || []
|
|
164
170
|
|
|
171
|
+
if cards_arr.empty?
|
|
172
|
+
Aro::P.say("there are no cards left to draw.")
|
|
173
|
+
return
|
|
174
|
+
end
|
|
165
175
|
sleeps = 0
|
|
166
176
|
sleeps_max = z_max
|
|
167
177
|
|
|
@@ -169,7 +179,7 @@ class Aro::Deck < ActiveRecord::Base
|
|
|
169
179
|
while sleeps <= sleeps_max && dev_tarot.nil? do
|
|
170
180
|
# use fallback randomness if /dev/tarot unavailable
|
|
171
181
|
if !is_dt_dimension || !File.exist?(Aro::T::DEV_TAROT_FILE.to_s)
|
|
172
|
-
dev_tarot = Aro::T.summon_ruby_facot
|
|
182
|
+
dev_tarot = Aro::T.summon_ruby_facot.split("")
|
|
173
183
|
else
|
|
174
184
|
# preferred randomness
|
|
175
185
|
read_value = Aro::T.read_dev_tarot&.strip&.split("")
|
data/sys/models/log.rb
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
log.rb
|
|
4
|
+
|
|
5
|
+
log object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
1
11
|
require_relative :"./deck".to_s
|
|
2
12
|
|
|
3
13
|
class Aro::Log < ActiveRecord::Base
|
|
14
|
+
belongs_to :deck, :class_name => :"#{Aro::Deck.name}".to_s
|
|
15
|
+
|
|
4
16
|
ORDERING = {
|
|
5
17
|
ASC: :asc,
|
|
6
18
|
DESC: :desc
|
|
7
19
|
}
|
|
8
|
-
|
|
9
|
-
belongs_to :deck, :class_name => :"#{Aro::Deck.name}".to_s
|
|
10
20
|
end
|
data/sys/reiquire.rb
CHANGED
|
@@ -14,6 +14,7 @@ require :"active_record/schema_dumper".to_s
|
|
|
14
14
|
require :base64.to_s
|
|
15
15
|
require :fileutils.to_s
|
|
16
16
|
require :i18n.to_s
|
|
17
|
+
require :readline.to_s
|
|
17
18
|
require :"tty-prompt".to_s
|
|
18
19
|
require :yaml.to_s
|
|
19
20
|
|
|
@@ -29,7 +30,7 @@ module Reiquire
|
|
|
29
30
|
I18n.default_locale = :en
|
|
30
31
|
|
|
31
32
|
# require all aro folders
|
|
32
|
-
Reiquire::requires [:aro, :cli, :dom, :models, :shr, :views]
|
|
33
|
+
Reiquire::requires [:aro, :cli, :dom, :models, :shr, :views, :aos]
|
|
33
34
|
|
|
34
35
|
# require cli module
|
|
35
36
|
require_relative :"./cli".to_s
|
|
@@ -38,7 +39,7 @@ module Reiquire
|
|
|
38
39
|
def self.requires(dirs)
|
|
39
40
|
dirs.each{|d|
|
|
40
41
|
Dir[
|
|
41
|
-
File.join(__dir__, d.to_s, :"
|
|
42
|
+
File.join(__dir__, d.to_s, :"**/**/*.rb".to_s)
|
|
42
43
|
].each { |f| require f}
|
|
43
44
|
}
|
|
44
45
|
end
|
data/sys/shr/prompt.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
=begin
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
prompt.rb
|
|
4
4
|
|
|
5
5
|
base logger for aro.
|
|
@@ -19,15 +19,23 @@ module Aro
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def self.p
|
|
22
|
-
|
|
22
|
+
Aro::Prompt.instance.prompt
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.should_print?
|
|
26
|
+
CLI::Config::BOOLS[:TRUE]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.should_print?
|
|
30
|
+
CLI::Config::BOOLS[:TRUE]
|
|
23
31
|
end
|
|
24
32
|
|
|
25
33
|
def self.say(message)
|
|
26
34
|
raise :override_me.to_s
|
|
27
35
|
end
|
|
28
36
|
|
|
29
|
-
def self.less(
|
|
30
|
-
IO.popen("less -X", "w") { |f| f.puts
|
|
37
|
+
def self.less(message)
|
|
38
|
+
IO.popen("less -X", "w") { |f| f.puts(message) }
|
|
31
39
|
end
|
|
32
40
|
end
|
|
33
41
|
end
|
data/sys/shr/t.rb
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
module Aro
|
|
12
12
|
module T
|
|
13
13
|
DEV_TAROT_FILE = :"/dev/tarot"
|
|
14
|
-
|
|
14
|
+
DEV_TAROT = :"Dev::Tarot".to_s
|
|
15
15
|
RUBY_FACOT = :"Ruby::Facot".to_s
|
|
16
16
|
|
|
17
17
|
def self.is_dev_tarot?
|
|
@@ -21,19 +21,21 @@ module Aro
|
|
|
21
21
|
# read dev_tarot
|
|
22
22
|
def self.read_dev_tarot
|
|
23
23
|
dt = nil
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
29
|
+
Aro::V.say("warning: summoning ruby_facot in #{__method__}")
|
|
30
|
+
dt = Aro::T.summon_ruby_facot unless Aro::T.is_dev_tarot?
|
|
31
|
+
end
|
|
30
32
|
return dt
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
# summon ruby_facot
|
|
34
|
-
def self.summon_ruby_facot
|
|
35
|
-
Aro::
|
|
36
|
-
ruby_facot =
|
|
36
|
+
def self.summon_ruby_facot
|
|
37
|
+
Aro::D.say(I18n.t("cli.messages.ruby_facot_random"))
|
|
38
|
+
ruby_facot = I18n.t("cards.index").map{|c| "+#{c}"}.sample.split("")
|
|
37
39
|
|
|
38
40
|
# get orientation
|
|
39
41
|
ruby_facot_str = ["+","-"].sample
|
data/sys/shr/version.rb
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module Aro
|
|
12
|
-
VERSION = :"0.1.
|
|
12
|
+
VERSION = :"0.1.9"
|
|
13
13
|
RELEASE_NOTES = :"this version".to_s + [
|
|
14
|
-
"adds views",
|
|
15
|
-
"adds
|
|
16
|
-
"adds
|
|
14
|
+
"adds improved views.",
|
|
15
|
+
"adds aro gameplay within an arodome game room.",
|
|
16
|
+
"adds ability to set config ivars from aos."
|
|
17
17
|
].join(",")
|
|
18
18
|
end
|