aro 0.1.8 → 0.2.0
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/bin/aos +8 -3
- data/bin/aro +5 -2
- data/checksums/aro-0.1.9.gem.sha512 +1 -0
- data/checksums/aro-0.2.0.gem.sha512 +1 -0
- data/db/migrate/1763374647_create_decks.rb +2 -2
- data/listen.rb +1 -1
- data/locale/en.aos.yml +5 -1
- data/locale/en.cards.yml +156 -156
- data/locale/en.cngelog.yml +1 -1
- data/locale/en.dom.yml +42 -0
- data/locale/en.usage.yml +15 -10
- data/locale/en.yml +12 -15
- data/sys/aos/aos.rb +249 -114
- data/sys/aos/db.rb +13 -6
- data/sys/aos/views/base.rb +72 -45
- data/sys/aos/views/dom.rb +1 -10
- data/sys/aos/views/games/game.rb +92 -0
- data/sys/aos/views/setup/settings.rb +3 -16
- data/sys/aos/you.rb +4 -0
- data/sys/aro/db.rb +12 -7
- data/sys/aro/mancy.rb +16 -9
- data/sys/aro/p.rb +2 -2
- data/sys/cli/config.rb +131 -44
- data/sys/cli/constants.rb +3 -3
- data/sys/cli/deck.rb +27 -13
- data/sys/cli/dom.rb +11 -4
- data/sys/dom/d.rb +24 -14
- data/sys/dom/dom.rb +41 -27
- data/sys/dom/p.rb +1 -1
- data/sys/models/deck.rb +25 -12
- data/sys/reiquire.rb +2 -0
- data/sys/shr/prompt.rb +4 -0
- data/sys/shr/t.rb +19 -9
- data/sys/shr/version.rb +2 -4
- metadata +5 -3
- data/sys/aos/views/games/deck.rb +0 -95
data/locale/en.cngelog.yml
CHANGED
data/locale/en.dom.yml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
en:
|
|
2
|
+
dom:
|
|
3
|
+
wings:
|
|
4
|
+
welcome:
|
|
5
|
+
description: "sign up process."
|
|
6
|
+
games:
|
|
7
|
+
description: "aro game rooms."
|
|
8
|
+
know:
|
|
9
|
+
description: "information space."
|
|
10
|
+
setup:
|
|
11
|
+
description: "user configuration space."
|
|
12
|
+
rooms:
|
|
13
|
+
waite:
|
|
14
|
+
description: "sign up."
|
|
15
|
+
winner:
|
|
16
|
+
description: "win."
|
|
17
|
+
abpps:
|
|
18
|
+
description: "artificial beings."
|
|
19
|
+
hbpps:
|
|
20
|
+
description: "human beings."
|
|
21
|
+
shpps:
|
|
22
|
+
description: "human and artificial beings."
|
|
23
|
+
vipps:
|
|
24
|
+
description: "only dev_tarot users. no ruby_facots allowed."
|
|
25
|
+
library:
|
|
26
|
+
description: "definition management."
|
|
27
|
+
temple:
|
|
28
|
+
description: "mindfulness management."
|
|
29
|
+
settings:
|
|
30
|
+
description: "user settings and configuration."
|
|
31
|
+
errors:
|
|
32
|
+
directory_exists: "unable to create arodome at %{name}. file or directory already exists."
|
|
33
|
+
failed_already_in_arodom: "unable to create an arodome because you are already in arodom."
|
|
34
|
+
failed_in_aro_space: "unable to create an arodome inside of aro space."
|
|
35
|
+
failed_already_initialized: "arodome is already initialized. doing nothing."
|
|
36
|
+
messages:
|
|
37
|
+
arodome_created: "%{name} arodome created. enter the following commands to begin: $ cd %{name}"
|
|
38
|
+
creating_arodome: "creating arodome named %{name}"
|
|
39
|
+
generating_wings: "generating wings..."
|
|
40
|
+
generating_wing: "generating the %{wing} wing..."
|
|
41
|
+
generating_room: "generating the %{room} room."
|
|
42
|
+
initialization_complete: "%{name} initialization complete! use aos to begin."
|
data/locale/en.usage.yml
CHANGED
|
@@ -22,14 +22,25 @@ en:
|
|
|
22
22
|
this runs by default after create and has no effect if init is complete.
|
|
23
23
|
|
|
24
24
|
config
|
|
25
|
-
config management
|
|
26
|
-
|
|
25
|
+
aro config management.
|
|
26
|
+
|
|
27
|
+
$ aro config <commands>
|
|
28
|
+
|
|
29
|
+
passing no args opens prints the current config.
|
|
30
|
+
|
|
31
|
+
SUBCOMMANDS
|
|
32
|
+
set
|
|
33
|
+
sets an ivar to a specified value. the aro var prefix can be omitted.
|
|
34
|
+
|
|
35
|
+
$ aro config set <var_name> <var_value>
|
|
27
36
|
|
|
28
37
|
deck
|
|
29
|
-
manage decks in the current room
|
|
38
|
+
manage decks in the current room.
|
|
30
39
|
|
|
31
40
|
$ aro deck <commands>
|
|
32
41
|
|
|
42
|
+
passing no args opens the selection menu.
|
|
43
|
+
|
|
33
44
|
note:
|
|
34
45
|
|
|
35
46
|
deck subcommands do not require typing 'deck'. for example,
|
|
@@ -90,16 +101,10 @@ en:
|
|
|
90
101
|
shuffles the current deck and generates a log record.
|
|
91
102
|
|
|
92
103
|
dom
|
|
93
|
-
|
|
104
|
+
arodom management.
|
|
94
105
|
|
|
95
106
|
$ aro dom <commands>
|
|
96
107
|
|
|
97
|
-
note: passing no arguments displays the main dom.
|
|
98
|
-
|
|
99
|
-
example
|
|
100
|
-
|
|
101
|
-
$ aro dom
|
|
102
|
-
|
|
103
108
|
SUBCOMMANDS
|
|
104
109
|
init
|
|
105
110
|
generate the arodome
|
data/locale/en.yml
CHANGED
|
@@ -16,7 +16,6 @@ en:
|
|
|
16
16
|
I2097I_description: "read-only env var for i2097i."
|
|
17
17
|
YES_description: "read-only env var for 'aroyes'."
|
|
18
18
|
ALL_description: "read-only env var for 'all'."
|
|
19
|
-
def_type: "CLI::Config::DEF_TYPES"
|
|
20
19
|
dimension:
|
|
21
20
|
description: "selected dimension of aro space."
|
|
22
21
|
dev_tarot_description: "reads from /dev/tarot device if available."
|
|
@@ -25,43 +24,41 @@ en:
|
|
|
25
24
|
description: "aro output format."
|
|
26
25
|
text_description: "show aro responses in text format (default)"
|
|
27
26
|
json_description: "show aro responses in json format."
|
|
28
|
-
|
|
29
27
|
height_description: "display height. valid range: (${min}-${max})"
|
|
30
28
|
width_description: "display width. valid range: (${min}-${max})"
|
|
31
|
-
|
|
32
29
|
env:
|
|
33
30
|
description: "aro run environment."
|
|
34
31
|
development_description: "basic development logs and features."
|
|
35
32
|
production_description: "game logging only."
|
|
36
33
|
test_description: "logging and features tailored for tests."
|
|
37
|
-
|
|
34
|
+
verbose_description: "enable verbose logging in development env."
|
|
35
|
+
log_aos_db_description: "show aos database transactions."
|
|
36
|
+
log_aro_db_description: "show aro database transactions"
|
|
38
37
|
generate: "generating default config file at %{name}."
|
|
39
38
|
source: "installing ivars from %{name}..."
|
|
40
|
-
|
|
41
39
|
maximum: "max"
|
|
42
40
|
minimum: "min"
|
|
43
41
|
possible_values: "possible values"
|
|
44
|
-
|
|
45
42
|
type:
|
|
46
43
|
bool_description: "true or false."
|
|
47
44
|
int_description: "a primitive decimal-less numeric."
|
|
48
45
|
string_description: "a blank-space-terminated string of characters."
|
|
49
46
|
values_description: "an enumerated type."
|
|
50
|
-
|
|
51
47
|
z_description: "sleep time between attempts to read /dev/tarot. valid range (%{min}-%{max})"
|
|
52
48
|
z_max_description: "max number of z long sleeps before giving up. valid range (%{min}-%{max})"
|
|
53
49
|
errors:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
not_initialized: "
|
|
50
|
+
header: "%{cmd} says there was a problem."
|
|
51
|
+
invalid_usage: "%{cmd} says you're not supposed to be here."
|
|
52
|
+
missing_args: "%{cmd} says missing required argument(s)."
|
|
53
|
+
missing_deck: "%{cmd} says no deck selected. use 'aro deck' to select one or 'aro deck new <name>' to create one."
|
|
54
|
+
not_in_aro: "%{cmd} says you are not in aro space. that command will not work here."
|
|
55
|
+
not_in_aos: "%{cmd} says you are not in aos space. that command will not work here."
|
|
56
|
+
not_initialized: "%{cmd} says you need to initialize aro. run 'aro init' to do so"
|
|
61
57
|
warnings:
|
|
62
58
|
invalid_order: "the order specified for displaying logs in invalid. using default (desc)."
|
|
63
59
|
messages:
|
|
64
60
|
choose_card: "choose a card."
|
|
61
|
+
choose_deck: "choose a deck."
|
|
65
62
|
confirmation_prompt: "input 'aroyes' to reset %{name}, or enter to cancel (cancel): "
|
|
66
63
|
creating: "creating %{name}..."
|
|
67
64
|
creation_attempt: "attempting to create aro table named %{name}..."
|
|
@@ -92,7 +89,7 @@ en:
|
|
|
92
89
|
see aro --help for usage.
|
|
93
90
|
showing: "showing %{name} [count:%{count}, order:%{order}]..."
|
|
94
91
|
shuffling: "shuffling %{name}'s cards..."
|
|
95
|
-
replacing_drawn: "all drawn cards to %{name}..."
|
|
92
|
+
replacing_drawn: "replacing all drawn cards to %{name}..."
|
|
96
93
|
resetting: "resetting %{name}'s cards..."
|
|
97
94
|
understood: "%{name} says: 'understood.'"
|
|
98
95
|
welcome: "welcome.to.the.%{name}."
|
data/sys/aos/aos.rb
CHANGED
|
@@ -13,32 +13,28 @@ require :aro.to_s
|
|
|
13
13
|
module Aos
|
|
14
14
|
|
|
15
15
|
def self.run
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def self.watch
|
|
21
|
-
Aos::Os::boot(Aos::you)
|
|
22
|
-
Aos::Os::instance.render
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def self.you
|
|
26
|
-
Aos::Db.new
|
|
27
|
-
you = Aos::You.where(name: :you).first
|
|
28
|
-
if you.nil?
|
|
29
|
-
you = Aos::You.new(name: :you, pwd: Dir.pwd)
|
|
30
|
-
you.save
|
|
16
|
+
begin
|
|
17
|
+
Aos::Os.instance.run
|
|
18
|
+
rescue Interrupt => e
|
|
19
|
+
Aos.run
|
|
31
20
|
end
|
|
21
|
+
end
|
|
32
22
|
|
|
33
|
-
|
|
23
|
+
def self.process
|
|
24
|
+
cmd = ARGV.join(" ")
|
|
25
|
+
Aro::D.say("processing cmd #{cmd}...")
|
|
26
|
+
Aos::Os::instance.process_cmd(cmd)
|
|
34
27
|
end
|
|
35
28
|
|
|
36
29
|
class Os
|
|
37
30
|
include Singleton
|
|
38
31
|
|
|
39
|
-
attr_accessor :you, :running, :view
|
|
32
|
+
attr_accessor :you, :running, :view, :db
|
|
40
33
|
|
|
41
|
-
|
|
34
|
+
A = :"@"
|
|
35
|
+
STAR = :"*"
|
|
36
|
+
PS1 = :">[#{Aos::Os}]>: "
|
|
37
|
+
DATE_FORMAT = "%A %d %b %Y %I:%M:%S %p"
|
|
42
38
|
|
|
43
39
|
CMDS = {
|
|
44
40
|
CD: {
|
|
@@ -53,7 +49,7 @@ module Aos
|
|
|
53
49
|
cmds: {
|
|
54
50
|
SET: {
|
|
55
51
|
key: :set,
|
|
56
|
-
description: I18n.t("aos.commands.description.config_set"),
|
|
52
|
+
description: I18n.t("aos.commands.description.config_set", prefix: CLI::Config::ARO_CONFIG_PREFIX),
|
|
57
53
|
usage: I18n.t("aos.commands.usage.config_set"),
|
|
58
54
|
}
|
|
59
55
|
}
|
|
@@ -68,6 +64,11 @@ module Aos
|
|
|
68
64
|
description: I18n.t("aos.commands.description.ls"),
|
|
69
65
|
usage: I18n.t("aos.commands.usage.ls"),
|
|
70
66
|
},
|
|
67
|
+
LL: {
|
|
68
|
+
key: :ll,
|
|
69
|
+
description: I18n.t("aos.commands.description.ll"),
|
|
70
|
+
usage: I18n.t("aos.commands.usage.ll"),
|
|
71
|
+
},
|
|
71
72
|
PWD: {
|
|
72
73
|
key: :pwd,
|
|
73
74
|
description: I18n.t("aos.commands.description.pwd"),
|
|
@@ -75,125 +76,259 @@ module Aos
|
|
|
75
76
|
},
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
def
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
def initialize
|
|
80
|
+
if Aro::Dom.in_arodom? && !Aro::Dom.is_initialized?
|
|
81
|
+
Aro::Dom.new.generate
|
|
82
|
+
end
|
|
83
|
+
@db = Aos::Db.new
|
|
84
|
+
load_you
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def load_you
|
|
88
|
+
@you = Aos::You.where(name: :you).first
|
|
89
|
+
@you = Aos::You.create(name: :you, pwd: Dir.pwd) if @you.nil?
|
|
90
|
+
Aro::D.say(@you.inspect)
|
|
81
91
|
end
|
|
82
92
|
|
|
83
93
|
def load_view
|
|
84
|
-
view_name = Aos::Os.osify(you.pwd).split("/").last || :dom.to_s
|
|
85
|
-
view_cls =
|
|
94
|
+
view_name = Aos::Os.osify(@you.pwd).split("/").last || :dom.to_s
|
|
95
|
+
view_cls = nil
|
|
96
|
+
begin
|
|
97
|
+
view_cls = (Aos::Vi.name + "::#{view_name.capitalize}").constantize
|
|
98
|
+
rescue
|
|
99
|
+
view_cls = Aos::Vi::Base
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
Dir.chdir(@you.pwd) do
|
|
103
|
+
if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
|
|
104
|
+
view_cls = Aos::Vi::Game
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
86
108
|
Aro::D.say("loading view #{view_cls}")
|
|
87
|
-
|
|
109
|
+
@view = view_cls
|
|
88
110
|
end
|
|
89
111
|
|
|
90
|
-
def
|
|
91
|
-
return
|
|
112
|
+
def self.osify(path)
|
|
113
|
+
return path unless Aro::Dom.in_arodom?
|
|
114
|
+
path_arr = path.split("/")
|
|
115
|
+
Aro::Dom::dom_root.split("/").each{|rdp| path_arr.delete(rdp)}
|
|
116
|
+
path_arr.join("/")
|
|
117
|
+
end
|
|
92
118
|
|
|
93
|
-
|
|
119
|
+
def self.is_aos_command?(arg)
|
|
120
|
+
# determine if command is Aos::Os::CMDS
|
|
121
|
+
# passthrough to system if command is not in Aos::Os::CMDS
|
|
122
|
+
Aos::Os::CMDS.values.map{|v| v[:key]}.include?(arg.to_sym)
|
|
94
123
|
end
|
|
95
124
|
|
|
96
|
-
def
|
|
97
|
-
|
|
125
|
+
def render
|
|
126
|
+
load_view
|
|
127
|
+
return if @view.nil?
|
|
128
|
+
Dir.chdir(@you.reload.pwd) do
|
|
129
|
+
if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
|
|
130
|
+
system(:aro.to_s)
|
|
131
|
+
else
|
|
132
|
+
@view.show(@you)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
98
136
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
137
|
+
def process_cmd(cmd)
|
|
138
|
+
Dir.chdir(@you.reload.pwd) do
|
|
139
|
+
passthrough = main(cmd)
|
|
140
|
+
if CLI::Config.is_format_text?
|
|
141
|
+
IO.console.goto(Aro::Mancy::O, Aro::Mancy::O)
|
|
142
|
+
end
|
|
143
|
+
if passthrough
|
|
144
|
+
system(cmd)
|
|
145
|
+
Aos::S.say("\n")
|
|
146
|
+
else
|
|
147
|
+
render
|
|
148
|
+
end
|
|
149
|
+
end
|
|
103
150
|
|
|
104
|
-
|
|
105
|
-
|
|
151
|
+
CLI::EXIT_CODES[:SUCCESS]
|
|
152
|
+
end
|
|
106
153
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
))
|
|
117
|
-
Dir.chdir(you.pwd)
|
|
118
|
-
next
|
|
119
|
-
end
|
|
154
|
+
def confgiure_readline
|
|
155
|
+
# configure Readline
|
|
156
|
+
# Readline.completion_append_character = "/"
|
|
157
|
+
Readline.completion_proc = Proc.new{|str|
|
|
158
|
+
# todo: the reserved_words search is working but the || case is not
|
|
159
|
+
Aro::Dom::D.reserved_words.grep(/^#{Regexp.escape(str)}/) ||
|
|
160
|
+
Dir[@you.pwd + str + Aos::Os::STAR.to_s].grep(/^#{Regexp.escape(str)}/)
|
|
161
|
+
}
|
|
162
|
+
end
|
|
120
163
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
164
|
+
def run
|
|
165
|
+
# run condition
|
|
166
|
+
@running = true
|
|
167
|
+
|
|
168
|
+
original_stdout = $stdout
|
|
169
|
+
$stdout = StringIO.open do |out|
|
|
170
|
+
cmd = nil
|
|
171
|
+
loop do
|
|
172
|
+
# erase before cursor
|
|
173
|
+
IO.console.erase_screen(Aro::Mancy::S)
|
|
174
|
+
process_cmd(cmd)
|
|
175
|
+
IO.console.goto(CLI::Config.display_config[:HEIGHT], Aro::Mancy::O)
|
|
176
|
+
break unless @running && cmd = Readline.readline(calc_ps1, true)
|
|
125
177
|
end
|
|
126
178
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
out
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
CLI::EXIT_CODES[:SUCCESS]
|
|
183
|
+
ensure
|
|
184
|
+
$stdout = original_stdout
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def main(cmd)
|
|
188
|
+
# begin game loop
|
|
189
|
+
return false if cmd.nil?
|
|
190
|
+
|
|
191
|
+
# get args
|
|
192
|
+
args = cmd.split(" ")
|
|
193
|
+
return false if args[0].nil?
|
|
194
|
+
return false if args[0] == :aos.to_s
|
|
195
|
+
|
|
196
|
+
# reconfigure for updates to pwd
|
|
197
|
+
# todo: not working for tab completion
|
|
198
|
+
confgiure_readline
|
|
199
|
+
|
|
200
|
+
args = handle_aro_override(args)
|
|
201
|
+
|
|
202
|
+
passthrough = !Aos::Os.is_aos_command?(args[Aro::Mancy::O]) ||
|
|
203
|
+
args.include?(:aos.to_s)
|
|
204
|
+
|
|
205
|
+
return false if handle_room_path(args[Aro::Mancy::O])
|
|
206
|
+
|
|
207
|
+
# set aos pwd
|
|
208
|
+
unless passthrough
|
|
209
|
+
Dir.chdir(@you.pwd) do
|
|
210
|
+
# process commands
|
|
211
|
+
case args[Aro::Mancy::O].to_sym
|
|
212
|
+
when Aos::Os::CMDS[:CONFIG][:key]
|
|
213
|
+
# config
|
|
214
|
+
passthrough = handle_config(args)
|
|
215
|
+
when Aos::Os::CMDS[:LS][:key]
|
|
216
|
+
# ls
|
|
217
|
+
handle_ls(args)
|
|
218
|
+
when Aos::Os::CMDS[:LL][:key]
|
|
219
|
+
# ll
|
|
220
|
+
handle_ll(args)
|
|
221
|
+
when Aos::Os::CMDS[:PWD][:key]
|
|
222
|
+
# pwd
|
|
223
|
+
handle_pwd(args)
|
|
224
|
+
when Aos::Os::CMDS[:EXIT][:key]
|
|
225
|
+
# exit
|
|
226
|
+
passthrough = true
|
|
227
|
+
handle_exit(args)
|
|
228
|
+
when Aos::Os::CMDS[:CD][:key]
|
|
229
|
+
# cd
|
|
230
|
+
handle_cd(args)
|
|
176
231
|
end
|
|
177
232
|
end
|
|
233
|
+
end
|
|
178
234
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
235
|
+
return passthrough
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def calc_ps1
|
|
239
|
+
you_pwd = Aos::Os::osify(@you.pwd)
|
|
240
|
+
"#{Aos::Os::PS1}" # #{you_pwd.empty? ? "" : "#{you_pwd}:"}$ "
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def handle_room_path(arg)
|
|
244
|
+
# search for reserved room path
|
|
245
|
+
handled = false
|
|
246
|
+
room_path = Aro::Dom.room_path(arg)
|
|
247
|
+
if !room_path.empty?
|
|
248
|
+
handled = true
|
|
249
|
+
@you.update(pwd: File.join(
|
|
250
|
+
File.dirname(Aro::Dom.ethergeist_path),
|
|
251
|
+
room_path
|
|
252
|
+
))
|
|
182
253
|
end
|
|
254
|
+
handled
|
|
255
|
+
end
|
|
183
256
|
|
|
184
|
-
|
|
257
|
+
def handle_aro_override(args)
|
|
258
|
+
if args[0].include?(:aro.to_s)
|
|
259
|
+
args = "#{args.join(" ")} #{:aos.to_s}".split(" ")
|
|
260
|
+
end
|
|
261
|
+
args
|
|
185
262
|
end
|
|
186
263
|
|
|
187
|
-
def
|
|
188
|
-
|
|
189
|
-
|
|
264
|
+
def handle_config(args)
|
|
265
|
+
passthrough = false
|
|
266
|
+
if args[1].nil?
|
|
267
|
+
# show settings
|
|
268
|
+
passthrough = true
|
|
269
|
+
CLI::Config.dump_config.each{|l| Aos::S.say(l)}
|
|
270
|
+
else
|
|
271
|
+
CLI::Config.process_config_command(args)
|
|
272
|
+
end
|
|
273
|
+
passthrough
|
|
274
|
+
end
|
|
190
275
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
276
|
+
def handle_ls(args)
|
|
277
|
+
Aos::S.say(Dir.glob(File.join(@you.pwd, (args[1] || "") + Aos::Os::STAR.to_s), File::FNM_EXTGLOB).map{|p| "/" + Aos::Os::osify(p)}.join("\n"))
|
|
278
|
+
end
|
|
195
279
|
|
|
196
|
-
|
|
280
|
+
def handle_ll(args)
|
|
281
|
+
Aos::S.say(Dir.glob(File.join(@you.pwd, (args[1] || "") + Aos::Os::STAR.to_s), File::FNM_DOTMATCH).map{|p| "/" + Aos::Os::osify(p)}.join("\n"))
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def handle_pwd(args)
|
|
285
|
+
osified = "/" + Aos::Os::osify(@you.pwd)
|
|
286
|
+
Aos::S.say(osified)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def handle_exit(args)
|
|
290
|
+
Aos::S.say("#{Aos::Os} is exiting...")
|
|
291
|
+
@running = false
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def handle_cd(args)
|
|
295
|
+
if args[1].nil? || args[1] == "~/"
|
|
296
|
+
# no arg takes you to arodom root
|
|
297
|
+
@you.update(pwd: File.dirname(Aro::Dom.ethergeist_path))
|
|
298
|
+
else
|
|
299
|
+
if args[1].include?(Aro::Dom::DOTT.to_s)
|
|
300
|
+
# going up
|
|
301
|
+
if File.dirname(Aro::Dom.ethergeist_path) == @you.pwd
|
|
302
|
+
Aos::S.say("within #{Aos::Os}, one cannot leave the #{Aro::Dom}.")
|
|
303
|
+
else
|
|
304
|
+
# todo: support dots in paths
|
|
305
|
+
# this only supports moving one level up
|
|
306
|
+
|
|
307
|
+
pwd_arr = @you.pwd.split("/")
|
|
308
|
+
new_pwd = (pwd_arr.first(pwd_arr.length - 1)).join("/")
|
|
309
|
+
|
|
310
|
+
@you.update(pwd: new_pwd)
|
|
311
|
+
end
|
|
312
|
+
else
|
|
313
|
+
# this particular block needs to be better
|
|
314
|
+
if args[1][0] == "/"
|
|
315
|
+
Aro::V.say("handling cd to root (/) arg...")
|
|
316
|
+
Aro::V.say(Aro::Dom::dom_root)
|
|
317
|
+
Aro::V.say(args[1][1..])
|
|
318
|
+
args[1] = args[1][1..]
|
|
319
|
+
new_pwd = File.join(Aro::Dom.dom_root, args[1])
|
|
320
|
+
if Dir.exist?(new_pwd)
|
|
321
|
+
@you.update(pwd: new_pwd)
|
|
322
|
+
end
|
|
323
|
+
elsif Dir.exist?(args[1]) && args[1] != Aro::Dom::DOT.to_s
|
|
324
|
+
new_pwd = File.join(@you.pwd, args[1])
|
|
325
|
+
Aro::V.say("new_pwd: #{new_pwd}")
|
|
326
|
+
@you.update(pwd: new_pwd)
|
|
327
|
+
else
|
|
328
|
+
Aos::S.say("that directory is invalid.")
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
end
|
|
197
332
|
end
|
|
198
333
|
end
|
|
199
334
|
end
|
data/sys/aos/db.rb
CHANGED
|
@@ -11,18 +11,25 @@
|
|
|
11
11
|
module Aos
|
|
12
12
|
class Db < Aro::Db
|
|
13
13
|
DATABASE_YML = :"database.yml"
|
|
14
|
-
SQL_FILE = :"
|
|
14
|
+
SQL_FILE = :"aos.sql"
|
|
15
15
|
SCHEMA_FILE = :"schema.rb"
|
|
16
16
|
MIGRATIONS_DIR = :"db/migrate"
|
|
17
17
|
|
|
18
18
|
def initialize
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Aos::Db.configure_logger
|
|
20
|
+
if Aro::Dom.in_arodom?
|
|
21
|
+
set_up_aos
|
|
22
|
+
else
|
|
21
23
|
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Dom.name))
|
|
22
|
-
return
|
|
23
24
|
end
|
|
25
|
+
end
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
def self.configure_logger
|
|
28
|
+
if CLI::Config.ivar(:LOG_AOS_DB).to_s == CLI::Config::BOOLS[:TRUE].to_s
|
|
29
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
|
30
|
+
else
|
|
31
|
+
ActiveRecord::Base.logger = nil
|
|
32
|
+
end
|
|
26
33
|
end
|
|
27
34
|
|
|
28
35
|
def self.base_aro_dir
|
|
@@ -42,8 +49,8 @@ module Aos
|
|
|
42
49
|
FileUtils.mkdir(Aos::Db.base_aro_dir)
|
|
43
50
|
end
|
|
44
51
|
|
|
45
|
-
Aro::D.say("creating database: #{db_config_filepath}")
|
|
46
52
|
unless File.exist?(db_config_filepath)
|
|
53
|
+
Aro::D.say("creating database: #{db_config_filepath}")
|
|
47
54
|
# create database config yaml file
|
|
48
55
|
c = {
|
|
49
56
|
adapter: :sqlite3.to_s,
|