aro 0.2.2 → 0.2.3
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 +1 -1
- data/aro.gemspec +3 -3
- data/bin/aos +10 -3
- data/bin/aro +18 -11
- data/checksums/aro-0.2.3.gem.sha512 +1 -0
- data/locale/en.abot.yml +81 -0
- data/locale/en.aos.yml +6 -2
- data/locale/en.cor.yml +47 -0
- data/locale/en.data.yml +2 -2
- data/locale/en.dom.yml +15 -13
- data/locale/en.flie.yml +29 -0
- data/locale/en.usage.yml +24 -11
- data/locale/en.yml +2 -47
- data/sys/aos/abot.rb +256 -0
- data/sys/aos/aos.rb +373 -161
- data/sys/aos/cor.rb +773 -0
- data/sys/aos/data.rb +3 -3
- data/sys/aos/db/migrate/1765148774_create_yous.rb +1 -1
- data/sys/aos/db/migrate/1765933985_create_agodos.rb +22 -0
- data/sys/aos/db/migrate/1766203888_create_fpxies.rb +18 -0
- data/sys/aos/db.rb +16 -16
- data/sys/aos/flie.rb +144 -0
- data/sys/aos/models/agodo.rb +96 -0
- data/sys/aos/models/base_model.rb +13 -0
- data/sys/aos/models/fpxy.rb +28 -0
- data/sys/aos/models/ilib.rb +2 -0
- data/sys/aos/models/ilog.rb +5 -3
- data/sys/aos/models/you.rb +52 -4
- data/sys/aos/s.rb +2 -1
- data/sys/aos/vws/base.rb +62 -22
- data/sys/aos/vws/dom.rb +1 -1
- data/sys/aos/vws/games/abot.rb +21 -0
- data/sys/aos/vws/games/{game.rb → teck.rb} +19 -16
- data/sys/aos/vws/home.rb +23 -0
- data/sys/aos/vws/root/config.rb +4 -4
- data/sys/aos/vws/root/flie.rb +21 -0
- data/sys/aos/vws/welcome.rb +40 -4
- data/sys/aro/d.rb +4 -2
- data/sys/aro/db.rb +19 -10
- data/sys/aro/mancy.rb +16 -20
- data/sys/aro/models/base_model.rb +13 -0
- data/sys/aro/models/teck.rb +16 -12
- data/sys/aro/models/tlog.rb +2 -1
- data/sys/aro/p.rb +1 -1
- data/sys/aro/r.rb +2 -1
- data/sys/aro/v.rb +2 -2
- data/sys/cli/constants.rb +4 -10
- data/sys/cli/create.rb +2 -3
- data/sys/cli/dom.rb +1 -2
- data/sys/cli/teck.rb +26 -33
- data/sys/cli.rb +7 -9
- data/sys/dom/d.rb +38 -29
- data/sys/dom/dom.rb +62 -36
- data/sys/dom/p.rb +1 -1
- data/sys/fpx.rb +116 -0
- data/sys/reiquire.rb +3 -2
- data/sys/shr/prompt.rb +2 -2
- data/sys/shr/t.rb +11 -13
- data/sys/shr/version.rb +1 -1
- data/tasks/make.rake +1 -1
- metadata +55 -43
- data/sys/aos/vws/games/abpps.rb +0 -19
- data/sys/aos/vws/games/hbpps.rb +0 -19
- data/sys/aos/vws/games/shpps.rb +0 -19
- data/sys/aos/vws/games/vipps.rb +0 -19
- data/sys/dom/config.rb +0 -718
data/sys/aro/models/teck.rb
CHANGED
|
@@ -9,19 +9,20 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
require :base64.to_s
|
|
12
|
+
require_relative :"./base_model".to_s
|
|
12
13
|
|
|
13
14
|
class Aro::Teck < ActiveRecord::Base
|
|
14
15
|
has_many :tlogs
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
TECK_FILE = :".aro_teck"
|
|
17
18
|
CARD_DELIM = :","
|
|
18
19
|
|
|
19
20
|
before_create :populate_cards
|
|
20
21
|
after_commit :generate_log
|
|
21
22
|
|
|
22
23
|
def self.make(new_name)
|
|
23
|
-
return nil unless Aro::Mancy.is_initialized?
|
|
24
24
|
Aro::Db.load
|
|
25
|
+
return nil unless Aro::Mancy.is_initialized?
|
|
25
26
|
new_teck = Aro::Teck.create(name: new_name)
|
|
26
27
|
Aro::Teck.select_teck(new_teck) if Aro::Teck.current_teck.nil?
|
|
27
28
|
new_teck
|
|
@@ -32,6 +33,7 @@ class Aro::Teck < ActiveRecord::Base
|
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def populate_cards
|
|
36
|
+
Aro::Db.load
|
|
35
37
|
self.cards = Aro::Teck.fresh_cards
|
|
36
38
|
end
|
|
37
39
|
|
|
@@ -59,14 +61,15 @@ class Aro::Teck < ActiveRecord::Base
|
|
|
59
61
|
def self.select_teck(teck)
|
|
60
62
|
return unless teck.present?
|
|
61
63
|
Aro::P.say(I18n.t("cli.messages.teck_selected", name: teck.name, room: Aro::Mancy::aro_mancy_name))
|
|
62
|
-
File.open(Aro::Teck::
|
|
64
|
+
File.open(File.join(Aro::Db.base_aro_dir, Aro::Teck::TECK_FILE.to_s), "w") do |file|
|
|
63
65
|
file.write(teck.id)
|
|
64
66
|
end
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
def self.current_teck
|
|
68
|
-
|
|
69
|
-
|
|
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))
|
|
70
73
|
return Aro::Teck.find_by(id: current_teck_id)
|
|
71
74
|
end
|
|
72
75
|
end
|
|
@@ -76,14 +79,15 @@ class Aro::Teck < ActiveRecord::Base
|
|
|
76
79
|
end
|
|
77
80
|
|
|
78
81
|
def show(count_n: Aro::Mancy::S, order_o: Aro::Tlog::ORDERING[:DESC])
|
|
82
|
+
tlogs_count = tlogs.count
|
|
79
83
|
unless count_n.kind_of?(Numeric) && count_n.to_i > Aro::Mancy::O
|
|
80
84
|
if count_n&.to_s&.to_sym == Aro::Mancy::ALL
|
|
81
|
-
count_n =
|
|
85
|
+
count_n = tlogs_count
|
|
82
86
|
else
|
|
83
87
|
count_n = Aro::Mancy::S
|
|
84
88
|
end
|
|
85
89
|
end
|
|
86
|
-
count_n = [[Aro::Mancy::S, count_n.to_i].max,
|
|
90
|
+
count_n = [[Aro::Mancy::S, count_n.to_i].max, tlogs_count].min
|
|
87
91
|
Aro::V.say("count_n: #{count_n}")
|
|
88
92
|
Aro::V.say("order_o: #{order_o}")
|
|
89
93
|
|
|
@@ -98,12 +102,12 @@ class Aro::Teck < ActiveRecord::Base
|
|
|
98
102
|
# todo: this is doing more work than it needs to. needs debugging.
|
|
99
103
|
# Aro::V.say("tlog_records.count: #{tlog_records.count}")
|
|
100
104
|
|
|
101
|
-
# for now tests just expect
|
|
102
|
-
return tlog_records if
|
|
105
|
+
# for now tests just expect count
|
|
106
|
+
return tlog_records if Aos::Cor.is_test?
|
|
103
107
|
|
|
104
108
|
Aro::D.say(I18n.t("cli.messages.showing", name: name, count: count_n, order: order_o))
|
|
105
109
|
|
|
106
|
-
Aos::Vw::
|
|
110
|
+
Aos::Vw::Teck.show_game({
|
|
107
111
|
teck: self,
|
|
108
112
|
tlog_records: tlog_records,
|
|
109
113
|
count_n: count_n,
|
|
@@ -113,11 +117,11 @@ class Aro::Teck < ActiveRecord::Base
|
|
|
113
117
|
|
|
114
118
|
def explore
|
|
115
119
|
# allows user to browse each card in the current teck.
|
|
116
|
-
answer =
|
|
120
|
+
answer = Aos::S.p.select(
|
|
117
121
|
Aro::Mancy::PS1.to_s + I18n.t("cli.messages.choose_card"),
|
|
118
122
|
# formatted for tty-prompt gem
|
|
119
123
|
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:
|
|
124
|
+
per_page: Aos::Cor.display_configuration[:HEIGHT] - Aro::Mancy::S,
|
|
121
125
|
cycle: true,
|
|
122
126
|
default: Aro::Mancy::S
|
|
123
127
|
)
|
data/sys/aro/models/tlog.rb
CHANGED
data/sys/aro/p.rb
CHANGED
data/sys/aro/r.rb
CHANGED
|
@@ -12,8 +12,9 @@ require_relative :"../shr/prompt".to_s
|
|
|
12
12
|
|
|
13
13
|
module Aro
|
|
14
14
|
class R < Aro::Prompt
|
|
15
|
+
PS1 = :">[#{Aro::T::RUBY_FACOT}]>:"
|
|
15
16
|
def self.say(message)
|
|
16
|
-
|
|
17
|
+
super(["#{Aro::R::PS1} #{message}"])
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
end
|
data/sys/aro/v.rb
CHANGED
|
@@ -14,11 +14,11 @@ module Aro
|
|
|
14
14
|
class V < Aro::D
|
|
15
15
|
def self.say(message)
|
|
16
16
|
return unless Aro::V.should_print?
|
|
17
|
-
|
|
17
|
+
super(message)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.should_print?
|
|
21
|
-
|
|
21
|
+
Aos::Cor.ivar(:VERBOSE).to_s == Aos::Cor::BOOLS[:TRUE].to_s && super
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
data/sys/cli/constants.rb
CHANGED
|
@@ -24,21 +24,15 @@ module CLI
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
CMDS = {
|
|
27
|
-
AOS: {
|
|
28
|
-
RUN: :run,
|
|
29
|
-
WATCH: :watch,
|
|
30
|
-
},
|
|
31
27
|
ARO: {
|
|
32
28
|
CREATE: :create,
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
COR: :cor,
|
|
30
|
+
TECK: :teck,
|
|
35
31
|
DOM: :dom,
|
|
36
32
|
INIT: :init,
|
|
37
33
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
DECK: {
|
|
34
|
+
COR: {}, # see Aos::Cor
|
|
35
|
+
TECK: {
|
|
42
36
|
DRAW: :draw,
|
|
43
37
|
EXPLORE: :explore,
|
|
44
38
|
NEW: :new,
|
data/sys/cli/create.rb
CHANGED
data/sys/cli/dom.rb
CHANGED
|
@@ -25,8 +25,7 @@ module CLI
|
|
|
25
25
|
if Aro::Dom.is_initialized?
|
|
26
26
|
Aro::P.say(I18n.t("dom.errors.failed_already_initialized"))
|
|
27
27
|
elsif Aro::Dom.in_arodom? && !Aro::Dom.is_initialized?
|
|
28
|
-
|
|
29
|
-
arodome.generate(ARGV[Aro::Mancy::OS], ARGV[Aro::Mancy::E])
|
|
28
|
+
Aro::Dom.instance.generate(ARGV[Aro::Mancy::OS], ARGV[Aro::Mancy::E])
|
|
30
29
|
else
|
|
31
30
|
CLI::Nterface.exit_error_invalid_usage!
|
|
32
31
|
end
|
data/sys/cli/teck.rb
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
|
-
# cli entrypoint
|
|
13
12
|
def self.teck
|
|
13
|
+
Aro::Mancy.init
|
|
14
14
|
action = CLI::ARGV1&.to_sym
|
|
15
15
|
|
|
16
16
|
if CLI::FLAGS[:HELP].include?(action.to_s)
|
|
@@ -20,63 +20,56 @@ module CLI
|
|
|
20
20
|
elsif action.nil? || action == :aos
|
|
21
21
|
# no args, open teck menu
|
|
22
22
|
if Aro::Mancy.in_aro?
|
|
23
|
-
Aro::Db.load
|
|
24
23
|
Aro::Teck.display_selection_menu
|
|
25
24
|
else
|
|
26
25
|
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
27
26
|
end
|
|
28
|
-
elsif action == CLI::CMDS[:
|
|
27
|
+
elsif action == CLI::CMDS[:TECK][:NEW]
|
|
29
28
|
CLI::Nterface.exit_error_missing_args! if CLI::ARGV2.nil?
|
|
30
29
|
if Aro::Mancy.in_aro?
|
|
31
|
-
Aro::Db.load
|
|
32
30
|
teck = Aro::Teck.make(CLI::ARGV2.to_s)
|
|
33
31
|
Aro::P.say(I18n.t("cli.messages.teck_created_sucessfully", name: teck.name))
|
|
34
32
|
Aro::Teck.display_selection_menu
|
|
35
33
|
else
|
|
36
34
|
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
37
35
|
end
|
|
38
|
-
elsif CLI::CMDS[:
|
|
39
|
-
if Aro::Mancy.
|
|
36
|
+
elsif CLI::CMDS[:TECK].values.include?(action)
|
|
37
|
+
if Aro::Mancy.teck.nil?
|
|
40
38
|
Aro::P.say(I18n.t("cli.errors.missing_teck", cmd: Aro::Mancy::I2097I))
|
|
41
39
|
exit(CLI::EXIT_CODES[:GENERAL_ERROR])
|
|
42
40
|
end
|
|
43
41
|
|
|
44
42
|
case action
|
|
45
|
-
when CLI::CMDS[:
|
|
46
|
-
Aro::Mancy.
|
|
43
|
+
when CLI::CMDS[:TECK][:EXPLORE]
|
|
44
|
+
Aro::Mancy.teck.explore
|
|
47
45
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
48
|
-
when CLI::CMDS[:
|
|
49
|
-
Aro::P.say(I18n.t("cli.messages.shuffling", name: Aro::Mancy.
|
|
50
|
-
Aro::Mancy.
|
|
51
|
-
when CLI::CMDS[:
|
|
52
|
-
Aro::P.say(I18n.t("cli.messages.drawing", name: Aro::Mancy.
|
|
53
|
-
Aro::P.say(I18n.t("cli.messages.drawing_from_dimension", dimension: "#{
|
|
54
|
-
Aro::Mancy.
|
|
46
|
+
when CLI::CMDS[:TECK][:SHUFFLE]
|
|
47
|
+
Aro::P.say(I18n.t("cli.messages.shuffling", name: Aro::Mancy.teck.name))
|
|
48
|
+
Aro::Mancy.teck.shuffle
|
|
49
|
+
when CLI::CMDS[:TECK][:DRAW]
|
|
50
|
+
Aro::P.say(I18n.t("cli.messages.drawing", name: Aro::Mancy.teck.name))
|
|
51
|
+
Aro::P.say(I18n.t("cli.messages.drawing_from_dimension", dimension: "#{Aos::Cor.ivar(:DIMENSION)}"))
|
|
52
|
+
Aro::Mancy.teck.draw(
|
|
55
53
|
is_dt_dimension: Aro::T::is_dev_tarot?,
|
|
56
|
-
z_max:
|
|
57
|
-
z:
|
|
54
|
+
z_max: Aos::Cor.ivar(:Z_MAX).to_i,
|
|
55
|
+
z: Aos::Cor.ivar(:Z)
|
|
58
56
|
)
|
|
59
|
-
when CLI::CMDS[:
|
|
60
|
-
Aro::P.say(I18n.t("cli.messages.replacing_drawn", name: Aro::Mancy.
|
|
61
|
-
Aro::Mancy.
|
|
62
|
-
when CLI::CMDS[:
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
when CLI::CMDS[:TECK][:REPLACE]
|
|
58
|
+
Aro::P.say(I18n.t("cli.messages.replacing_drawn", name: Aro::Mancy.teck.name))
|
|
59
|
+
Aro::Mancy.teck.replace
|
|
60
|
+
when CLI::CMDS[:TECK][:RESET]
|
|
61
|
+
Aro::P.say("#{I18n.t("cli.messages.confirmation_prompt", name: Aro::Mancy.teck.name)}")
|
|
62
|
+
Aro::P.say("\n")
|
|
63
|
+
if Aro::Mancy::YES.to_s != Aos::S.p.ask("\n#{Aro::Mancy::PS1}$")
|
|
64
|
+
Aro::P.say(I18n.t("cli.messages.understood", name: Aro::Mancy.teck.name))
|
|
65
65
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
Aro::P.say(I18n.t("cli.messages.resetting", name: Aro::Mancy.
|
|
69
|
-
Aro::Mancy.
|
|
68
|
+
Aro::P.say(I18n.t("cli.messages.resetting", name: Aro::Mancy.teck.name))
|
|
69
|
+
Aro::Mancy.teck.reset
|
|
70
70
|
end
|
|
71
|
-
|
|
72
|
-
if ARGV.include?(:aos.to_s)
|
|
73
|
-
# run silent
|
|
74
|
-
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
Aro::Mancy.game.show(**CLI::shoptions)
|
|
71
|
+
Aro::Mancy.teck.show(**CLI::shoptions)
|
|
78
72
|
else
|
|
79
|
-
Aro::Db.load
|
|
80
73
|
Aro::Teck.select_teck(
|
|
81
74
|
Aro::Teck.find_by(name: action)
|
|
82
75
|
)
|
data/sys/cli.rb
CHANGED
|
@@ -9,18 +9,16 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
|
-
# todo:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if CLI::CMDS[:DECK].values.include?(argv_sanitized[0]&.to_sym)
|
|
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)
|
|
16
14
|
# enable teck shortcut (skip typing teck while in-game)
|
|
17
15
|
ARGV0 = :teck
|
|
18
|
-
ARGV1 =
|
|
19
|
-
ARGV2 =
|
|
16
|
+
ARGV1 = ARGV[0]&.to_sym
|
|
17
|
+
ARGV2 = ARGV[1]&.to_sym
|
|
20
18
|
else
|
|
21
19
|
# default
|
|
22
|
-
ARGV0 =
|
|
23
|
-
ARGV1 =
|
|
24
|
-
ARGV2 =
|
|
20
|
+
ARGV0 = ARGV[0]&.to_sym
|
|
21
|
+
ARGV1 = ARGV[1]&.to_sym
|
|
22
|
+
ARGV2 = ARGV[2]&.to_sym
|
|
25
23
|
end
|
|
26
24
|
end
|
data/sys/dom/d.rb
CHANGED
|
@@ -13,14 +13,27 @@ require_relative :"../shr/prompt".to_s
|
|
|
13
13
|
|
|
14
14
|
module Aro
|
|
15
15
|
class Dom::D
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
include Singleton
|
|
17
|
+
|
|
18
|
+
attr_accessor :reserved_words_def
|
|
19
|
+
|
|
20
|
+
def self.reserved_words(include_root = false)
|
|
21
|
+
if Aro::Dom::D.instance.reserved_words_def.nil?
|
|
22
|
+
|
|
23
|
+
reserved = []
|
|
24
|
+
Aro::Dom::D::LAYOUT.values.each{|wing|
|
|
25
|
+
if wing == Aro::Dom::D::LAYOUT[:ROOT]&& !include_root
|
|
26
|
+
next
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
reserved << wing[:name].to_s
|
|
30
|
+
wing[:rooms].each{|room| reserved << room[:name].to_s}
|
|
31
|
+
}
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
Aro::Dom::D.instance.reserved_words_def = reserved.sort
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
return Aro::Dom::D.instance.reserved_words_def
|
|
24
37
|
end
|
|
25
38
|
|
|
26
39
|
# definition of rooms in each layout wing
|
|
@@ -38,23 +51,12 @@ module Aro
|
|
|
38
51
|
},
|
|
39
52
|
},
|
|
40
53
|
GAMES: {
|
|
41
|
-
|
|
42
|
-
name: Aro::Dom::
|
|
43
|
-
description: I18n.t("dom.rooms.
|
|
44
|
-
},
|
|
45
|
-
HBPPS: {
|
|
46
|
-
name: Aro::Dom::HBPPS,
|
|
47
|
-
description: I18n.t("dom.rooms.hbpps.description"),
|
|
48
|
-
},
|
|
49
|
-
SHPPS: {
|
|
50
|
-
name: Aro::Dom::SHPPS,
|
|
51
|
-
description: I18n.t("dom.rooms.shpps.description"),
|
|
52
|
-
},
|
|
53
|
-
VIPPS: {
|
|
54
|
-
name: Aro::Dom::VIPPS,
|
|
55
|
-
description: I18n.t("dom.rooms.vipps.description"),
|
|
54
|
+
ABOT: {
|
|
55
|
+
name: Aro::Dom::ABOT,
|
|
56
|
+
description: I18n.t("dom.rooms.abot.description"),
|
|
56
57
|
},
|
|
57
58
|
},
|
|
59
|
+
HOME: {},
|
|
58
60
|
KNOW: {
|
|
59
61
|
BODY: {
|
|
60
62
|
name: Aro::Dom::BODY,
|
|
@@ -74,14 +76,18 @@ module Aro
|
|
|
74
76
|
name: Aro::Dom::AMG,
|
|
75
77
|
description: I18n.t("dom.rooms.amg.description"),
|
|
76
78
|
},
|
|
77
|
-
|
|
78
|
-
name: Aro::Dom::
|
|
79
|
+
COR: {
|
|
80
|
+
name: Aro::Dom::COR,
|
|
79
81
|
description: I18n.t("dom.rooms.config.description"),
|
|
80
82
|
},
|
|
81
83
|
DATA: {
|
|
82
84
|
name: Aro::Dom::DATA,
|
|
83
85
|
description: I18n.t("dom.rooms.data.description"),
|
|
84
86
|
},
|
|
87
|
+
FLIE: {
|
|
88
|
+
name: Aro::Dom::FLIE,
|
|
89
|
+
description: I18n.t("dom.rooms.flie.description"),
|
|
90
|
+
}
|
|
85
91
|
},
|
|
86
92
|
}
|
|
87
93
|
|
|
@@ -99,12 +105,14 @@ module Aro
|
|
|
99
105
|
name: Aro::Dom::GAMES,
|
|
100
106
|
description: I18n.t("dom.wings.games.description"),
|
|
101
107
|
rooms: [
|
|
102
|
-
Aro::Dom::D::WINGS[:GAMES][:
|
|
103
|
-
Aro::Dom::D::WINGS[:GAMES][:HBPPS],
|
|
104
|
-
Aro::Dom::D::WINGS[:GAMES][:SHPPS],
|
|
105
|
-
Aro::Dom::D::WINGS[:GAMES][:VIPPS],
|
|
108
|
+
Aro::Dom::D::WINGS[:GAMES][:ABOT],
|
|
106
109
|
],
|
|
107
110
|
},
|
|
111
|
+
HOME: {
|
|
112
|
+
name: Aro::Dom::HOME,
|
|
113
|
+
description: I18n.t("dom.wings.home.description"),
|
|
114
|
+
rooms: [],
|
|
115
|
+
},
|
|
108
116
|
KNOW: {
|
|
109
117
|
name: Aro::Dom::KNOW,
|
|
110
118
|
description: I18n.t("dom.wings.know.description"),
|
|
@@ -119,8 +127,9 @@ module Aro
|
|
|
119
127
|
description: I18n.t("dom.wings.root.description"),
|
|
120
128
|
rooms: [
|
|
121
129
|
Aro::Dom::D::WINGS[:ROOT][:AMG],
|
|
122
|
-
Aro::Dom::D::WINGS[:ROOT][:
|
|
130
|
+
Aro::Dom::D::WINGS[:ROOT][:COR],
|
|
123
131
|
Aro::Dom::D::WINGS[:ROOT][:DATA],
|
|
132
|
+
Aro::Dom::D::WINGS[:ROOT][:FLIE],
|
|
124
133
|
],
|
|
125
134
|
}
|
|
126
135
|
}
|
data/sys/dom/dom.rb
CHANGED
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
module Aro
|
|
12
12
|
class Dom
|
|
13
|
-
|
|
13
|
+
include Singleton
|
|
14
|
+
|
|
15
|
+
attr_accessor :eg_path, :is_initializing
|
|
16
|
+
|
|
17
|
+
PS1 = :">[#{Aro::Dom.name}]>:"
|
|
14
18
|
DOT = :"."
|
|
15
19
|
DOTT = :"#{DOT}#{DOT}"
|
|
16
20
|
ETHERGEIST = :eg
|
|
@@ -22,6 +26,7 @@ module Aro
|
|
|
22
26
|
# < user spaces
|
|
23
27
|
WELCOME = :welcome
|
|
24
28
|
GAMES = :games
|
|
29
|
+
HOME = :home
|
|
25
30
|
KNOW = :know
|
|
26
31
|
ROOT = :root
|
|
27
32
|
|
|
@@ -30,10 +35,7 @@ module Aro
|
|
|
30
35
|
WINNER = :winner
|
|
31
36
|
|
|
32
37
|
# > game spaces
|
|
33
|
-
|
|
34
|
-
HBPPS = :hbpps
|
|
35
|
-
SHPPS = :shpps
|
|
36
|
-
VIPPS = :vipps
|
|
38
|
+
ABOT = :abot
|
|
37
39
|
|
|
38
40
|
# > know spaces
|
|
39
41
|
BODY = :body
|
|
@@ -43,10 +45,15 @@ module Aro
|
|
|
43
45
|
|
|
44
46
|
# > root spaces
|
|
45
47
|
AMG = :amg
|
|
46
|
-
|
|
48
|
+
COR = :cor
|
|
47
49
|
DATA = :data
|
|
50
|
+
FLIE = :flie
|
|
48
51
|
# ...
|
|
49
52
|
|
|
53
|
+
def initialize
|
|
54
|
+
self.is_initializing = false
|
|
55
|
+
end
|
|
56
|
+
|
|
50
57
|
def self.create(name)
|
|
51
58
|
if Dir.exist?(name) || File.exist?(name)
|
|
52
59
|
Aro::Dom::P.say(I18n.t("dom.errors.failed_directory_exists", name: name))
|
|
@@ -69,9 +76,15 @@ module Aro
|
|
|
69
76
|
end
|
|
70
77
|
|
|
71
78
|
def self.is_initialized?
|
|
72
|
-
return false if !Aro::Dom.in_arodom?
|
|
79
|
+
return false if !Aro::Dom.in_arodom? || self.instance.is_initializing
|
|
73
80
|
|
|
74
|
-
File.exist?(
|
|
81
|
+
File.exist?(
|
|
82
|
+
File.join(
|
|
83
|
+
Aro::Dom.dom_root,
|
|
84
|
+
Aro::Dom.room_path(:data),
|
|
85
|
+
Aos::Db::SQL_FILE.to_s
|
|
86
|
+
)
|
|
87
|
+
)
|
|
75
88
|
end
|
|
76
89
|
|
|
77
90
|
def self.domain
|
|
@@ -107,19 +120,22 @@ module Aro
|
|
|
107
120
|
end
|
|
108
121
|
|
|
109
122
|
def self.ethergeist_path
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
if self.instance.eg_path.nil?
|
|
124
|
+
path = nil
|
|
125
|
+
search_path = Dir.pwd.split("/").reject{|p| p.empty?}
|
|
126
|
+
search_pwd = "/"
|
|
127
|
+
search_path.any?{|step|
|
|
128
|
+
search_pwd = File.join(search_pwd, step)
|
|
129
|
+
ls = Dir.glob("#{search_pwd}/#{ETHER_FILE}", File::FNM_DOTMATCH)
|
|
130
|
+
|
|
131
|
+
path = ls.first if ls.any?
|
|
132
|
+
!path.nil?
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
self.instance.eg_path = path unless path.nil?
|
|
136
|
+
end
|
|
121
137
|
|
|
122
|
-
return
|
|
138
|
+
return self.instance.eg_path
|
|
123
139
|
end
|
|
124
140
|
|
|
125
141
|
def self.ethergeist_name
|
|
@@ -133,22 +149,39 @@ module Aro
|
|
|
133
149
|
end
|
|
134
150
|
|
|
135
151
|
def generate(r_you, r_password)
|
|
136
|
-
|
|
137
|
-
Aro::Dom::P.say("
|
|
152
|
+
if r_you.nil? || r_you.empty?
|
|
153
|
+
Aro::Dom::P.say(I18n.t("dom.messages.missing_root_username"))
|
|
154
|
+
return
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if r_password.nil? || r_password.empty?
|
|
158
|
+
Aro::Dom::P.say(I18n.t("dom.messages.missing_root_password"))
|
|
138
159
|
return
|
|
139
160
|
end
|
|
140
161
|
|
|
141
162
|
unless Aro::Dom.in_arodom?
|
|
142
|
-
Aro::Dom::P.say("
|
|
163
|
+
Aro::Dom::P.say(I18n.t("dom.errors.failed_already_initialized"))
|
|
143
164
|
return
|
|
144
165
|
end
|
|
145
166
|
|
|
146
|
-
|
|
167
|
+
self.is_initializing = true
|
|
147
168
|
Aro::Dom::P.say(I18n.t("dom.messages.generating_wings"))
|
|
148
169
|
Aro::Dom::D::LAYOUT.values.each{|w| generate_wing w}
|
|
170
|
+
# generate a dom aro instance and teck named same as dom
|
|
171
|
+
Dir.chdir(Aro::Dom.ethergeist_path) do
|
|
172
|
+
Aro::Dom::P.say(I18n.t("dom.messages.generating_dom_aro"))
|
|
173
|
+
Aro::Mancy.init
|
|
174
|
+
Aro::Teck.select_teck(
|
|
175
|
+
Aro::Teck.make(Aro::Dom.ethergeist_name)
|
|
176
|
+
)
|
|
177
|
+
end
|
|
149
178
|
Aos::Db.load(r_password)
|
|
150
179
|
Aos::You.create(name: r_you, access: :root)
|
|
151
180
|
Aro::Dom::P.say(I18n.t("dom.messages.initialization_complete", name: Aro::Dom.name))
|
|
181
|
+
# todo: make this better and make an initial commit
|
|
182
|
+
system(:"git init".to_s) if `which git`&.strip&.split("/")&.include?(:git.to_s)
|
|
183
|
+
|
|
184
|
+
self.is_initializing = false
|
|
152
185
|
end
|
|
153
186
|
|
|
154
187
|
def generate_wing(wing)
|
|
@@ -160,26 +193,19 @@ module Aro
|
|
|
160
193
|
end
|
|
161
194
|
|
|
162
195
|
def generate_room(wing, room)
|
|
163
|
-
return unless Aro::Dom::D::WINGS[wing[:name].upcase].values.include?(room)
|
|
196
|
+
return unless Aro::Dom::D::WINGS[wing[:name].upcase].values.include?(room) ||
|
|
197
|
+
wing[:name] == Aro::Dom::HOME
|
|
164
198
|
|
|
165
199
|
Aro::Dom::P.say(I18n.t("dom.messages.generating_room", room: room[:name].to_s))
|
|
166
200
|
|
|
167
|
-
|
|
168
|
-
FileUtils.mkdir(
|
|
201
|
+
r_path = File.join(wing[:name].to_s, room[:name].to_s)
|
|
202
|
+
FileUtils.mkdir(r_path)
|
|
169
203
|
|
|
170
204
|
if wing[:name] == Aro::Dom::GAMES
|
|
171
|
-
File.open(File.join(
|
|
205
|
+
File.open(File.join(r_path, Aro::Mancy::NAME_FILE.to_s), "w") do |f|
|
|
172
206
|
f.write(room[:name])
|
|
173
207
|
end
|
|
174
208
|
end
|
|
175
209
|
end
|
|
176
|
-
|
|
177
|
-
def self.ethergeist_name
|
|
178
|
-
File.read(
|
|
179
|
-
File.join(
|
|
180
|
-
Aro::Dom.ethergeist_path, Aro::Mancy::NAME_FILE.to_s
|
|
181
|
-
)
|
|
182
|
-
)
|
|
183
|
-
end
|
|
184
210
|
end
|
|
185
211
|
end # aroadhome
|