aro 0.2.5 → 0.2.6
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 +106 -89
- data/aro.gemspec +10 -11
- data/bin/oss_om +15 -0
- data/checksums/aro-0.2.5.gem.sha512 +1 -0
- data/checksums/aro-0.2.6.gem.sha512 +1 -0
- data/locale/en.cards.yml +1 -1
- data/locale/en.cmd.yml +34 -0
- data/locale/en.cor.yml +5 -8
- data/locale/en.menu_items.yml +2 -0
- data/locale/en.menus.yml +2 -0
- data/locale/en.usage.yml +21 -98
- data/locale/en.yml +61 -50
- data/sys/aro/cmd.rb +96 -0
- data/sys/{aos → aro}/cor.rb +224 -268
- data/sys/aro/d.rb +4 -3
- data/sys/aro/db/migrate/.DS_Store +0 -0
- data/sys/aro/db/migrate/1793913747_create_data_bases.rb +13 -0
- data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +14 -0
- data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +12 -0
- data/sys/aro/db/migrate/1793913841_create_menus.rb +11 -0
- data/sys/aro/db/migrate/1793913861_create_menu_items.rb +14 -0
- data/sys/aro/db.rb +72 -33
- data/sys/aro/designer.rb +281 -0
- data/sys/aro/locale.rb +136 -0
- data/sys/aro/ma_ain.rb +54 -0
- data/sys/aro/mancy.rb +53 -28
- data/sys/aro/models/concerns/.keep +0 -0
- data/sys/aro/models/concerns/uuid.rb +29 -0
- data/sys/aro/models/data_base.rb +97 -0
- data/sys/aro/models/directory.rb +44 -0
- data/sys/aro/models/file.rb +27 -0
- data/sys/aro/models/menu.rb +27 -0
- data/sys/aro/models/menu_item.rb +47 -0
- data/sys/aro/models/teck.rb +19 -28
- data/sys/aro/p.rb +6 -3
- data/sys/aro/r.rb +1 -2
- data/sys/aro/store.rb +147 -0
- data/sys/aro/v.rb +2 -2
- data/sys/aro/views/base.rb +25 -0
- data/sys/aro/views/teck.rb +30 -0
- data/sys/aro.rb +1 -2
- data/sys/cli/constants.rb +1 -6
- data/sys/cli/create.rb +3 -3
- data/sys/cli/nterface.rb +8 -8
- data/sys/cli/teck.rb +17 -18
- data/sys/cli/usage.rb +4 -8
- data/sys/cli.rb +0 -1
- data/sys/reiquire.rb +146 -25
- data/sys/shr/.DS_Store +0 -0
- data/sys/shr/prompt.rb +8 -2
- data/sys/shr/t.rb +5 -5
- data/sys/shr/version.rb +9 -2
- data/tasks/make.rake +2 -1
- metadata +53 -116
- 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.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/sys/aos/abot.rb +0 -254
- data/sys/aos/amg.rb +0 -184
- data/sys/aos/aos.rb +0 -672
- 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/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/cli/dom.rb +0 -43
- 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/aro/store.rb
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
store.rb
|
|
6
|
+
|
|
7
|
+
json data store
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
class Aro::Dom::Store
|
|
14
|
+
attr_accessor :is_open, :cache, :clear_flag, :parser_error, :open_file_path
|
|
15
|
+
|
|
16
|
+
def initialize
|
|
17
|
+
open_file_path = nil
|
|
18
|
+
clear_cache!
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def clear_cache!
|
|
22
|
+
if @is_open
|
|
23
|
+
@clear_flag = true
|
|
24
|
+
return
|
|
25
|
+
end
|
|
26
|
+
@clear_flag = false
|
|
27
|
+
@is_open = false
|
|
28
|
+
|
|
29
|
+
@cache = {} # clear'd
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.edit(aro_file, updates)
|
|
33
|
+
return if aro_file.nil?
|
|
34
|
+
unless ::File.exist?(aro_file.aro_file_path)
|
|
35
|
+
::File.write(aro_file.aro_file_path, "{}")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# todo: validate updates
|
|
39
|
+
Aro::Dom::Ma_ain.instance.store_mutex.synchronize do
|
|
40
|
+
store_instance = Aro::Dom::Ma_ain.instance.get_store_for(aro_file)
|
|
41
|
+
updates.each{|k, v|
|
|
42
|
+
store_instance.set_key(k, v)
|
|
43
|
+
Aro::P.say([
|
|
44
|
+
"reading in #{k} after setting to #{v} in #{aro_file.aro_file_path}",
|
|
45
|
+
"got value => #{store_instance.get_key(k)}"
|
|
46
|
+
])
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def get_key(key)
|
|
52
|
+
return if open_file_path.nil?
|
|
53
|
+
|
|
54
|
+
key = key.to_s
|
|
55
|
+
|
|
56
|
+
# ensure default for key exists
|
|
57
|
+
@cache[key] = {value: nil, persisted: false} unless @cache.keys.include?(key)
|
|
58
|
+
|
|
59
|
+
# return cache value if storage open or the cache value is persisted
|
|
60
|
+
return @cache[key][:value] if @is_open || @cache[key][:persisted]
|
|
61
|
+
|
|
62
|
+
# open storage
|
|
63
|
+
@is_open = true
|
|
64
|
+
storage_contents = {}
|
|
65
|
+
begin
|
|
66
|
+
@parser_error = nil
|
|
67
|
+
# read storage
|
|
68
|
+
storage_contents = JSON.parse(
|
|
69
|
+
::File.read(open_file_path, encoding: "UTF-8")
|
|
70
|
+
)
|
|
71
|
+
rescue StandardError => e
|
|
72
|
+
@is_open = false
|
|
73
|
+
if @parser_error.nil?
|
|
74
|
+
@parser_error = e
|
|
75
|
+
return get_key(key)
|
|
76
|
+
else
|
|
77
|
+
raise @parser_error
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# only update the cache value if present in storage
|
|
82
|
+
if storage_contents.keys.include?(key)
|
|
83
|
+
@cache[key] = {value: storage_contents[key], persisted: true}
|
|
84
|
+
else
|
|
85
|
+
@cache[key][:persisted] = false
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
value = @cache[key][:value]
|
|
89
|
+
@is_open = false
|
|
90
|
+
clear_cache! if @clear_flag
|
|
91
|
+
|
|
92
|
+
return value
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def set_key(key, value)
|
|
96
|
+
return if open_file_path.nil?
|
|
97
|
+
|
|
98
|
+
key = key.to_s
|
|
99
|
+
|
|
100
|
+
# ensure default for key exists
|
|
101
|
+
@cache[key] = {value: value, persisted: false} unless @cache.keys.include?(key)
|
|
102
|
+
|
|
103
|
+
# assign new cache value and set persisted to false
|
|
104
|
+
@cache[key][:value] = value
|
|
105
|
+
@cache[key][:persisted] = false
|
|
106
|
+
|
|
107
|
+
# return if storage open
|
|
108
|
+
# non-persisted cache values update next cycle
|
|
109
|
+
return if @is_open
|
|
110
|
+
|
|
111
|
+
# open storage
|
|
112
|
+
@is_open = true
|
|
113
|
+
storage_contents = {}
|
|
114
|
+
begin
|
|
115
|
+
@parser_error = nil
|
|
116
|
+
# read storage
|
|
117
|
+
storage_contents = JSON.parse(
|
|
118
|
+
::File.read(open_file_path, encoding: "UTF-8")
|
|
119
|
+
)
|
|
120
|
+
rescue StandardError => e
|
|
121
|
+
@is_open = false
|
|
122
|
+
if @parser_error.nil?
|
|
123
|
+
@parser_error = e
|
|
124
|
+
return get_key(key)
|
|
125
|
+
else
|
|
126
|
+
raise @parser_error
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# update storage and cache
|
|
131
|
+
([key] + @cache.keys.select{|k|
|
|
132
|
+
!@cache[k][:persisted]
|
|
133
|
+
}).each{|k|
|
|
134
|
+
storage_contents[k] = @cache[k][:value]
|
|
135
|
+
@cache[k][:persisted] = true
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
# write storage
|
|
139
|
+
::File.open(open_file_path, "w+") do |f|
|
|
140
|
+
f.write(storage_contents.to_json)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# close storage
|
|
144
|
+
@is_open = false
|
|
145
|
+
clear_cache! if @clear_flag
|
|
146
|
+
end
|
|
147
|
+
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
|
-
super(message)
|
|
17
|
+
super(normalize_message(message))
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.should_print?
|
|
21
|
-
|
|
21
|
+
Aro::Cor.ivar(:VERBOSE).to_s == Aro::Cor::BOOLS[:TRUE].to_s && super
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
views/base.rb
|
|
4
|
+
|
|
5
|
+
the base view (abstract or supposed to be).
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
module Aro
|
|
12
|
+
module Views
|
|
13
|
+
class Base
|
|
14
|
+
|
|
15
|
+
def self.show
|
|
16
|
+
draw([])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.draw(lines)
|
|
20
|
+
Aro::P.say(lines)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
vws/games/game.rb
|
|
4
|
+
|
|
5
|
+
the game view.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"../models/teck".to_s
|
|
12
|
+
require_relative :"./base".to_s
|
|
13
|
+
|
|
14
|
+
module Aro
|
|
15
|
+
module Views
|
|
16
|
+
class Teck < Aro::Views::Base
|
|
17
|
+
|
|
18
|
+
def self.show
|
|
19
|
+
# if Aro::Mancy.teck.nil?
|
|
20
|
+
# draw(["no teck loaded...exiting..."])
|
|
21
|
+
# return
|
|
22
|
+
# end
|
|
23
|
+
|
|
24
|
+
# Aro::P.say(:"Aro::Dom::Ma_ain.run".to_s)
|
|
25
|
+
# draw(Aro::Dom::Ma_ain.run)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/sys/aro.rb
CHANGED
data/sys/cli/constants.rb
CHANGED
|
@@ -25,13 +25,12 @@ module CLI
|
|
|
25
25
|
|
|
26
26
|
CMDS = {
|
|
27
27
|
ARO: {
|
|
28
|
+
CONSOLE: :console,
|
|
28
29
|
CREATE: :create,
|
|
29
30
|
COR: :cor,
|
|
30
31
|
TECK: :teck,
|
|
31
|
-
DOM: :dom,
|
|
32
32
|
INIT: :init,
|
|
33
33
|
},
|
|
34
|
-
COR: {}, # see Aos::Cor
|
|
35
34
|
TECK: {
|
|
36
35
|
DRAW: :draw,
|
|
37
36
|
EXPLORE: :explore,
|
|
@@ -41,10 +40,6 @@ module CLI
|
|
|
41
40
|
SHOW: :show,
|
|
42
41
|
SHUFFLE: :shuffle,
|
|
43
42
|
},
|
|
44
|
-
DOM: {
|
|
45
|
-
INIT: :init,
|
|
46
|
-
NEW: :new,
|
|
47
|
-
},
|
|
48
43
|
}
|
|
49
44
|
|
|
50
45
|
end
|
data/sys/cli/create.rb
CHANGED
|
@@ -13,11 +13,11 @@ module CLI
|
|
|
13
13
|
CLI::Nterface.exit_error_missing_args!(:var_aro_name) if CLI::ARGV1.nil?
|
|
14
14
|
|
|
15
15
|
name = CLI::ARGV1&.to_s
|
|
16
|
-
Aro::P.say(I18n.t("
|
|
16
|
+
Aro::P.say(I18n.t("messages.creation_attempt", name: name))
|
|
17
17
|
if Aro::Mancy.create(name)
|
|
18
|
-
Aro::P.say(I18n.t("
|
|
18
|
+
Aro::P.say(I18n.t("messages.creation_success", name: name))
|
|
19
19
|
else
|
|
20
|
-
Aro::P.say(I18n.t("
|
|
20
|
+
Aro::P.say(I18n.t("messages.creation_failure", name: name))
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
data/sys/cli/nterface.rb
CHANGED
|
@@ -11,26 +11,26 @@
|
|
|
11
11
|
module CLI
|
|
12
12
|
class Nterface
|
|
13
13
|
def self.exit_error_not_found!(arg)
|
|
14
|
-
Aro::P.say(I18n.t("
|
|
15
|
-
Aro::P.say(I18n.t("
|
|
14
|
+
Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
|
|
15
|
+
Aro::P.say(I18n.t("errors.not_found", cmd: arg))
|
|
16
16
|
exit(CLI::EXIT_CODES[:INVALID_ARG])
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def self.exit_error_missing_args!(arg)
|
|
20
|
-
Aro::P.say(I18n.t("
|
|
21
|
-
Aro::P.say(I18n.t("
|
|
20
|
+
Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
|
|
21
|
+
Aro::P.say(I18n.t("errors.missing_args", cmd: arg))
|
|
22
22
|
exit(CLI::EXIT_CODES[:INVALID_ARG])
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def self.exit_error_invalid_usage!
|
|
26
|
-
Aro::P.say(I18n.t("
|
|
27
|
-
Aro::P.say(I18n.t("
|
|
26
|
+
Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
|
|
27
|
+
Aro::P.say(I18n.t("errors.invalid_usage", cmd: Aro::Mancy))
|
|
28
28
|
exit(CLI::EXIT_CODES[:GENERAL_ERROR])
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def self.exit_error_not_initialized!
|
|
32
|
-
Aro::P.say(I18n.t("
|
|
33
|
-
Aro::P.say(I18n.t("
|
|
32
|
+
Aro::P.say(I18n.t("errors.header", cmd: Aro::Mancy))
|
|
33
|
+
Aro::P.say(I18n.t("errors.not_initialized", cmd: Aro::Mancy))
|
|
34
34
|
exit(CLI::EXIT_CODES[:GENERAL_ERROR])
|
|
35
35
|
end
|
|
36
36
|
end
|
data/sys/cli/teck.rb
CHANGED
|
@@ -10,30 +10,30 @@
|
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
12
|
def self.teck
|
|
13
|
-
Aro::Mancy.init
|
|
13
|
+
Aro::Mancy.init(Aro::Mancy.root_dir)
|
|
14
14
|
action = CLI::ARGV1&.to_sym
|
|
15
15
|
if CLI::FLAGS[:HELP].include?(action)
|
|
16
16
|
CLI.usage_teck
|
|
17
17
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
18
|
-
elsif action.nil?
|
|
18
|
+
elsif action.nil?
|
|
19
19
|
# no args, open teck menu
|
|
20
20
|
if Aro::Mancy.in_aro?
|
|
21
21
|
Aro::Teck.display_selection_menu
|
|
22
22
|
else
|
|
23
|
-
Aro::P.say(I18n.t("
|
|
23
|
+
Aro::P.say(I18n.t("errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
24
24
|
end
|
|
25
25
|
elsif action == CLI::CMDS[:TECK][:NEW]
|
|
26
26
|
CLI::Nterface.exit_error_missing_args!(:var_teck_name) if CLI::ARGV2.nil?
|
|
27
27
|
if Aro::Mancy.in_aro?
|
|
28
28
|
teck = Aro::Teck.make(CLI::ARGV2.to_s)
|
|
29
|
-
Aro::P.say(I18n.t("
|
|
29
|
+
Aro::P.say(I18n.t("messages.teck_created_sucessfully", name: teck.name))
|
|
30
30
|
Aro::Teck.display_selection_menu
|
|
31
31
|
else
|
|
32
|
-
Aro::P.say(I18n.t("
|
|
32
|
+
Aro::P.say(I18n.t("errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
|
|
33
33
|
end
|
|
34
34
|
elsif CLI::CMDS[:TECK].values.include?(action)
|
|
35
35
|
if Aro::Mancy.teck.nil?
|
|
36
|
-
Aro::P.say(I18n.t("
|
|
36
|
+
Aro::P.say(I18n.t("errors.missing_teck", cmd: Aro::Mancy::I2097I))
|
|
37
37
|
exit(CLI::EXIT_CODES[:GENERAL_ERROR])
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -42,28 +42,27 @@ module CLI
|
|
|
42
42
|
Aro::Mancy.teck.explore
|
|
43
43
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
44
44
|
when CLI::CMDS[:TECK][:SHUFFLE]
|
|
45
|
-
Aro::P.say(I18n.t("
|
|
45
|
+
Aro::P.say(I18n.t("messages.shuffling", name: Aro::Mancy.teck.name))
|
|
46
46
|
Aro::Mancy.teck.shuffle
|
|
47
47
|
when CLI::CMDS[:TECK][:DRAW]
|
|
48
|
-
|
|
49
|
-
Aro::P.say(I18n.t("
|
|
50
|
-
Aro::P.say(I18n.t("
|
|
48
|
+
Aro::Cor.instance.load_env
|
|
49
|
+
Aro::P.say(I18n.t("messages.drawing", name: Aro::Mancy.teck.name))
|
|
50
|
+
Aro::P.say(I18n.t("messages.drawing_from_dimension", dimension: "#{Aro::Cor.ivar(:DIMENSION)}"))
|
|
51
51
|
Aro::Mancy.teck.draw(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
z: Aos::Cor.ivar(:Z)
|
|
52
|
+
z_max: Aro::Cor.ivar(:Z_MAX).to_i,
|
|
53
|
+
z: Aro::Cor.ivar(:Z)
|
|
55
54
|
)
|
|
56
55
|
when CLI::CMDS[:TECK][:REPLACE]
|
|
57
|
-
Aro::P.say(I18n.t("
|
|
56
|
+
Aro::P.say(I18n.t("messages.replacing_drawn", name: Aro::Mancy.teck.name))
|
|
58
57
|
Aro::Mancy.teck.replace
|
|
59
58
|
when CLI::CMDS[:TECK][:RESET]
|
|
60
|
-
Aro::P.say("#{I18n.t("
|
|
61
|
-
if Aro::Mancy::YES.to_s !=
|
|
62
|
-
Aro::P.say(I18n.t("
|
|
59
|
+
Aro::P.say("#{I18n.t("messages.confirmation_prompt", name: Aro::Mancy.teck.name)}")
|
|
60
|
+
if Aro::Mancy::YES.to_s != Aro::P.p.ask("\n#{Aro::Mancy.ps1_display}$")
|
|
61
|
+
Aro::P.say(I18n.t("messages.understood", name: Aro::Mancy.teck.name))
|
|
63
62
|
exit(CLI::EXIT_CODES[:SUCCESS])
|
|
64
63
|
end
|
|
65
64
|
|
|
66
|
-
Aro::P.say(I18n.t("
|
|
65
|
+
Aro::P.say(I18n.t("messages.resetting", name: Aro::Mancy.teck.name))
|
|
67
66
|
Aro::Mancy.teck.reset
|
|
68
67
|
end
|
|
69
68
|
Aro::Mancy.teck.show(**CLI::shoptions)
|
data/sys/cli/usage.rb
CHANGED
|
@@ -10,18 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
module CLI
|
|
12
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
13
|
def self.usage_main
|
|
22
14
|
Aro::P.less(I18n.t("usage.main"))
|
|
23
15
|
end
|
|
24
16
|
|
|
17
|
+
def self.usage_cor
|
|
18
|
+
Aro::P.less(I18n.t("usage.cor"))
|
|
19
|
+
end
|
|
20
|
+
|
|
25
21
|
def self.usage_teck
|
|
26
22
|
Aro::P.less(I18n.t("usage.teck"))
|
|
27
23
|
end
|
data/sys/cli.rb
CHANGED
data/sys/reiquire.rb
CHANGED
|
@@ -8,41 +8,162 @@
|
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
|
-
# dependencies
|
|
12
|
-
require :active_record.to_s
|
|
13
|
-
require :"active_record/schema_dumper".to_s
|
|
14
|
-
require :base64.to_s
|
|
15
|
-
require :ffi.to_s
|
|
16
|
-
require :fileutils.to_s
|
|
17
|
-
require :"io/console".to_s
|
|
18
|
-
require :i18n.to_s
|
|
19
|
-
require :"net/http".to_s
|
|
20
|
-
require :readline.to_s
|
|
21
|
-
require :"tty-prompt".to_s
|
|
22
|
-
require :yaml.to_s
|
|
23
|
-
|
|
24
11
|
module Reiquire
|
|
25
|
-
GEM_PATH = Gem.loaded_specs[:aro.to_s]&.full_gem_path
|
|
26
|
-
|
|
27
12
|
def self.aro
|
|
28
|
-
#
|
|
13
|
+
# require runtime dependencies
|
|
14
|
+
require_dependencies!
|
|
29
15
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
I18n.default_locale = :en
|
|
16
|
+
# require aro library
|
|
17
|
+
require_reiquires!
|
|
33
18
|
|
|
34
|
-
#
|
|
35
|
-
|
|
19
|
+
# configure locale
|
|
20
|
+
configure_i18n
|
|
36
21
|
|
|
37
|
-
#
|
|
38
|
-
|
|
22
|
+
# ensure base migrations exist
|
|
23
|
+
copy_db_migrations_from_gem! if Aro::Mancy.in_aro?
|
|
39
24
|
end
|
|
40
25
|
|
|
41
26
|
def self.requires(dirs)
|
|
42
27
|
dirs.each{|d|
|
|
43
28
|
Dir[
|
|
44
|
-
File.join(__dir__, d.to_s, :"
|
|
45
|
-
].each { |f| require f}
|
|
29
|
+
File.join(__dir__, d.to_s, :"**/**/*.rb".to_s)
|
|
30
|
+
].each { |f| require f }
|
|
46
31
|
}
|
|
47
32
|
end
|
|
33
|
+
|
|
34
|
+
def self.reload_i18n!
|
|
35
|
+
copy_locale_files_from_gem!
|
|
36
|
+
configure_i18n
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.gem_migrations_path
|
|
40
|
+
File.join(gem_dir, :"sys/aro/db".to_s)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.gem_locale_dir
|
|
44
|
+
File.join(gem_dir, :locale.to_s)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.gem_locales_filepaths
|
|
48
|
+
File.join(gem_locale_dir, "*.yml")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def self.copy_db_migrations_from_gem!
|
|
52
|
+
puts __method__
|
|
53
|
+
puts Aro::Cor.ivar(:OSS_OM_HOME)
|
|
54
|
+
return if Aro::Cor.ivar(:OSS_OM_HOME).nil? || oss_om_up_to_date?(
|
|
55
|
+
Aro::Db.gem_migrations_filepaths,
|
|
56
|
+
Aro::Db.migrations_filepaths
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
FileUtils.mkdir_p(Aro::Db.migrate_dir)
|
|
60
|
+
FileUtils.cp_r(
|
|
61
|
+
gem_migrations_path,
|
|
62
|
+
Aro::Db.migrate_dir
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def self.copy_locale_files_from_gem!
|
|
69
|
+
puts __method__
|
|
70
|
+
puts Aro::Cor.ivar(:OSS_OM_HOME)
|
|
71
|
+
return if Aro::Cor.ivar(:OSS_OM_HOME).nil? || oss_om_up_to_date?(
|
|
72
|
+
gem_locales_filepaths,
|
|
73
|
+
Aro::Dom::Locale.locales_filepaths
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
oss_wtf = File.join(Aro::Mancy.root_dir, :locale.to_s, :locale.to_s)
|
|
77
|
+
if Dir.exist?(oss_wtf)
|
|
78
|
+
FileUtils.rm_rf(oss_wtf)
|
|
79
|
+
oss_om_up_to_date!(
|
|
80
|
+
gem_locales_filepaths,
|
|
81
|
+
Aro::Dom::Locale.locale_dir
|
|
82
|
+
)
|
|
83
|
+
return
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
FileUtils.mkdir_p(Aro::Dom::Locale.locale_dir)
|
|
87
|
+
FileUtils.cp_r(
|
|
88
|
+
gem_locale_dir,
|
|
89
|
+
Aro::Dom::Locale.locale_dir
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def self.oss_om_up_to_date!(gem_filepaths, oss_om_dir)
|
|
94
|
+
puts __method__
|
|
95
|
+
gem_files_abs = Dir[gem_filepaths].map{|fp| File.absolute_path(fp)}
|
|
96
|
+
puts "gem_files_abs: #{gem_files_abs}"
|
|
97
|
+
|
|
98
|
+
puts "FileUtils.mkdir_p(#{oss_om_dir})"
|
|
99
|
+
FileUtils.mkdir_p(oss_om_dir)
|
|
100
|
+
gem_files_abs.each{|gfa|
|
|
101
|
+
puts "FileUtils.cp(#{File.basename(gfa)}, #{File.basename(oss_om_dir)})"
|
|
102
|
+
FileUtils.cp(gfa, oss_om_dir)
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.oss_om_up_to_date?(gem_filepaths, oss_om_filepaths)
|
|
107
|
+
puts __method__
|
|
108
|
+
file_names = Dir[oss_om_filepaths].map{|fp| File.basename(fp)}
|
|
109
|
+
puts "file_names: #{file_names}"
|
|
110
|
+
gem_file_names = Dir[gem_filepaths].map{|fp| File.basename(fp)}
|
|
111
|
+
puts "gem_file_names: #{gem_file_names}"
|
|
112
|
+
mfs_all = gem_file_names.all?{|gfn|
|
|
113
|
+
file_names.include?(gfn)
|
|
114
|
+
}
|
|
115
|
+
puts "mfs_all: #{mfs_all}"
|
|
116
|
+
mfs_all
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def self.require_reiquires!
|
|
120
|
+
# require sys folders
|
|
121
|
+
Reiquire::requires([:shr, :aro, :cli])
|
|
122
|
+
|
|
123
|
+
# require cli module
|
|
124
|
+
require_relative :"./cli".to_s
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def self.require_dependencies!
|
|
128
|
+
[
|
|
129
|
+
:active_record,
|
|
130
|
+
:"active_record/schema_dumper",
|
|
131
|
+
:fileutils,
|
|
132
|
+
:i18n,
|
|
133
|
+
:"tty-prompt"
|
|
134
|
+
].each{|d| require d.to_s}
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def self.gem_dir
|
|
138
|
+
Dir[
|
|
139
|
+
Gem.loaded_specs[Aro.to_s.downcase]&.full_gem_path
|
|
140
|
+
].first
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def self.configure_i18n
|
|
144
|
+
Aro::D.say(__method__)
|
|
145
|
+
gem_dir_variable = gem_dir
|
|
146
|
+
copy_locale_files_from_gem!
|
|
147
|
+
aro_i18n_library = File.join(gem_dir_variable, :locale.to_s, "*.yml")
|
|
148
|
+
if Aro::Mancy.is_initialized?
|
|
149
|
+
I18n.load_path = I18n.load_path.select{|lp|
|
|
150
|
+
# stop using gem locales if in_aro?
|
|
151
|
+
!gem_dir_variable.include?(lp)
|
|
152
|
+
}
|
|
153
|
+
aro_i18n_library = File.join(Aro::Dom::Locale.locale_dir, "*.yml")
|
|
154
|
+
end
|
|
155
|
+
I18n.load_path += Dir[aro_i18n_library]
|
|
156
|
+
|
|
157
|
+
I18n.available_locales = [:en]
|
|
158
|
+
I18n.default_locale = :en
|
|
159
|
+
Aro::D.say("I18n.load_path")
|
|
160
|
+
Aro::D.say(I18n.load_path)
|
|
161
|
+
Aro::D.say("I18n.available_locales")
|
|
162
|
+
Aro::D.say(I18n.available_locales)
|
|
163
|
+
Aro::D.say("I18n.default_locale")
|
|
164
|
+
Aro::D.say(I18n.default_locale)
|
|
165
|
+
Aro::D.say("I18n.reload!")
|
|
166
|
+
Aro::D.say(I18n.reload!)
|
|
167
|
+
end
|
|
168
|
+
|
|
48
169
|
end
|
data/sys/shr/.DS_Store
ADDED
|
Binary file
|
data/sys/shr/prompt.rb
CHANGED
|
@@ -23,15 +23,21 @@ module Aro
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def self.should_print?
|
|
26
|
-
|
|
26
|
+
Aro::Cor::BOOLS[:TRUE]
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def self.say(message)
|
|
30
|
-
|
|
30
|
+
p.say(normalize_message(message))
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def self.less(message)
|
|
34
34
|
IO.popen("less -X", "w") { |f| f.puts(message) }
|
|
35
35
|
end
|
|
36
|
+
|
|
37
|
+
def self.normalize_message(message)
|
|
38
|
+
return message.join("\n") if message.kind_of?(Array)
|
|
39
|
+
|
|
40
|
+
message
|
|
41
|
+
end
|
|
36
42
|
end
|
|
37
43
|
end
|
data/sys/shr/t.rb
CHANGED
|
@@ -15,8 +15,8 @@ module Aro
|
|
|
15
15
|
RUBY_FACOT = :"Ruby::Facot".to_s
|
|
16
16
|
|
|
17
17
|
def self.is_dev_tarot?
|
|
18
|
-
user_setting_true =
|
|
19
|
-
Aro::T.is_dev_tarot_avail? && (user_setting_true ||
|
|
18
|
+
user_setting_true = Aro::Cor.ivar(:DIMENSION)&.to_sym == Aro::Cor::DMS[:DEV_TAROT]
|
|
19
|
+
Aro::T.is_dev_tarot_avail? && (user_setting_true || Aro::Cor.ivar(:DIMENSION).nil?)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def self.is_dev_tarot_avail?
|
|
@@ -30,7 +30,7 @@ module Aro
|
|
|
30
30
|
# VERY IMPORTANT!
|
|
31
31
|
File.open(Aro::T::DEV_TAROT_FILE.to_s, "r"){|dtf| dt = dtf.read(Aro::Mancy::N).strip}
|
|
32
32
|
# VERY IMPORTANT!
|
|
33
|
-
Aro::V.say(I18n.t("
|
|
33
|
+
Aro::V.say(I18n.t("very_important", dev_tarot: dt))
|
|
34
34
|
else
|
|
35
35
|
Aro::D.say("error: #{Aro::T::DEV_TAROT_FILE.to_s} not installed.")
|
|
36
36
|
end
|
|
@@ -46,7 +46,7 @@ module Aro
|
|
|
46
46
|
|
|
47
47
|
# summon ruby_facot
|
|
48
48
|
def self.summon_ruby_facot(include_o = true)
|
|
49
|
-
Aro::D.say(I18n.t("
|
|
49
|
+
Aro::D.say(I18n.t("messages.ruby_facot_random"))
|
|
50
50
|
ruby_facot = I18n.t("cards.index").map{|c| "+#{c}"}.sample.split("")
|
|
51
51
|
|
|
52
52
|
# get orientation
|
|
@@ -62,7 +62,7 @@ module Aro
|
|
|
62
62
|
# => character[0]: orientation
|
|
63
63
|
# => character[1]: suit
|
|
64
64
|
|
|
65
|
-
# the first two characters in the dev_tarot format designate the
|
|
65
|
+
# the first two characters in the dev_tarot format designate the rf os
|
|
66
66
|
!ruby_facot.first(Aro::Mancy::OS).include?(c)
|
|
67
67
|
}.join("").to_sym
|
|
68
68
|
rf += Aro::Mancy::NUMERALS[symm].to_s
|
data/sys/shr/version.rb
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module Aro
|
|
12
|
-
VERSION = :"0.2.
|
|
13
|
-
RELEASE_NOTES =
|
|
12
|
+
VERSION = :"0.2.6"
|
|
13
|
+
RELEASE_NOTES = [
|
|
14
|
+
:removes_aos,
|
|
15
|
+
:removes_ino,
|
|
16
|
+
:reduces_ruby_4_0_7_to_3_4_7,
|
|
17
|
+
:adds_menus_and_data,
|
|
18
|
+
:removes_aro_cli,
|
|
19
|
+
:adds_oss_om
|
|
20
|
+
].join("\n:")
|
|
14
21
|
end
|
data/tasks/make.rake
CHANGED