aro 0.2.5 → 0.2.7
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 +2 -2
- data/.ruby-version +1 -0
- data/Gemfile.lock +109 -89
- data/README.md +10 -54
- data/aro.gemspec +12 -12
- data/bin/oss_om +17 -0
- data/checksums/aro-0.2.5.gem.sha512 +1 -0
- data/checksums/aro-0.2.6.gem.sha512 +1 -0
- data/checksums/aro-0.2.7.gem.sha512 +1 -0
- data/listen.rb +1 -1
- data/locale/en.cor.yml +22 -36
- data/locale/en.menu_items.yml +2 -0
- data/locale/en.menus.yml +2 -0
- data/locale/en.yml +14 -55
- data/sys/aro/action.rb +153 -0
- data/sys/aro/d.rb +6 -3
- data/sys/aro/db/migrate/.DS_Store +0 -0
- data/sys/aro/db/migrate/1793913747_create_data_bases.rb +15 -0
- data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +16 -0
- data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +14 -0
- data/sys/aro/db/migrate/1793913841_create_menus.rb +13 -0
- data/sys/aro/db/migrate/1793913861_create_menu_items.rb +15 -0
- data/sys/aro/db.rb +62 -37
- data/sys/aro/designer.rb +350 -0
- data/sys/aro/locale.rb +138 -0
- data/sys/aro/mancy.rb +30 -38
- data/sys/aro/models/concerns/.keep +0 -0
- data/sys/aro/models/concerns/tar_go_for_root_sec.rb +37 -0
- data/sys/aro/models/concerns/uuid.rb +31 -0
- data/sys/aro/models/data_base.rb +122 -0
- data/sys/aro/models/directory.rb +46 -0
- data/sys/aro/models/file.rb +29 -0
- data/sys/aro/models/menu.rb +91 -0
- data/sys/aro/models/menu_item.rb +113 -0
- data/sys/aro/oss_open_menu.rb +331 -0
- data/sys/aro/p.rb +15 -6
- data/sys/aro/r.rb +3 -2
- data/sys/aro/settings/cor.rb +602 -0
- data/sys/aro/settings/git.rb +69 -0
- data/sys/aro/settings/ssh.rb +123 -0
- data/sys/aro/store.rb +198 -0
- data/sys/aro/v.rb +4 -2
- data/sys/aro.rb +3 -2
- data/sys/ma_ain.rb +202 -0
- data/sys/reiquire.rb +133 -25
- data/sys/shr/.DS_Store +0 -0
- data/sys/shr/prompt.rb +13 -2
- data/sys/shr/version.rb +8 -2
- data/tasks/make.rake +2 -1
- metadata +65 -120
- data/bin/aos +0 -31
- data/bin/aro +0 -50
- data/bin/ino +0 -22
- data/ino_rules_todo.txt +0 -28
- data/locale/en.abot.yml +0 -81
- data/locale/en.amg.yml +0 -44
- data/locale/en.aos.yml +0 -40
- data/locale/en.cards.yml +0 -519
- data/locale/en.data.yml +0 -30
- data/locale/en.dom.yml +0 -47
- data/locale/en.flie.yml +0 -29
- data/locale/en.ino.yml +0 -9
- data/locale/en.usage.yml +0 -219
- data/sys/aos/abot.rb +0 -254
- data/sys/aos/amg.rb +0 -184
- data/sys/aos/aos.rb +0 -672
- data/sys/aos/cor.rb +0 -770
- data/sys/aos/data.rb +0 -117
- data/sys/aos/db/migrate/1765148774_create_yous.rb +0 -20
- data/sys/aos/db/migrate/1765762724_create_ilibs.rb +0 -22
- data/sys/aos/db/migrate/1765907766_create_ilogs.rb +0 -18
- data/sys/aos/db/migrate/1765933985_create_agodos.rb +0 -22
- data/sys/aos/db/migrate/1766203888_create_fpxies.rb +0 -18
- data/sys/aos/db.rb +0 -105
- data/sys/aos/flie.rb +0 -144
- data/sys/aos/models/agodo.rb +0 -103
- data/sys/aos/models/fpxy.rb +0 -26
- data/sys/aos/models/ilib.rb +0 -46
- data/sys/aos/models/ilog.rb +0 -27
- data/sys/aos/models/you.rb +0 -138
- data/sys/aos/s.rb +0 -26
- data/sys/aos/vws/base.rb +0 -159
- data/sys/aos/vws/dom.rb +0 -32
- data/sys/aos/vws/games/abot.rb +0 -21
- data/sys/aos/vws/games/ino.rb +0 -21
- data/sys/aos/vws/games/teck.rb +0 -122
- data/sys/aos/vws/games.rb +0 -19
- data/sys/aos/vws/home.rb +0 -23
- data/sys/aos/vws/know/body.rb +0 -19
- data/sys/aos/vws/know/mind.rb +0 -19
- data/sys/aos/vws/know/spirit.rb +0 -19
- data/sys/aos/vws/know.rb +0 -19
- data/sys/aos/vws/root/amg.rb +0 -21
- data/sys/aos/vws/root/config.rb +0 -21
- data/sys/aos/vws/root/data.rb +0 -21
- data/sys/aos/vws/root/flie.rb +0 -21
- data/sys/aos/vws/root.rb +0 -19
- data/sys/aos/vws/welcome/waite.rb +0 -31
- data/sys/aos/vws/welcome/winner.rb +0 -19
- data/sys/aos/vws/welcome.rb +0 -66
- data/sys/aro/db/migrate/1763374647_create_tecks.rb +0 -20
- data/sys/aro/db/migrate/1763432541_create_tlogs.rb +0 -20
- data/sys/aro/db/migrate/1768856981_create_scrolls.rb +0 -20
- data/sys/aro/db/migrate/1768858841_create_legends.rb +0 -16
- data/sys/aro/db/migrate/1768858967_create_stories.rb +0 -17
- data/sys/aro/db/migrate/1768859060_create_chapters.rb +0 -15
- data/sys/aro/db/migrate/1768859126_create_statements.rb +0 -22
- data/sys/aro/db/migrate/1768859144_create_players.rb +0 -18
- data/sys/aro/ino.rb +0 -64
- data/sys/aro/models/chapter.rb +0 -18
- data/sys/aro/models/legend.rb +0 -28
- data/sys/aro/models/player.rb +0 -17
- data/sys/aro/models/scroll.rb +0 -46
- data/sys/aro/models/statement.rb +0 -14
- data/sys/aro/models/story.rb +0 -28
- data/sys/aro/models/teck.rb +0 -260
- data/sys/aro/models/tlog.rb +0 -21
- data/sys/cli/constants.rb +0 -50
- data/sys/cli/create.rb +0 -23
- data/sys/cli/dom.rb +0 -43
- data/sys/cli/nterface.rb +0 -37
- data/sys/cli/teck.rb +0 -108
- data/sys/cli/usage.rb +0 -29
- data/sys/cli.rb +0 -24
- data/sys/dom/d.rb +0 -138
- data/sys/dom/dom.rb +0 -215
- data/sys/dom/p.rb +0 -17
- data/sys/fpx.rb +0 -104
- data/sys/shr/ilib/crs/CMakeLists.txt +0 -12
- data/sys/shr/ilib/crs/compile.sh +0 -5
- data/sys/shr/ilib/crs/crs.c +0 -24
- data/sys/shr/ilib/crs/crs.o +0 -0
- data/sys/shr/ilib/crs/libcrs.so +0 -0
- data/sys/shr/t.rb +0 -74
data/sys/aro/models/teck.rb
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
teck.rb
|
|
4
|
-
|
|
5
|
-
teck object.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
require :base64.to_s
|
|
12
|
-
|
|
13
|
-
class Aro::Teck < ActiveRecord::Base
|
|
14
|
-
has_many :tlogs
|
|
15
|
-
|
|
16
|
-
TECK_FILE = :".aro_teck"
|
|
17
|
-
CARD_DELIM = :","
|
|
18
|
-
|
|
19
|
-
before_create :populate_cards
|
|
20
|
-
after_commit :generate_log
|
|
21
|
-
|
|
22
|
-
def self.make(new_name)
|
|
23
|
-
Aro::Db.load
|
|
24
|
-
return nil unless Aro::Mancy.is_initialized?
|
|
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
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def self.fresh_cards
|
|
31
|
-
I18n.t("cards.index").map{|c| "+#{c}"}.join(Aro::Teck::CARD_DELIM.to_s)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def populate_cards
|
|
35
|
-
Aro::Db.load
|
|
36
|
-
self.cards = Aro::Teck.fresh_cards
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def generate_log
|
|
40
|
-
prev_cards = Base64::decode64(tlogs.last.card_data) if tlogs.any?
|
|
41
|
-
if (prev_cards.present? && prev_cards != cards) || (prev_cards.nil? || prev_cards.empty?)
|
|
42
|
-
tlogs.create(
|
|
43
|
-
card_data: Base64::encode64(cards || ""),
|
|
44
|
-
drawn_data: Base64::encode64(drawn || "")
|
|
45
|
-
)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def self.display_selection_menu
|
|
50
|
-
Aro::Db.load
|
|
51
|
-
unless Aro::Teck.any?
|
|
52
|
-
Aro::P.say(I18n.t("cli.messages.no_tecks"))
|
|
53
|
-
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
54
|
-
end
|
|
55
|
-
c_d = Aro::Teck.current_teck
|
|
56
|
-
Aro::Teck.all.each do |d|
|
|
57
|
-
Aro::P.say("#{d.id == c_d.id ? :*.to_s : " "}#{d.id}): #{d.name}")
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def self.select_teck(teck)
|
|
62
|
-
return unless teck.present?
|
|
63
|
-
Aro::P.say(I18n.t("cli.messages.teck_selected", name: teck.name, room: Aro::Mancy::aro_mancy_name))
|
|
64
|
-
File.open(File.join(Aro::Db.base_aro_dir, Aro::Teck::TECK_FILE.to_s), "w") do |file|
|
|
65
|
-
file.write(teck.id)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def self.current_teck
|
|
70
|
-
Aro::Db.load
|
|
71
|
-
if File.exist?(File.join(Aro::Db.base_aro_dir, TECK_FILE.to_s))
|
|
72
|
-
current_teck_id = File.read(File.join(Aro::Db.base_aro_dir, TECK_FILE.to_s))
|
|
73
|
-
return Aro::Teck.find_by(id: current_teck_id)
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def self.card_strip(card)
|
|
78
|
-
card.gsub(/[+-]/, "").strip
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def show(count_n: Aro::Mancy::S, order_o: Aro::Tlog::ORDERING[:DESC])
|
|
82
|
-
tlogs_count = tlogs.count
|
|
83
|
-
unless count_n.kind_of?(Numeric) && count_n.to_i > Aro::Mancy::O
|
|
84
|
-
if count_n&.to_s&.to_sym == Aro::Mancy::ALL
|
|
85
|
-
count_n = tlogs_count
|
|
86
|
-
else
|
|
87
|
-
count_n = Aro::Mancy::S
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
count_n = [[Aro::Mancy::S, count_n.to_i].max, tlogs_count].min
|
|
91
|
-
Aro::V.say("count_n: #{count_n}")
|
|
92
|
-
Aro::V.say("order_o: #{order_o}")
|
|
93
|
-
|
|
94
|
-
unless Aro::Tlog::ORDERING.values.include?(order_o)
|
|
95
|
-
Aro::P.say(I18n.t("cli.warnings.invalid_order"))
|
|
96
|
-
order_o = Aro::Tlog::ORDERING[:DESC]
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
# perform query
|
|
100
|
-
Aro::Db.load
|
|
101
|
-
tlog_records = tlogs.order(created_at: order_o).first(count_n)
|
|
102
|
-
|
|
103
|
-
# todo: this is doing more work than it needs to. needs debugging.
|
|
104
|
-
# Aro::V.say("tlog_records.count: #{tlog_records.count}")
|
|
105
|
-
|
|
106
|
-
# for now tests just expect count
|
|
107
|
-
return tlog_records if Aos::Cor.is_test?
|
|
108
|
-
|
|
109
|
-
Aro::D.say(I18n.t("cli.messages.showing", name: name, count: count_n, order: order_o))
|
|
110
|
-
|
|
111
|
-
Aos::Vw::Teck.show_game({
|
|
112
|
-
teck: self,
|
|
113
|
-
tlog_records: tlog_records,
|
|
114
|
-
count_n: count_n,
|
|
115
|
-
order_o: order_o
|
|
116
|
-
})
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def explore
|
|
120
|
-
# allows user to browse each card in the current teck.
|
|
121
|
-
answer = Aos::S.p.select(
|
|
122
|
-
Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
|
|
123
|
-
# formatted for tty-prompt gem
|
|
124
|
-
cards.split(Aro::Teck::CARD_DELIM.to_s).map{|c| [I18n.t("cards.#{Aro::Teck.card_strip(c)}.name"), c]}.to_h,
|
|
125
|
-
per_page: Aos::Cor.discon[:HEIGHT] - Aro::Mancy::S,
|
|
126
|
-
cycle: true,
|
|
127
|
-
default: Aro::Mancy::S
|
|
128
|
-
)
|
|
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")}")
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
def shuffle
|
|
170
|
-
# shuffles the current teck and generates a log record.
|
|
171
|
-
update(cards: cards.split(Aro::Teck::CARD_DELIM.to_s).shuffle.join(Aro::Teck::CARD_DELIM.to_s))
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
def reset
|
|
175
|
-
# completely reset the teck. replace all drawn and reset order.
|
|
176
|
-
# all orientations will be set to upright.
|
|
177
|
-
update(cards: Aro::Teck.fresh_cards, drawn: "")
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
def replace
|
|
181
|
-
# replaces all drawn cards FIFO and puts them on the bottom of
|
|
182
|
-
# the teck. this will preserve all card orientations.
|
|
183
|
-
cards_arr = cards.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
184
|
-
drawn_arr = drawn&.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
185
|
-
|
|
186
|
-
# append each drawn card to cards
|
|
187
|
-
drawn_arr.each{|dc| cards_arr << dc }
|
|
188
|
-
|
|
189
|
-
# clear drawn
|
|
190
|
-
update(drawn: "", cards: cards_arr.join(Aro::Teck::CARD_DELIM.to_s))
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
def draw(is_dt_dimension: true, z_max: 7, z: 1)
|
|
194
|
-
# the true card
|
|
195
|
-
abs_dev_tarot = nil
|
|
196
|
-
|
|
197
|
-
# oriented card
|
|
198
|
-
dev_tarot = nil
|
|
199
|
-
|
|
200
|
-
# get cards
|
|
201
|
-
cards_arr = cards.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
202
|
-
# get abs_cards
|
|
203
|
-
abs_cards_arr = cards_arr.map{|c| Aro::Teck.card_strip(c)}
|
|
204
|
-
# get drawn
|
|
205
|
-
drawn_arr = drawn&.split(Aro::Teck::CARD_DELIM.to_s) || []
|
|
206
|
-
|
|
207
|
-
if cards_arr.empty?
|
|
208
|
-
Aro::P.say("there are no cards left to draw.")
|
|
209
|
-
return
|
|
210
|
-
end
|
|
211
|
-
sleeps = 0
|
|
212
|
-
sleeps_max = z_max
|
|
213
|
-
|
|
214
|
-
# find a card that is not already drawn
|
|
215
|
-
while sleeps <= sleeps_max && dev_tarot.nil? do
|
|
216
|
-
# use fallback randomness if /dev/tarot unavailable
|
|
217
|
-
unless Aro::T.is_dev_tarot? && Aro::T.is_dev_tarot_avail?
|
|
218
|
-
dev_tarot = Aro::T.summon_ruby_facot.split("")
|
|
219
|
-
else
|
|
220
|
-
# preferred randomness
|
|
221
|
-
read_value = Aro::T.read_dev_tarot&.strip&.split("")
|
|
222
|
-
if read_value.count >= Aro::Mancy::N - 1
|
|
223
|
-
dev_tarot = read_value
|
|
224
|
-
end
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
unless dev_tarot.nil?
|
|
228
|
-
abs_dev_tarot = dev_tarot[Aro::Mancy::S] + Aro::Mancy::NUMERALS.key(
|
|
229
|
-
dev_tarot.join("")[Aro::Mancy::OS..].to_i
|
|
230
|
-
).to_s
|
|
231
|
-
if abs_cards_arr.include?(abs_dev_tarot)
|
|
232
|
-
# dev_tarot is valid
|
|
233
|
-
dev_tarot = dev_tarot[Aro::Mancy::O] + abs_dev_tarot
|
|
234
|
-
else
|
|
235
|
-
dev_tarot = nil
|
|
236
|
-
end
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
if dev_tarot.nil?
|
|
240
|
-
# dev_tarot is invalid
|
|
241
|
-
sleeps += 1
|
|
242
|
-
sleep(z.to_i)
|
|
243
|
-
end
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
# remove from cards
|
|
247
|
-
cards_arr.delete(cards_arr.select{|c| c.include?(abs_dev_tarot)}.first)
|
|
248
|
-
|
|
249
|
-
# insert dev_tarot to drawn
|
|
250
|
-
drawn_arr << dev_tarot
|
|
251
|
-
Aro::Teck.print_card(dev_tarot)
|
|
252
|
-
Aro::Db.load
|
|
253
|
-
|
|
254
|
-
# update database
|
|
255
|
-
update(
|
|
256
|
-
cards: cards_arr.join(Aro::Teck::CARD_DELIM.to_s),
|
|
257
|
-
drawn: drawn_arr.join(Aro::Teck::CARD_DELIM.to_s)
|
|
258
|
-
)
|
|
259
|
-
end
|
|
260
|
-
end
|
data/sys/aro/models/tlog.rb
DELETED
data/sys/cli/constants.rb
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
constants.rb
|
|
4
|
-
|
|
5
|
-
define constants for the aro cli.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
module CLI
|
|
12
|
-
|
|
13
|
-
FLAGS = {
|
|
14
|
-
HELP: [:"-h", :"--help"],
|
|
15
|
-
SHOW_COUNT: [:"-n", :"--count"],
|
|
16
|
-
SHOW_ORDER: [:"-o", :"--order"],
|
|
17
|
-
VERSION: [:"-v", :"--version"],
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
EXIT_CODES = {
|
|
21
|
-
SUCCESS: Aro::Mancy::O,
|
|
22
|
-
GENERAL_ERROR: Aro::Mancy::S,
|
|
23
|
-
INVALID_ARG: Aro::Mancy::E,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
CMDS = {
|
|
27
|
-
ARO: {
|
|
28
|
-
CREATE: :create,
|
|
29
|
-
COR: :cor,
|
|
30
|
-
TECK: :teck,
|
|
31
|
-
DOM: :dom,
|
|
32
|
-
INIT: :init,
|
|
33
|
-
},
|
|
34
|
-
COR: {}, # see Aos::Cor
|
|
35
|
-
TECK: {
|
|
36
|
-
DRAW: :draw,
|
|
37
|
-
EXPLORE: :explore,
|
|
38
|
-
NEW: :new,
|
|
39
|
-
REPLACE: :replace,
|
|
40
|
-
RESET: :reset,
|
|
41
|
-
SHOW: :show,
|
|
42
|
-
SHUFFLE: :shuffle,
|
|
43
|
-
},
|
|
44
|
-
DOM: {
|
|
45
|
-
INIT: :init,
|
|
46
|
-
NEW: :new,
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
end
|
data/sys/cli/create.rb
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
create.rb
|
|
4
|
-
|
|
5
|
-
create aro space.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
module CLI
|
|
12
|
-
def self.create
|
|
13
|
-
CLI::Nterface.exit_error_missing_args!(:var_aro_name) if CLI::ARGV1.nil?
|
|
14
|
-
|
|
15
|
-
name = CLI::ARGV1&.to_s
|
|
16
|
-
Aro::P.say(I18n.t("cli.messages.creation_attempt", name: name))
|
|
17
|
-
if Aro::Mancy.create(name)
|
|
18
|
-
Aro::P.say(I18n.t("cli.messages.creation_success", name: name))
|
|
19
|
-
else
|
|
20
|
-
Aro::P.say(I18n.t("cli.messages.creation_failure", name: name))
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
data/sys/cli/dom.rb
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
dom.rb
|
|
4
|
-
|
|
5
|
-
process dom commands.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
module CLI
|
|
12
|
-
def self.dom
|
|
13
|
-
if CLI::FLAGS[:HELP].include?(CLI::ARGV1)
|
|
14
|
-
CLI.usage_dom
|
|
15
|
-
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
16
|
-
end
|
|
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
|
-
|
|
23
|
-
case action
|
|
24
|
-
when CLI::CMDS[:DOM][:INIT]
|
|
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
|
-
Aro::Dom.instance.generate(ARGV[Aro::Mancy::OS], ARGV[Aro::Mancy::E])
|
|
29
|
-
else
|
|
30
|
-
CLI::Nterface.exit_error_invalid_usage!
|
|
31
|
-
end
|
|
32
|
-
when CLI::CMDS[:DOM][:NEW]
|
|
33
|
-
CLI::Nterface.exit_error_missing_args!(:var_dom_name) if CLI::ARGV2.nil?
|
|
34
|
-
if Aro::Dom.in_arodom?
|
|
35
|
-
Aro::P.say(I18n.t("dom.errors.failed_already_in_arodom"))
|
|
36
|
-
elsif Aro::Mancy.in_aro?
|
|
37
|
-
Aro::P.say(I18n.t("dom.errors.failed_in_aro_space"))
|
|
38
|
-
else
|
|
39
|
-
Aro::Dom.create(CLI::ARGV2.to_s)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
data/sys/cli/nterface.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
nterface.rb
|
|
4
|
-
|
|
5
|
-
cli nterface.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
module CLI
|
|
12
|
-
class Nterface
|
|
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
|
-
exit(CLI::EXIT_CODES[:INVALID_ARG])
|
|
17
|
-
end
|
|
18
|
-
|
|
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
|
-
exit(CLI::EXIT_CODES[:INVALID_ARG])
|
|
23
|
-
end
|
|
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
|
-
|
|
31
|
-
def self.exit_error_not_initialized!
|
|
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])
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
data/sys/cli/teck.rb
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
teck.rb
|
|
4
|
-
|
|
5
|
-
process teck commands.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
module CLI
|
|
12
|
-
def self.teck
|
|
13
|
-
Aro::Mancy.init
|
|
14
|
-
action = CLI::ARGV1&.to_sym
|
|
15
|
-
if CLI::FLAGS[:HELP].include?(action)
|
|
16
|
-
CLI.usage_teck
|
|
17
|
-
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
18
|
-
elsif action.nil? || action == :aos
|
|
19
|
-
# no args, open teck menu
|
|
20
|
-
if Aro::Mancy.in_aro?
|
|
21
|
-
Aro::Teck.display_selection_menu
|
|
22
|
-
else
|
|
23
|
-
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
24
|
-
end
|
|
25
|
-
elsif action == CLI::CMDS[:TECK][:NEW]
|
|
26
|
-
CLI::Nterface.exit_error_missing_args!(:var_teck_name) if CLI::ARGV2.nil?
|
|
27
|
-
if Aro::Mancy.in_aro?
|
|
28
|
-
teck = Aro::Teck.make(CLI::ARGV2.to_s)
|
|
29
|
-
Aro::P.say(I18n.t("cli.messages.teck_created_sucessfully", name: teck.name))
|
|
30
|
-
Aro::Teck.display_selection_menu
|
|
31
|
-
else
|
|
32
|
-
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
33
|
-
end
|
|
34
|
-
elsif CLI::CMDS[:TECK].values.include?(action)
|
|
35
|
-
if Aro::Mancy.teck.nil?
|
|
36
|
-
Aro::P.say(I18n.t("cli.errors.missing_teck", cmd: Aro::Mancy::I2097I))
|
|
37
|
-
exit(CLI::EXIT_CODES[:GENERAL_ERROR])
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
case action
|
|
41
|
-
when CLI::CMDS[:TECK][:EXPLORE]
|
|
42
|
-
Aro::Mancy.teck.explore
|
|
43
|
-
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
44
|
-
when CLI::CMDS[:TECK][:SHUFFLE]
|
|
45
|
-
Aro::P.say(I18n.t("cli.messages.shuffling", name: Aro::Mancy.teck.name))
|
|
46
|
-
Aro::Mancy.teck.shuffle
|
|
47
|
-
when CLI::CMDS[:TECK][:DRAW]
|
|
48
|
-
Aos::Cor.instance.load
|
|
49
|
-
Aro::P.say(I18n.t("cli.messages.drawing", name: Aro::Mancy.teck.name))
|
|
50
|
-
Aro::P.say(I18n.t("cli.messages.drawing_from_dimension", dimension: "#{Aos::Cor.ivar(:DIMENSION)}"))
|
|
51
|
-
Aro::Mancy.teck.draw(
|
|
52
|
-
is_dt_dimension: Aro::T::is_dev_tarot?,
|
|
53
|
-
z_max: Aos::Cor.ivar(:Z_MAX).to_i,
|
|
54
|
-
z: Aos::Cor.ivar(:Z)
|
|
55
|
-
)
|
|
56
|
-
when CLI::CMDS[:TECK][:REPLACE]
|
|
57
|
-
Aro::P.say(I18n.t("cli.messages.replacing_drawn", name: Aro::Mancy.teck.name))
|
|
58
|
-
Aro::Mancy.teck.replace
|
|
59
|
-
when CLI::CMDS[:TECK][:RESET]
|
|
60
|
-
Aro::P.say("#{I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.teck.name)}")
|
|
61
|
-
if Aro::Mancy::YES.to_s != Aos::S.p.ask("\n#{Aro::Mancy::PS1}$")
|
|
62
|
-
Aro::P.say(I18n.t("cli.messages.understood", name: Aro::Mancy.teck.name))
|
|
63
|
-
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
Aro::P.say(I18n.t("cli.messages.resetting", name: Aro::Mancy.teck.name))
|
|
67
|
-
Aro::Mancy.teck.reset
|
|
68
|
-
end
|
|
69
|
-
Aro::Mancy.teck.show(**CLI::shoptions)
|
|
70
|
-
else
|
|
71
|
-
Aro::Teck.select_teck(
|
|
72
|
-
Aro::Teck.find_by(name: action)
|
|
73
|
-
)
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# parse show options
|
|
78
|
-
# todo: better naming
|
|
79
|
-
def self.shoptions
|
|
80
|
-
show_options_count = Aro::Mancy::S
|
|
81
|
-
show_options_order = Aro::Tlog::ORDERING[:DESC]
|
|
82
|
-
|
|
83
|
-
# Aro::D.say("ARGV.map{|a| a.to_sym} => #{ARGV.map{|a| a.to_sym}}")
|
|
84
|
-
|
|
85
|
-
count_option_flags = ARGV.map{|a| a.to_sym} & CLI::FLAGS[:SHOW_COUNT]
|
|
86
|
-
# Aro::D.say("count_option_flags: #{count_option_flags}")
|
|
87
|
-
if count_option_flags.any?
|
|
88
|
-
# get the ARGV index element after flag index
|
|
89
|
-
show_options_count = ARGV[ARGV.index(count_option_flags.first.to_s) + 1]
|
|
90
|
-
show_options_count = show_options_count.to_i unless [0, nil].include?(show_options_count&.to_i)
|
|
91
|
-
# Aro::D.say("show_options_count: #{show_options_count}")
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
order_option_flags = ARGV.map{|a| a.to_sym} & CLI::FLAGS[:SHOW_ORDER]
|
|
95
|
-
# Aro::D.say("count_option_flags: #{order_option_flags}")
|
|
96
|
-
if order_option_flags.any?
|
|
97
|
-
# get the ARGV index element after flag index
|
|
98
|
-
show_options_order = ARGV[ARGV.index(order_option_flags.first.to_s) + 1].to_sym
|
|
99
|
-
# Aro::D.say("show_options_order: #{show_options_order}")
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
count_n: show_options_count,
|
|
104
|
-
order_o: show_options_order
|
|
105
|
-
}
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
end
|
data/sys/cli/usage.rb
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
usage.rb
|
|
4
|
-
|
|
5
|
-
display aro usage.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
module CLI
|
|
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
|
|
22
|
-
Aro::P.less(I18n.t("usage.main"))
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def self.usage_teck
|
|
26
|
-
Aro::P.less(I18n.t("usage.teck"))
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
data/sys/cli.rb
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
|
|
3
|
-
cli
|
|
4
|
-
|
|
5
|
-
aro cli module.
|
|
6
|
-
|
|
7
|
-
by i2097i
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
module CLI
|
|
12
|
-
# todo: make this filtering better. dom uses :new as well
|
|
13
|
-
if CLI::CMDS[:TECK].values.filter{|k| ![:new].include?(k)}.include?(ARGV[0]&.to_sym)
|
|
14
|
-
# enable teck shortcut (skip typing teck while in-game)
|
|
15
|
-
ARGV0 = :teck
|
|
16
|
-
ARGV1 = ARGV[0]&.to_sym
|
|
17
|
-
ARGV2 = ARGV[1]&.to_sym
|
|
18
|
-
else
|
|
19
|
-
# default
|
|
20
|
-
ARGV0 = ARGV[0]&.to_sym
|
|
21
|
-
ARGV1 = ARGV[1]&.to_sym
|
|
22
|
-
ARGV2 = ARGV[2]&.to_sym
|
|
23
|
-
end
|
|
24
|
-
end
|