aro 0.2.4 → 0.2.5
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/Gemfile.lock +101 -42
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/aro.gemspec +7 -7
- data/bin/aro +1 -11
- data/bin/ino +22 -0
- data/checksums/aro-0.2.4.gem.sha512 +1 -0
- data/ino_rules_todo.txt +28 -0
- data/locale/en.cards.yml +19 -21
- data/locale/en.dom.yml +1 -0
- data/locale/en.ino.yml +9 -0
- data/locale/en.usage.yml +63 -7
- data/locale/en.yml +1 -0
- data/sys/aos/abot.rb +6 -7
- data/sys/aos/aos.rb +36 -29
- data/sys/aos/models/agodo.rb +8 -0
- data/sys/aos/models/you.rb +39 -3
- data/sys/aos/vws/games/ino.rb +21 -0
- data/sys/aos/vws/games/teck.rb +1 -3
- data/sys/aro/db/migrate/1768856981_create_scrolls.rb +20 -0
- data/sys/aro/db/migrate/1768858841_create_legends.rb +16 -0
- data/sys/aro/db/migrate/1768858967_create_stories.rb +17 -0
- data/sys/aro/db/migrate/1768859060_create_chapters.rb +15 -0
- data/sys/aro/db/migrate/1768859126_create_statements.rb +22 -0
- data/sys/aro/db/migrate/1768859144_create_players.rb +18 -0
- data/sys/aro/ino.rb +64 -0
- data/sys/aro/models/chapter.rb +18 -0
- data/sys/aro/models/legend.rb +28 -0
- data/sys/aro/models/player.rb +17 -0
- data/sys/aro/models/scroll.rb +46 -0
- data/sys/aro/models/statement.rb +14 -0
- data/sys/aro/models/story.rb +28 -0
- data/sys/aro/models/teck.rb +24 -6
- data/sys/cli/constants.rb +0 -1
- data/sys/cli/usage.rb +4 -0
- data/sys/dom/dom.rb +6 -1
- data/sys/shr/ilib/crs/crs.o +0 -0
- data/sys/shr/ilib/crs/libcrs.so +0 -0
- data/sys/shr/version.rb +1 -1
- metadata +38 -21
- data/.ruby-version +0 -1
- data/sys/aro/models/base_model.rb +0 -13
data/sys/aos/aos.rb
CHANGED
|
@@ -196,6 +196,17 @@ module Aos
|
|
|
196
196
|
Aro::V.say("you loaded:\n#{caller[Aro::Mancy::O..Aro::Mancy::N].join("\n")}")
|
|
197
197
|
Aro::V.say(self.you.name)
|
|
198
198
|
Aro::V.say(Aos::Os.osify(self.you.pwd))
|
|
199
|
+
self.you.history.each{|h| Readline::HISTORY.push(h)}
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def self.configure_aro_cli
|
|
204
|
+
Aro::V.say(ARGV)
|
|
205
|
+
if ARGV.include?(Aos::Os::YOU_FLAG)
|
|
206
|
+
Aos::Db.load
|
|
207
|
+
yfi = ARGV.index(Aos::Os::YOU_FLAG)
|
|
208
|
+
Aos::Os.instance.you = Aos::You.find_by(name: ARGV[yfi + Aro::Mancy::S]&.strip)
|
|
209
|
+
Aos::Os.instance.you_flag = Aos::You.find_by(name: ARGV[yfi + Aro::Mancy::S]&.strip)
|
|
199
210
|
end
|
|
200
211
|
end
|
|
201
212
|
|
|
@@ -268,7 +279,7 @@ module Aos
|
|
|
268
279
|
if current_you.nil?
|
|
269
280
|
Aos::S.say(lines.join("\n"))
|
|
270
281
|
else
|
|
271
|
-
|
|
282
|
+
Mutex.new.synchronize do
|
|
272
283
|
Aos::Os.instance.q ||= {}
|
|
273
284
|
Aos::Os.q[current_you.name] ||= []
|
|
274
285
|
Aos::Os.q[current_you.name] += lines
|
|
@@ -284,7 +295,7 @@ module Aos
|
|
|
284
295
|
Aos::Os.q.delete(you_name)
|
|
285
296
|
)
|
|
286
297
|
}
|
|
287
|
-
|
|
298
|
+
end
|
|
288
299
|
end
|
|
289
300
|
end
|
|
290
301
|
end
|
|
@@ -359,7 +370,8 @@ module Aos
|
|
|
359
370
|
# end
|
|
360
371
|
|
|
361
372
|
def handle_aro_override(args)
|
|
362
|
-
return nil unless args[
|
|
373
|
+
return nil unless !args[Aro::Mancy::O].nil? &&
|
|
374
|
+
[:aro, :ino].include?(args[Aro::Mancy::O].to_sym)
|
|
363
375
|
# !self.you_flag.nil?
|
|
364
376
|
yfi = args.index(Aos::Os::YOU_FLAG)
|
|
365
377
|
if yfi.nil?
|
|
@@ -376,6 +388,7 @@ module Aos
|
|
|
376
388
|
Aos::Cor.instance.cor_path = nil
|
|
377
389
|
Aos::Cor.instance.load
|
|
378
390
|
Dir.chdir(self.you.reload.pwd) do
|
|
391
|
+
self.you.add_history(cmd) unless cmd.nil?
|
|
379
392
|
send_to_system_call = main(cmd)
|
|
380
393
|
nothing = nil
|
|
381
394
|
unless cmd.nil? || cmd.empty?
|
|
@@ -383,38 +396,32 @@ module Aos
|
|
|
383
396
|
self.you.generate_ilog(cmd)
|
|
384
397
|
end
|
|
385
398
|
if send_to_system_call && nothing.nil?
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
399
|
+
begin
|
|
400
|
+
Aos::Os.say(`#{cmd}`)
|
|
401
|
+
rescue => e
|
|
402
|
+
Aos::Os.say(e)
|
|
403
|
+
end
|
|
404
|
+
elsif !nothing.nil?
|
|
390
405
|
Aos::Os.say(nothing)
|
|
391
|
-
else
|
|
392
|
-
render
|
|
393
406
|
end
|
|
407
|
+
|
|
408
|
+
render unless send_to_system_call
|
|
394
409
|
end
|
|
395
410
|
|
|
396
411
|
CLI::EXIT_CODES[:SUCCESS]
|
|
397
412
|
end
|
|
398
413
|
end
|
|
399
414
|
|
|
400
|
-
def configure_readline
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
dir_listing.grep(/^#{Regexp.escape(str)}/)
|
|
411
|
-
}
|
|
412
|
-
# when :aos
|
|
413
|
-
# Readline.completion_append_character = "/"
|
|
414
|
-
# Readline.completion_proc = Proc.new{|str|
|
|
415
|
-
# Aro::Dom::D.reserved_words.grep(/^#{Regexp.escape(str)}/)
|
|
416
|
-
# }
|
|
417
|
-
# end
|
|
415
|
+
def configure_readline
|
|
416
|
+
Readline.completion_append_character = "/"
|
|
417
|
+
Readline.completion_proc = Proc.new{|str|
|
|
418
|
+
pwd = self.you_flag&.reload&.pwd || self.you&.reload&.pwd || ""
|
|
419
|
+
dir_matcher = File.join(pwd, str + Aos::Os::STAR.to_s)
|
|
420
|
+
# Aro::V.say(dir_matcher)
|
|
421
|
+
dir_listing = Dir.glob(dir_matcher, File::FNM_DOTMATCH).map{|d| Aos::Os.osify(d).split("/").reject{|p| pwd.include?(p)}.join("/")}
|
|
422
|
+
# Aro::V.say(dir_listing)
|
|
423
|
+
dir_listing.grep(/^#{Regexp.escape(str)}/)
|
|
424
|
+
}
|
|
418
425
|
end
|
|
419
426
|
|
|
420
427
|
Mutex.new.synchronize do
|
|
@@ -433,9 +440,9 @@ module Aos
|
|
|
433
440
|
height, width = IO.console.winsize
|
|
434
441
|
IO.console.goto(height, Aro::Mancy::O)
|
|
435
442
|
process_cmd(cmd)
|
|
436
|
-
break unless self.running && cmd = Readline.readline(calc_ps1)
|
|
443
|
+
break unless self.running && cmd = Readline.readline(calc_ps1, true)
|
|
437
444
|
IO.console.erase_screen(Aro::Mancy::S)
|
|
438
|
-
configure_readline
|
|
445
|
+
configure_readline
|
|
439
446
|
end
|
|
440
447
|
|
|
441
448
|
|
data/sys/aos/models/agodo.rb
CHANGED
|
@@ -43,6 +43,14 @@ class Aos::Agodo < ActiveRecord::Base
|
|
|
43
43
|
]
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
def create_home_directory
|
|
47
|
+
Aro::Dom.instance.generate_agodo_home(self)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def home
|
|
51
|
+
File.join(Aro::Dom.room_path(Aro::Dom::ABOT), Aos::Abot::AGODOS_DIR.to_s, self.you.name)
|
|
52
|
+
end
|
|
53
|
+
|
|
46
54
|
private
|
|
47
55
|
|
|
48
56
|
def create_you
|
data/sys/aos/models/you.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Aos
|
|
|
15
15
|
has_many :fpxies
|
|
16
16
|
|
|
17
17
|
before_validation :set_pwd
|
|
18
|
-
before_create :create_home_directory
|
|
18
|
+
before_create :create_home_directory, :create_history_file
|
|
19
19
|
after_update :clear_aos_display
|
|
20
20
|
|
|
21
21
|
enum :access, [
|
|
@@ -24,8 +24,10 @@ module Aos
|
|
|
24
24
|
:root,
|
|
25
25
|
]
|
|
26
26
|
|
|
27
|
+
AOS_HISTORY_FILE = :".aos_history"
|
|
27
28
|
ARO_SRT_FILE = :".aro_srt"
|
|
28
29
|
|
|
30
|
+
|
|
29
31
|
def generate_ilog(cmd)
|
|
30
32
|
ilogs.create(
|
|
31
33
|
pwd: Aos::Os.osify(pwd),
|
|
@@ -53,6 +55,10 @@ module Aos
|
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
def home
|
|
58
|
+
if agodo?
|
|
59
|
+
return agodo.home
|
|
60
|
+
end
|
|
61
|
+
|
|
56
62
|
File.join(
|
|
57
63
|
Aro::Dom::dom_root,
|
|
58
64
|
Aro::Dom.room_path(root? ? Aro::Dom::COR : Aro::Dom::HOME),
|
|
@@ -78,6 +84,20 @@ module Aos
|
|
|
78
84
|
end
|
|
79
85
|
end
|
|
80
86
|
|
|
87
|
+
def history
|
|
88
|
+
return "" unless root? || user?
|
|
89
|
+
File.read(history_file).split("\n").compact
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def add_history(entry)
|
|
93
|
+
return unless root? || user?
|
|
94
|
+
return if entry.nil? || entry.to_s.empty?
|
|
95
|
+
File.open(history_file, "a+") do |aos_history|
|
|
96
|
+
aos_history.write(entry)
|
|
97
|
+
aos_history.write("\n")
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
81
101
|
private
|
|
82
102
|
|
|
83
103
|
def set_pwd
|
|
@@ -88,9 +108,25 @@ module Aos
|
|
|
88
108
|
File.join(self.home, Aos::You::ARO_SRT_FILE.to_s)
|
|
89
109
|
end
|
|
90
110
|
|
|
111
|
+
def history_file
|
|
112
|
+
File.join(self.home, Aos::You::AOS_HISTORY_FILE.to_s)
|
|
113
|
+
end
|
|
114
|
+
|
|
91
115
|
def create_home_directory
|
|
92
|
-
return if root?
|
|
93
|
-
|
|
116
|
+
return if root?
|
|
117
|
+
|
|
118
|
+
if agodo?
|
|
119
|
+
agodo&.create_home_directory
|
|
120
|
+
return
|
|
121
|
+
else
|
|
122
|
+
return if Dir.exist?(File.join(Aro::Dom.room_path(Aro::Dom::HOME), self.name))
|
|
123
|
+
Aro::Dom.instance.generate_room(Aro::Dom::D::LAYOUT[:HOME], {name: self.name.to_sym})
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def create_history_file
|
|
128
|
+
return unless root? || user?
|
|
129
|
+
File.open(history_file, "w+")
|
|
94
130
|
end
|
|
95
131
|
|
|
96
132
|
def clear_aos_display
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
vws/games/ino.rb
|
|
4
|
+
|
|
5
|
+
the ino view.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"../base".to_s
|
|
12
|
+
|
|
13
|
+
module Aos
|
|
14
|
+
module Vw
|
|
15
|
+
class Ino < Aos::Vw::Base
|
|
16
|
+
def self.show
|
|
17
|
+
draw(Aro::Ino.instance.display_lines)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/sys/aos/vws/games/teck.rb
CHANGED
|
@@ -88,9 +88,7 @@ module Aos
|
|
|
88
88
|
lines << I18n.t("cli.messages.history_drawn").center(Aos::Vw::Base.viewport_width)
|
|
89
89
|
lines << divider
|
|
90
90
|
lines << ""
|
|
91
|
-
lines += self.get_display_for_cards(
|
|
92
|
-
drawn_cards
|
|
93
|
-
)
|
|
91
|
+
lines += self.get_display_for_cards(drawn_cards)
|
|
94
92
|
# lines << ""
|
|
95
93
|
# lines << divider
|
|
96
94
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class CreateScrolls < ActiveRecord::Migration[8.1]
|
|
2
|
+
|
|
3
|
+
def self.up
|
|
4
|
+
create_table :scrolls do |t|
|
|
5
|
+
t.belongs_to :legend, null: false, foreign_key: true
|
|
6
|
+
t.belongs_to :player, null: false, foreign_key: true
|
|
7
|
+
t.string :name, null: false
|
|
8
|
+
t.string :cards, null: false, default: ""
|
|
9
|
+
|
|
10
|
+
t.timestamps
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
add_index :scrolls, :name
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.down
|
|
17
|
+
drop_table :scrolls
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class CreateLegends < ActiveRecord::Migration[8.1]
|
|
2
|
+
|
|
3
|
+
def self.up
|
|
4
|
+
create_table :legends do |t|
|
|
5
|
+
t.belongs_to :story, null: false, foreign_key: true
|
|
6
|
+
t.integer :play_to, null: false, default: Aro::Mancy::NUMERALS[:XI]
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.down
|
|
13
|
+
drop_table :legends
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class CreateStories < ActiveRecord::Migration[8.1]
|
|
2
|
+
|
|
3
|
+
def self.up
|
|
4
|
+
create_table :stories do |t|
|
|
5
|
+
t.belongs_to :legend, null: false, foreign_key: true
|
|
6
|
+
t.belongs_to :chapter, null: false, foreign_key: true
|
|
7
|
+
t.belongs_to :dealer, null: false, foreign_key: true
|
|
8
|
+
|
|
9
|
+
t.timestamps
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.down
|
|
14
|
+
drop_table :stories
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class CreateStatements < ActiveRecord::Migration[8.1]
|
|
2
|
+
|
|
3
|
+
def self.up
|
|
4
|
+
create_table :statements do |t|
|
|
5
|
+
t.belongs_to :player, null: false, foreign_key: true
|
|
6
|
+
t.belongs_to :chapter, null: false, foreign_key: true
|
|
7
|
+
|
|
8
|
+
# all cards in the statement except the word
|
|
9
|
+
t.string :thought, null: false, default: ""
|
|
10
|
+
|
|
11
|
+
# the final card that must be played to close the statement
|
|
12
|
+
t.string :word, null: false, default: ""
|
|
13
|
+
|
|
14
|
+
t.timestamps
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.down
|
|
19
|
+
drop_table :statements
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class CreatePlayers < ActiveRecord::Migration[8.1]
|
|
2
|
+
|
|
3
|
+
def self.up
|
|
4
|
+
create_table :players do |t|
|
|
5
|
+
t.belongs_to :scroll, null: false, foreign_key: true
|
|
6
|
+
t.integer :you_id, null: false
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
add_index :players, :you_id
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.down
|
|
15
|
+
drop_table :players
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
data/sys/aro/ino.rb
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
ino.rb
|
|
4
|
+
|
|
5
|
+
aro and ino.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
module Aro
|
|
12
|
+
def self.ino
|
|
13
|
+
Aro::Ino.process_command(ARGV)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class Ino
|
|
17
|
+
include Singleton
|
|
18
|
+
|
|
19
|
+
attr_accessor :scroll, :display_lines
|
|
20
|
+
|
|
21
|
+
CMDS = {
|
|
22
|
+
CREATE: {
|
|
23
|
+
key: :create,
|
|
24
|
+
description: I18n.t("ino.commands.description.create"),
|
|
25
|
+
usage: I18n.t("ino.commands.usage.create"),
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def self.run
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.process_command(args)
|
|
34
|
+
self.instance.display_lines = args
|
|
35
|
+
args = Aos::Os.sanitize_you(args)
|
|
36
|
+
|
|
37
|
+
if args[Aro::Mancy::O].nil? ||
|
|
38
|
+
CLI::FLAGS[:HELP].include?(args[Aro::Mancy::O].to_sym)
|
|
39
|
+
self.instance.display_lines = [I18n.t("usage.ino")]
|
|
40
|
+
Aos::Vw::Ino.show
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
case args[Aro::Mancy::O].to_sym
|
|
45
|
+
when Aro::Ino::CMDS[:CREATE][:key]
|
|
46
|
+
CLI::Nterface.exit_error_missing_args!(:var_aro_name) if args[Aro::Mancy::S].nil?
|
|
47
|
+
Aro::Db.load
|
|
48
|
+
self.instance.scroll = Aro::Scroll.find_by(name: args[Aro::Mancy::S].strip)
|
|
49
|
+
if self.instance.scroll.nil?
|
|
50
|
+
self.instance.scroll = Aro::Scroll.create(name: args[Aro::Mancy::S].strip)
|
|
51
|
+
self.instance.scroll.players << Aro::Player.create(you_id: Aos::Os.instance.you.id)
|
|
52
|
+
self.instance.display_lines = self.instance.scroll.display_lines
|
|
53
|
+
else
|
|
54
|
+
self.instance.display_lines = [I18n.t("ino.error.scroll_exists")]
|
|
55
|
+
end
|
|
56
|
+
else
|
|
57
|
+
self.instance.display_lines = [I18n.t("ino.messages.invalid_cmd")]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
Aos::Vw::Ino.show
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
legend.rb
|
|
4
|
+
|
|
5
|
+
legend object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
# require_relative :scroll.to_s
|
|
12
|
+
require_relative :"./story".to_s
|
|
13
|
+
|
|
14
|
+
class Aro::Legend < ActiveRecord::Base
|
|
15
|
+
has_one :scroll
|
|
16
|
+
has_many :stories
|
|
17
|
+
belongs_to :story
|
|
18
|
+
|
|
19
|
+
# play_to:integer default 11
|
|
20
|
+
|
|
21
|
+
after_create :create_story
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def create_story
|
|
26
|
+
self.story = Aro::Story.create()
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
scroll.rb
|
|
4
|
+
|
|
5
|
+
scroll object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
class Aro::Scroll < ActiveRecord::Base
|
|
12
|
+
|
|
13
|
+
HISTORY_FILE = :".ino_history"
|
|
14
|
+
|
|
15
|
+
has_many :players
|
|
16
|
+
belongs_to :legend
|
|
17
|
+
belongs_to :player
|
|
18
|
+
|
|
19
|
+
before_create :create_history_file, :create_legend
|
|
20
|
+
|
|
21
|
+
def history_file
|
|
22
|
+
File.join(Aro::Db.base_aro_dir, Aro::Scroll::HISTORY_FILE.to_s)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def history
|
|
26
|
+
File.read(history_file).split("\n").compact
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def add_history(entry)
|
|
30
|
+
return if entry.nil? || entry.to_s.empty?
|
|
31
|
+
File.open(history_file, "a+") do |ino_history|
|
|
32
|
+
ino_history.write(entry)
|
|
33
|
+
ino_history.write("\n")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def create_legend
|
|
40
|
+
self.legend = Aro::Legend.create()
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def create_history_file
|
|
44
|
+
File.open(history_file, "w+")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
story.rb
|
|
4
|
+
|
|
5
|
+
story object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"./legend".to_s
|
|
12
|
+
require_relative :"./chapter".to_s
|
|
13
|
+
require_relative :"./player".to_s
|
|
14
|
+
|
|
15
|
+
class Aro::Story < ActiveRecord::Base
|
|
16
|
+
has_many :chapters
|
|
17
|
+
belongs_to :legend
|
|
18
|
+
belongs_to :chapter, class_name: Aro::Chapter.name
|
|
19
|
+
# belongs_to :dealer, class_name: Aro::Player.name
|
|
20
|
+
|
|
21
|
+
after_create :create_chapter
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def create_chapter
|
|
26
|
+
self.chapter = Aro::Chapter.create()
|
|
27
|
+
end
|
|
28
|
+
end
|
data/sys/aro/models/teck.rb
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
require :base64.to_s
|
|
12
|
-
require_relative :"./base_model".to_s
|
|
13
12
|
|
|
14
13
|
class Aro::Teck < ActiveRecord::Base
|
|
15
14
|
has_many :tlogs
|
|
@@ -138,14 +137,33 @@ class Aro::Teck < ActiveRecord::Base
|
|
|
138
137
|
orientation = "-"
|
|
139
138
|
end
|
|
140
139
|
|
|
141
|
-
|
|
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}")
|
|
142
147
|
output = []
|
|
143
|
-
output <<
|
|
144
|
-
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
|
+
}
|
|
145
163
|
# todo: add an actual summary
|
|
146
164
|
# Aro::P.say(definition["#{orientation}summary".to_sym])
|
|
147
|
-
|
|
148
|
-
Aro::P.say("#{card_code}\n#{output.map{|l| l.center(width
|
|
165
|
+
output << "".ljust(width, divider)
|
|
166
|
+
Aro::P.say("#{card_code}\n#{output.map{|l| l.center(width)}.join("\n")}")
|
|
149
167
|
end
|
|
150
168
|
|
|
151
169
|
def shuffle
|
data/sys/cli/constants.rb
CHANGED
data/sys/cli/usage.rb
CHANGED
data/sys/dom/dom.rb
CHANGED
data/sys/shr/ilib/crs/crs.o
CHANGED
|
Binary file
|
data/sys/shr/ilib/crs/libcrs.so
CHANGED
|
Binary file
|