aro 0.2.1 → 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/README.md +1 -1
- data/aro.gemspec +3 -3
- data/bin/aos +10 -3
- data/bin/aro +18 -11
- data/checksums/aro-0.2.1.gem.sha512 +1 -0
- data/checksums/aro-0.2.2.gem.sha512 +1 -0
- data/checksums/aro-0.2.3.gem.sha512 +1 -0
- data/locale/en.abot.yml +81 -0
- data/locale/en.amg.yml +44 -0
- data/locale/en.aos.yml +8 -38
- data/locale/en.cor.yml +47 -0
- data/locale/en.data.yml +30 -0
- data/locale/en.dom.yml +22 -18
- data/locale/en.flie.yml +29 -0
- data/locale/en.usage.yml +39 -26
- data/locale/en.yml +10 -51
- data/sys/aos/abot.rb +256 -0
- data/sys/aos/amg.rb +58 -56
- data/sys/aos/aos.rb +425 -180
- data/sys/aos/cor.rb +773 -0
- data/sys/aos/data.rb +117 -0
- data/sys/aos/db/migrate/1765148774_create_yous.rb +1 -0
- data/sys/aos/db/migrate/{1765762724_create_libs.rb → 1765762724_create_ilibs.rb} +5 -5
- data/sys/aos/db/migrate/1765907766_create_ilogs.rb +18 -0
- 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 +47 -27
- 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/{shr/lib/lib.rb → aos/models/ilib.rb} +11 -6
- data/sys/aos/models/ilog.rb +29 -0
- data/sys/aos/models/you.rb +98 -0
- data/sys/aos/s.rb +2 -1
- data/sys/aos/vws/base.rb +69 -78
- data/sys/aos/vws/dom.rb +1 -2
- data/sys/aos/vws/games/abot.rb +21 -0
- data/sys/aos/vws/games/{game.rb → teck.rb} +27 -24
- data/sys/aos/vws/home.rb +23 -0
- data/sys/aos/vws/know/{temple.rb → body.rb} +3 -3
- data/sys/aos/vws/know/{library.rb → mind.rb} +3 -3
- data/sys/aos/vws/know/spirit.rb +19 -0
- data/sys/aos/vws/{setup → root}/amg.rb +1 -2
- data/sys/aos/vws/{setup → root}/config.rb +4 -4
- data/sys/aos/vws/root/data.rb +21 -0
- data/sys/aos/vws/root/flie.rb +21 -0
- data/sys/aos/vws/{setup.rb → root.rb} +3 -3
- data/sys/aos/vws/welcome/waite.rb +1 -0
- data/sys/aos/vws/welcome.rb +47 -0
- data/sys/aro/d.rb +4 -2
- data/sys/aro/db/migrate/{1763374647_create_decks.rb → 1763374647_create_tecks.rb} +5 -5
- data/sys/aro/db/migrate/1763432541_create_tlogs.rb +20 -0
- data/sys/aro/db.rb +28 -19
- data/sys/aro/mancy.rb +18 -22
- data/sys/aro/models/base_model.rb +13 -0
- data/sys/{models/deck.rb → aro/models/teck.rb} +60 -57
- data/sys/aro/models/tlog.rb +21 -0
- 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/{deck.rb → teck.rb} +38 -45
- data/sys/cli.rb +10 -11
- data/sys/dom/d.rb +68 -46
- data/sys/dom/dom.rb +79 -44
- data/sys/dom/p.rb +1 -1
- data/sys/fpx.rb +116 -0
- data/sys/reiquire.rb +8 -8
- data/sys/shr/prompt.rb +2 -6
- data/sys/shr/t.rb +11 -13
- data/sys/shr/version.rb +1 -1
- data/tasks/make.rake +1 -1
- metadata +82 -62
- data/locale/en.cngelog.yml +0 -5
- 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/aos/you.rb +0 -21
- data/sys/aro/db/migrate/1763432541_create_logs.rb +0 -20
- data/sys/dom/config.rb +0 -665
- data/sys/models/log.rb +0 -20
- /data/sys/shr/{lib → ilib}/crs/CMakeLists.txt +0 -0
- /data/sys/shr/{lib → ilib}/crs/compile.sh +0 -0
- /data/sys/shr/{lib → ilib}/crs/crs.c +0 -0
- /data/sys/shr/{lib → ilib}/crs/crs.o +0 -0
- /data/sys/shr/{lib → ilib}/crs/libcrs.so +0 -0
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
|
|
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/{deck.rb → teck.rb}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
teck.rb
|
|
4
4
|
|
|
5
|
-
process
|
|
5
|
+
process teck commands.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
|
-
|
|
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)
|
|
@@ -18,67 +18,60 @@ module CLI
|
|
|
18
18
|
CLI.usage::usage
|
|
19
19
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
20
20
|
elsif action.nil? || action == :aos
|
|
21
|
-
# no args, open
|
|
21
|
+
# no args, open teck menu
|
|
22
22
|
if Aro::Mancy.in_aro?
|
|
23
|
-
Aro::
|
|
24
|
-
Aro::Deck.display_selection_menu
|
|
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::
|
|
32
|
-
|
|
33
|
-
Aro::
|
|
34
|
-
Aro::Deck.display_selection_menu
|
|
30
|
+
teck = Aro::Teck.make(CLI::ARGV2.to_s)
|
|
31
|
+
Aro::P.say(I18n.t("cli.messages.teck_created_sucessfully", name: teck.name))
|
|
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.
|
|
40
|
-
Aro::P.say(I18n.t("cli.errors.
|
|
36
|
+
elsif CLI::CMDS[:TECK].values.include?(action)
|
|
37
|
+
if Aro::Mancy.teck.nil?
|
|
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::
|
|
80
|
-
|
|
81
|
-
Aro::Deck.find_by(name: action)
|
|
73
|
+
Aro::Teck.select_teck(
|
|
74
|
+
Aro::Teck.find_by(name: action)
|
|
82
75
|
)
|
|
83
76
|
end
|
|
84
77
|
end
|
|
@@ -87,7 +80,7 @@ module CLI
|
|
|
87
80
|
# todo: better naming
|
|
88
81
|
def self.shoptions
|
|
89
82
|
show_options_count = Aro::Mancy::S
|
|
90
|
-
show_options_order = Aro::
|
|
83
|
+
show_options_order = Aro::Tlog::ORDERING[:DESC]
|
|
91
84
|
|
|
92
85
|
# Aro::D.say("ARGV.map{|a| a.to_sym} => #{ARGV.map{|a| a.to_sym}}")
|
|
93
86
|
|
data/sys/cli.rb
CHANGED
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
cli
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
aro cli module.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ARGV2 = argv_sanitized[1]&.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)
|
|
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
|
|
19
18
|
else
|
|
20
19
|
# default
|
|
21
|
-
ARGV0 =
|
|
22
|
-
ARGV1 =
|
|
23
|
-
ARGV2 =
|
|
20
|
+
ARGV0 = ARGV[0]&.to_sym
|
|
21
|
+
ARGV1 = ARGV[1]&.to_sym
|
|
22
|
+
ARGV2 = ARGV[2]&.to_sym
|
|
24
23
|
end
|
|
25
24
|
end
|
data/sys/dom/d.rb
CHANGED
|
@@ -9,23 +9,39 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
require_relative :dom.to_s
|
|
12
|
+
require_relative :"../shr/prompt".to_s
|
|
12
13
|
|
|
13
14
|
module Aro
|
|
14
15
|
class Dom::D
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
}
|
|
21
32
|
|
|
22
|
-
|
|
33
|
+
Aro::Dom::D.instance.reserved_words_def = reserved.sort
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
return Aro::Dom::D.instance.reserved_words_def
|
|
23
37
|
end
|
|
24
38
|
|
|
25
39
|
# definition of rooms in each layout wing
|
|
26
40
|
WINGS = {
|
|
27
41
|
WELCOME: {
|
|
28
42
|
WAITE: {
|
|
43
|
+
# todo: make a wai/wait/wae learning tool for practicing
|
|
44
|
+
# command usage in a sandbox.
|
|
29
45
|
name: Aro::Dom::WAITE,
|
|
30
46
|
description: I18n.t("dom.rooms.waite.description"),
|
|
31
47
|
},
|
|
@@ -35,42 +51,43 @@ module Aro
|
|
|
35
51
|
},
|
|
36
52
|
},
|
|
37
53
|
GAMES: {
|
|
38
|
-
|
|
39
|
-
name: Aro::Dom::
|
|
40
|
-
description: I18n.t("dom.rooms.
|
|
41
|
-
},
|
|
42
|
-
HBPPS: {
|
|
43
|
-
name: Aro::Dom::HBPPS,
|
|
44
|
-
description: I18n.t("dom.rooms.hbpps.description"),
|
|
45
|
-
},
|
|
46
|
-
SHPPS: {
|
|
47
|
-
name: Aro::Dom::SHPPS,
|
|
48
|
-
description: I18n.t("dom.rooms.shpps.description"),
|
|
49
|
-
},
|
|
50
|
-
VIPPS: {
|
|
51
|
-
name: Aro::Dom::VIPPS,
|
|
52
|
-
description: I18n.t("dom.rooms.vipps.description"),
|
|
54
|
+
ABOT: {
|
|
55
|
+
name: Aro::Dom::ABOT,
|
|
56
|
+
description: I18n.t("dom.rooms.abot.description"),
|
|
53
57
|
},
|
|
54
58
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
HOME: {},
|
|
60
|
+
KNOW: {
|
|
61
|
+
BODY: {
|
|
62
|
+
name: Aro::Dom::BODY,
|
|
63
|
+
description: I18n.t("dom.rooms.body.description"),
|
|
59
64
|
},
|
|
60
|
-
|
|
61
|
-
name: Aro::Dom::
|
|
62
|
-
description: I18n.t("dom.rooms.
|
|
65
|
+
MIND: {
|
|
66
|
+
name: Aro::Dom::MIND,
|
|
67
|
+
description: I18n.t("dom.rooms.mind.description"),
|
|
63
68
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
name: Aro::Dom::CONFIG,
|
|
68
|
-
description: I18n.t("dom.rooms.config.description"),
|
|
69
|
+
SPIRIT: {
|
|
70
|
+
name: Aro::Dom::SPIRIT,
|
|
71
|
+
description: I18n.t("dom.rooms.spirit.description"),
|
|
69
72
|
},
|
|
73
|
+
},
|
|
74
|
+
ROOT: {
|
|
70
75
|
AMG: {
|
|
71
76
|
name: Aro::Dom::AMG,
|
|
72
77
|
description: I18n.t("dom.rooms.amg.description"),
|
|
73
78
|
},
|
|
79
|
+
COR: {
|
|
80
|
+
name: Aro::Dom::COR,
|
|
81
|
+
description: I18n.t("dom.rooms.config.description"),
|
|
82
|
+
},
|
|
83
|
+
DATA: {
|
|
84
|
+
name: Aro::Dom::DATA,
|
|
85
|
+
description: I18n.t("dom.rooms.data.description"),
|
|
86
|
+
},
|
|
87
|
+
FLIE: {
|
|
88
|
+
name: Aro::Dom::FLIE,
|
|
89
|
+
description: I18n.t("dom.rooms.flie.description"),
|
|
90
|
+
}
|
|
74
91
|
},
|
|
75
92
|
}
|
|
76
93
|
|
|
@@ -88,29 +105,34 @@ module Aro
|
|
|
88
105
|
name: Aro::Dom::GAMES,
|
|
89
106
|
description: I18n.t("dom.wings.games.description"),
|
|
90
107
|
rooms: [
|
|
91
|
-
Aro::Dom::D::WINGS[:GAMES][:
|
|
92
|
-
Aro::Dom::D::WINGS[:GAMES][:HBPPS],
|
|
93
|
-
Aro::Dom::D::WINGS[:GAMES][:SHPPS],
|
|
94
|
-
Aro::Dom::D::WINGS[:GAMES][:VIPPS],
|
|
108
|
+
Aro::Dom::D::WINGS[:GAMES][:ABOT],
|
|
95
109
|
],
|
|
96
110
|
},
|
|
111
|
+
HOME: {
|
|
112
|
+
name: Aro::Dom::HOME,
|
|
113
|
+
description: I18n.t("dom.wings.home.description"),
|
|
114
|
+
rooms: [],
|
|
115
|
+
},
|
|
97
116
|
KNOW: {
|
|
98
117
|
name: Aro::Dom::KNOW,
|
|
99
118
|
description: I18n.t("dom.wings.know.description"),
|
|
100
119
|
rooms: [
|
|
101
|
-
Aro::Dom::D::WINGS[:KNOW][:
|
|
102
|
-
Aro::Dom::D::WINGS[:KNOW][:
|
|
120
|
+
Aro::Dom::D::WINGS[:KNOW][:BODY],
|
|
121
|
+
Aro::Dom::D::WINGS[:KNOW][:MIND],
|
|
122
|
+
Aro::Dom::D::WINGS[:KNOW][:SPIRIT],
|
|
103
123
|
],
|
|
104
124
|
},
|
|
105
|
-
|
|
106
|
-
name: Aro::Dom::
|
|
107
|
-
description: I18n.t("dom.wings.
|
|
125
|
+
ROOT: {
|
|
126
|
+
name: Aro::Dom::ROOT,
|
|
127
|
+
description: I18n.t("dom.wings.root.description"),
|
|
108
128
|
rooms: [
|
|
109
|
-
Aro::Dom::D::WINGS[:
|
|
110
|
-
Aro::Dom::D::WINGS[:
|
|
129
|
+
Aro::Dom::D::WINGS[:ROOT][:AMG],
|
|
130
|
+
Aro::Dom::D::WINGS[:ROOT][:COR],
|
|
131
|
+
Aro::Dom::D::WINGS[:ROOT][:DATA],
|
|
132
|
+
Aro::Dom::D::WINGS[:ROOT][:FLIE],
|
|
111
133
|
],
|
|
112
134
|
}
|
|
113
135
|
}
|
|
114
136
|
|
|
115
137
|
end
|
|
116
|
-
end
|
|
138
|
+
end
|
data/sys/dom/dom.rb
CHANGED
|
@@ -8,45 +8,52 @@
|
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
|
-
require_relative :"../aos/s".to_s
|
|
12
|
-
|
|
13
11
|
module Aro
|
|
14
12
|
class Dom
|
|
15
|
-
|
|
13
|
+
include Singleton
|
|
14
|
+
|
|
15
|
+
attr_accessor :eg_path, :is_initializing
|
|
16
|
+
|
|
17
|
+
PS1 = :">[#{Aro::Dom.name}]>:"
|
|
16
18
|
DOT = :"."
|
|
17
19
|
DOTT = :"#{DOT}#{DOT}"
|
|
18
|
-
ETHERGEIST = :
|
|
20
|
+
ETHERGEIST = :eg
|
|
19
21
|
ETHER_FILE = :".#{Aro::Dom::ETHERGEIST}"
|
|
20
22
|
|
|
21
|
-
# <
|
|
23
|
+
# < aro space
|
|
22
24
|
ARODOME = :arodome
|
|
23
25
|
|
|
24
26
|
# < user spaces
|
|
25
27
|
WELCOME = :welcome
|
|
26
28
|
GAMES = :games
|
|
29
|
+
HOME = :home
|
|
27
30
|
KNOW = :know
|
|
28
|
-
|
|
31
|
+
ROOT = :root
|
|
29
32
|
|
|
30
33
|
# > welcome spaces
|
|
31
34
|
WAITE = :waite
|
|
32
35
|
WINNER = :winner
|
|
33
36
|
|
|
34
37
|
# > game spaces
|
|
35
|
-
|
|
36
|
-
HBPPS = :hbpps
|
|
37
|
-
SHPPS = :shpps
|
|
38
|
-
VIPPS = :vipps
|
|
38
|
+
ABOT = :abot
|
|
39
39
|
|
|
40
40
|
# > know spaces
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
BODY = :body
|
|
42
|
+
MIND = :mind
|
|
43
|
+
SPIRIT = :spirit
|
|
43
44
|
# ...
|
|
44
45
|
|
|
45
|
-
# >
|
|
46
|
-
CONFIG = :config
|
|
46
|
+
# > root spaces
|
|
47
47
|
AMG = :amg
|
|
48
|
+
COR = :cor
|
|
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
|
|
@@ -132,14 +148,40 @@ module Aro
|
|
|
132
148
|
)
|
|
133
149
|
end
|
|
134
150
|
|
|
135
|
-
def generate
|
|
136
|
-
|
|
151
|
+
def generate(r_you, r_password)
|
|
152
|
+
if r_you.nil? || r_you.empty?
|
|
153
|
+
Aro::Dom::P.say(I18n.t("dom.messages.missing_root_username"))
|
|
154
|
+
return
|
|
155
|
+
end
|
|
137
156
|
|
|
138
|
-
|
|
157
|
+
if r_password.nil? || r_password.empty?
|
|
158
|
+
Aro::Dom::P.say(I18n.t("dom.messages.missing_root_password"))
|
|
159
|
+
return
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
unless Aro::Dom.in_arodom?
|
|
163
|
+
Aro::Dom::P.say(I18n.t("dom.errors.failed_already_initialized"))
|
|
164
|
+
return
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
self.is_initializing = true
|
|
139
168
|
Aro::Dom::P.say(I18n.t("dom.messages.generating_wings"))
|
|
140
169
|
Aro::Dom::D::LAYOUT.values.each{|w| generate_wing w}
|
|
141
|
-
|
|
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
|
|
178
|
+
Aos::Db.load(r_password)
|
|
179
|
+
Aos::You.create(name: r_you, access: :root)
|
|
142
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
|
|
143
185
|
end
|
|
144
186
|
|
|
145
187
|
def generate_wing(wing)
|
|
@@ -151,26 +193,19 @@ module Aro
|
|
|
151
193
|
end
|
|
152
194
|
|
|
153
195
|
def generate_room(wing, room)
|
|
154
|
-
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
|
|
155
198
|
|
|
156
199
|
Aro::Dom::P.say(I18n.t("dom.messages.generating_room", room: room[:name].to_s))
|
|
157
200
|
|
|
158
|
-
|
|
159
|
-
FileUtils.mkdir(
|
|
201
|
+
r_path = File.join(wing[:name].to_s, room[:name].to_s)
|
|
202
|
+
FileUtils.mkdir(r_path)
|
|
160
203
|
|
|
161
204
|
if wing[:name] == Aro::Dom::GAMES
|
|
162
|
-
File.open(File.join(
|
|
205
|
+
File.open(File.join(r_path, Aro::Mancy::NAME_FILE.to_s), "w") do |f|
|
|
163
206
|
f.write(room[:name])
|
|
164
207
|
end
|
|
165
208
|
end
|
|
166
209
|
end
|
|
167
|
-
|
|
168
|
-
def self.ethergeist_name
|
|
169
|
-
File.read(
|
|
170
|
-
File.join(
|
|
171
|
-
Aro::Dom.ethergeist_path, Aro::Mancy::NAME_FILE.to_s
|
|
172
|
-
)
|
|
173
|
-
)
|
|
174
|
-
end
|
|
175
210
|
end
|
|
176
211
|
end # aroadhome
|
data/sys/dom/p.rb
CHANGED
data/sys/fpx.rb
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
fpx.rb
|
|
4
|
+
|
|
5
|
+
aos flie proxy.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require :"rack/cors".to_s
|
|
12
|
+
require :sinatra.to_s
|
|
13
|
+
|
|
14
|
+
module Aos
|
|
15
|
+
module Fpx
|
|
16
|
+
def self.read_you(you_name)
|
|
17
|
+
url = URI.parse(File.join(Aos::Fpx::Server::URL, :"you/#{you_name}".to_s))
|
|
18
|
+
req = Net::HTTP::Get.new(url.to_s)
|
|
19
|
+
res = Net::HTTP.start(url.host, url.port) {|http|
|
|
20
|
+
http.request(req)
|
|
21
|
+
}
|
|
22
|
+
res.body
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class Server < Sinatra::Base
|
|
26
|
+
PORT = 7474
|
|
27
|
+
HOST = :localhost
|
|
28
|
+
# no ssl for now
|
|
29
|
+
URL = :"http://#{Aos::Fpx::Server::HOST}:#{Aos::Fpx::Server::PORT}/".to_s
|
|
30
|
+
TIMEOUT = Aro::Mancy::NUMERALS[:VI] * Aro::Mancy::NUMERALS[:X]
|
|
31
|
+
|
|
32
|
+
def self.serve_pid_file
|
|
33
|
+
return "" if Aro::Dom.dom_root.nil? || Aro::Dom.room_path(:abot).nil?
|
|
34
|
+
File.join(Aro::Dom.dom_root, Aro::Dom.room_path(:flie), "fpx.pid")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# def self.log_file
|
|
38
|
+
# File.new(
|
|
39
|
+
# File.join(
|
|
40
|
+
# Aro::Dom.dom_root,
|
|
41
|
+
# Aro::Dom.room_path(:flie),
|
|
42
|
+
# "fpx.log"
|
|
43
|
+
# ),
|
|
44
|
+
# "a+"
|
|
45
|
+
# )
|
|
46
|
+
# end
|
|
47
|
+
|
|
48
|
+
def self.start
|
|
49
|
+
return if File.exist?(Aos::Fpx::Server.serve_pid_file)
|
|
50
|
+
|
|
51
|
+
serve_pid = fork {Aos::Fpx::Server.run!}
|
|
52
|
+
Process.detach(serve_pid)
|
|
53
|
+
File.open(Aos::Fpx::Server.serve_pid_file, "w") do |f|
|
|
54
|
+
f.write(serve_pid)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.stop
|
|
59
|
+
if File.exist?(Aos::Fpx::Server.serve_pid_file)
|
|
60
|
+
system("kill -9 #{File.read(Aos::Fpx::Server.serve_pid_file)}")
|
|
61
|
+
FileUtils.rm(Aos::Fpx::Server.serve_pid_file)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
set :port, Aos::Fpx::Server::PORT
|
|
66
|
+
# set :bind, "0.0.0.0"
|
|
67
|
+
set :server_settings, timeout: Aos::Fpx::Server::TIMEOUT
|
|
68
|
+
|
|
69
|
+
# configure do
|
|
70
|
+
# enable :logging
|
|
71
|
+
# file = Aos::Fpx::Server.log_file
|
|
72
|
+
# file.sync = true
|
|
73
|
+
# use Rack::CommonLogger, file
|
|
74
|
+
# set :logging, Logger::DEBUG
|
|
75
|
+
# end
|
|
76
|
+
|
|
77
|
+
# after do
|
|
78
|
+
# ActiveRecord::Base.clear_active_connections!
|
|
79
|
+
# end
|
|
80
|
+
|
|
81
|
+
use Rack::Cors do |config|
|
|
82
|
+
config.allow do |allow|
|
|
83
|
+
allow.origins Aos::Fpx::Server::HOST.to_s + ":3000"
|
|
84
|
+
allow.resource "*"
|
|
85
|
+
# allow.resource "/file/list_all/", :headers => :any
|
|
86
|
+
# allow.resource "/file/at/*",
|
|
87
|
+
# :methods => [:get, :post, :put, :delete],
|
|
88
|
+
# :headers => :any,
|
|
89
|
+
# :max_age => 0
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
get "/" do
|
|
94
|
+
status 200
|
|
95
|
+
"".to_json
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
get "/you/:name" do
|
|
99
|
+
Aos::Db.load
|
|
100
|
+
you = Aos::You.find_by(name: params[:name])
|
|
101
|
+
content_type :json
|
|
102
|
+
if you.nil?
|
|
103
|
+
status 404
|
|
104
|
+
"".to_json
|
|
105
|
+
else
|
|
106
|
+
status 200
|
|
107
|
+
you.fpx.to_json
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
not_found do
|
|
112
|
+
redirect "/"
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|