aro 0.1.9 → 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.
data/locale/en.usage.yml CHANGED
@@ -32,7 +32,7 @@ en:
32
32
  set
33
33
  sets an ivar to a specified value. the aro var prefix can be omitted.
34
34
 
35
- $ config set <var_name> <var_value>
35
+ $ aro config set <var_name> <var_value>
36
36
 
37
37
  deck
38
38
  manage decks in the current room.
@@ -101,16 +101,10 @@ en:
101
101
  shuffles the current deck and generates a log record.
102
102
 
103
103
  dom
104
- create or manage an arodome (ex: list game rooms)
104
+ arodom management.
105
105
 
106
106
  $ aro dom <commands>
107
107
 
108
- note: passing no arguments displays the main dom.
109
-
110
- example
111
-
112
- $ aro dom
113
-
114
108
  SUBCOMMANDS
115
109
  init
116
110
  generate the arodome
data/locale/en.yml CHANGED
@@ -32,6 +32,8 @@ en:
32
32
  production_description: "game logging only."
33
33
  test_description: "logging and features tailored for tests."
34
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"
35
37
  generate: "generating default config file at %{name}."
36
38
  source: "installing ivars from %{name}..."
37
39
  maximum: "max"
@@ -56,6 +58,7 @@ en:
56
58
  invalid_order: "the order specified for displaying logs in invalid. using default (desc)."
57
59
  messages:
58
60
  choose_card: "choose a card."
61
+ choose_deck: "choose a deck."
59
62
  confirmation_prompt: "input 'aroyes' to reset %{name}, or enter to cancel (cancel): "
60
63
  creating: "creating %{name}..."
61
64
  creation_attempt: "attempting to create aro table named %{name}..."
data/sys/aos/aos.rb CHANGED
@@ -13,31 +13,23 @@ require :aro.to_s
13
13
  module Aos
14
14
 
15
15
  def self.run
16
- Aos::Db.new
17
- Aos::Os::boot(Aos::you)
18
16
  begin
19
17
  Aos::Os.instance.run
20
18
  rescue Interrupt => e
21
- Aos::run
19
+ Aos.run
22
20
  end
23
21
  end
24
22
 
25
- def self.watch
26
- Aos::Db.new
27
- Aos::Os::boot(Aos::you)
28
- Aos::Os::instance.render
29
- end
30
-
31
- def self.you
32
- you = Aos::You.where(name: :you).first
33
- you = Aos::You.create(name: :you, pwd: Dir.pwd) if you.nil?
34
- you
23
+ def self.process
24
+ cmd = ARGV.join(" ")
25
+ Aro::D.say("processing cmd #{cmd}...")
26
+ Aos::Os::instance.process_cmd(cmd)
35
27
  end
36
28
 
37
29
  class Os
38
30
  include Singleton
39
31
 
40
- attr_accessor :you, :running, :view
32
+ attr_accessor :you, :running, :view, :db
41
33
 
42
34
  A = :"@"
43
35
  STAR = :"*"
@@ -84,101 +76,168 @@ module Aos
84
76
  },
85
77
  }
86
78
 
87
- def self.boot(you)
88
- self.instance.you = you
89
- self.instance.load_view
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)
91
+ end
92
+
93
+ def load_view
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
+
108
+ Aro::D.say("loading view #{view_cls}")
109
+ @view = view_cls
110
+ end
111
+
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
118
+
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)
90
123
  end
91
124
 
92
125
  def render
93
- return if view.nil?
94
- Dir.chdir(you.pwd) do
95
- view.show(you)
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
96
134
  end
97
135
  end
98
136
 
99
- def run
100
- # run loop exit condition
101
- self.running = true
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
102
150
 
103
- # set aos pwd
104
- Dir.chdir(you.pwd)
151
+ CLI::EXIT_CODES[:SUCCESS]
152
+ end
105
153
 
154
+ def confgiure_readline
106
155
  # configure Readline
107
156
  # Readline.completion_append_character = "/"
108
157
  Readline.completion_proc = Proc.new{|str|
109
158
  # todo: the reserved_words search is working but the || case is not
110
159
  Aro::Dom::D.reserved_words.grep(/^#{Regexp.escape(str)}/) ||
111
- Dir[Dir.pwd + str + Aos::Os::STAR.to_s].grep(/^#{Regexp.escape(str)}/)
160
+ Dir[@you.pwd + str + Aos::Os::STAR.to_s].grep(/^#{Regexp.escape(str)}/)
112
161
  }
162
+ end
113
163
 
114
- # begin game loop
115
- while running && cmd = Readline.readline(calc_ps1, true)
116
- next if cmd.nil?
117
-
118
- # get args
119
- args = cmd.split(" ")
120
-
121
- next if handle_room_path(args[Aro::Mancy::O]) || handle_aro_override(args)
122
-
123
- passthrough = !is_aos_command?(args[Aro::Mancy::O])
124
-
125
- # process commands
126
- case args[Aro::Mancy::O].to_sym
127
- when Aos::Os::CMDS[:CONFIG][:key]
128
- # config
129
- handle_config(args)
130
- when Aos::Os::CMDS[:LS][:key]
131
- # ls
132
- handle_ls(args)
133
- when Aos::Os::CMDS[:LL][:key]
134
- # ll
135
- handle_ll(args)
136
- when Aos::Os::CMDS[:PWD][:key]
137
- # pwd
138
- handle_pwd(args)
139
- when Aos::Os::CMDS[:EXIT][:key]
140
- # exit
141
- handle_exit(args)
142
- when Aos::Os::CMDS[:CD][:key]
143
- # cd
144
- handle_cd(args)
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)
145
177
  end
146
178
 
147
- Aos::S.say(system(cmd)) if passthrough
179
+ out
148
180
  end
149
181
 
150
182
  CLI::EXIT_CODES[:SUCCESS]
183
+ ensure
184
+ $stdout = original_stdout
151
185
  end
152
186
 
153
- def load_view
154
- view_name = Aos::Os.osify(you.pwd).split("/").last || :dom.to_s
155
- view_cls = nil
156
- begin
157
- view_cls = (Aos::Vi.name + "::#{view_name.capitalize}").constantize
158
- rescue
159
- view_cls = Aos::Vi::Base
160
- end
187
+ def main(cmd)
188
+ # begin game loop
189
+ return false if cmd.nil?
161
190
 
162
- Aro::D.say("loading view #{view_cls}")
163
- self.view = view_cls
164
- end
191
+ # get args
192
+ args = cmd.split(" ")
193
+ return false if args[0].nil?
194
+ return false if args[0] == :aos.to_s
165
195
 
166
- def calc_ps1
167
- you_pwd = Aos::Os::osify(you.pwd)
168
- "#{Aos::Os::PS1}#{you_pwd.empty? ? "" : "#{you_pwd}:"}$ "
169
- end
196
+ # reconfigure for updates to pwd
197
+ # todo: not working for tab completion
198
+ confgiure_readline
170
199
 
171
- def self.osify(path)
172
- return path unless Aro::Dom.in_arodom?
173
- path_arr = path.split("/")
174
- Aro::Dom::dom_root.split("/").each{|rdp| path_arr.delete(rdp)}
175
- path_arr.join("/")
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)
231
+ end
232
+ end
233
+ end
234
+
235
+ return passthrough
176
236
  end
177
237
 
178
- def is_aos_command?(arg)
179
- # determine if command is Aos::Os::CMDS
180
- # passthrough to system if command is not in Aos::Os::CMDS
181
- Aos::Os::CMDS.values.map{|v| v[:key]}.include?(arg.to_sym)
238
+ def calc_ps1
239
+ you_pwd = Aos::Os::osify(@you.pwd)
240
+ "#{Aos::Os::PS1}" # #{you_pwd.empty? ? "" : "#{you_pwd}:"}$ "
182
241
  end
183
242
 
184
243
  def handle_room_path(arg)
@@ -187,7 +246,7 @@ module Aos
187
246
  room_path = Aro::Dom.room_path(arg)
188
247
  if !room_path.empty?
189
248
  handled = true
190
- you.update(pwd: File.join(
249
+ @you.update(pwd: File.join(
191
250
  File.dirname(Aro::Dom.ethergeist_path),
192
251
  room_path
193
252
  ))
@@ -196,66 +255,59 @@ module Aos
196
255
  end
197
256
 
198
257
  def handle_aro_override(args)
199
- # run all aro commands in aos context
200
- handled = false
201
258
  if args[0].include?(:aro.to_s)
202
- # passthrough aro cmd with aos appended
203
- handled = true
204
- system("#{args.join(" ")} #{:aos.to_s}")
259
+ args = "#{args.join(" ")} #{:aos.to_s}".split(" ")
205
260
  end
206
- handled
261
+ args
207
262
  end
208
263
 
209
264
  def handle_config(args)
265
+ passthrough = false
210
266
  if args[1].nil?
211
267
  # show settings
212
- you.update(pwd:
213
- File.join(
214
- File.dirname(Aro::Dom.ethergeist_path),
215
- Aro::Dom::SETUP.to_s,
216
- Aro::Dom::SETTINGS.to_s
217
- )
218
- )
268
+ passthrough = true
269
+ CLI::Config.dump_config.each{|l| Aos::S.say(l)}
219
270
  else
220
271
  CLI::Config.process_config_command(args)
221
272
  end
273
+ passthrough
222
274
  end
223
275
 
224
276
  def handle_ls(args)
225
- Aos::S.say(Dir[File.join(Dir.pwd, (args[1] || "") + Aos::Os::STAR.to_s)].map{|p| "/" + Aos::Os::osify(p)}.join("\n"))
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"))
226
278
  end
227
279
 
228
280
  def handle_ll(args)
229
- Aos::S.say(Dir.glob(File.join(Dir.pwd, (args[1] || "") + Aos::Os::STAR.to_s), File::FNM_DOTMATCH).map{|p| "/" + Aos::Os::osify(p)}.join("\n"))
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"))
230
282
  end
231
283
 
232
284
  def handle_pwd(args)
233
- osified = "/" + Aos::Os::osify(you.pwd)
285
+ osified = "/" + Aos::Os::osify(@you.pwd)
234
286
  Aos::S.say(osified)
235
287
  end
236
288
 
237
289
  def handle_exit(args)
238
290
  Aos::S.say("#{Aos::Os} is exiting...")
239
- self.running = false
291
+ @running = false
240
292
  end
241
293
 
242
294
  def handle_cd(args)
243
295
  if args[1].nil? || args[1] == "~/"
244
296
  # no arg takes you to arodom root
245
- you.update(pwd: File.dirname(Aro::Dom.ethergeist_path))
297
+ @you.update(pwd: File.dirname(Aro::Dom.ethergeist_path))
246
298
  else
247
299
  if args[1].include?(Aro::Dom::DOTT.to_s)
248
300
  # going up
249
- if File.dirname(Aro::Dom.ethergeist_path) == you.pwd
301
+ if File.dirname(Aro::Dom.ethergeist_path) == @you.pwd
250
302
  Aos::S.say("within #{Aos::Os}, one cannot leave the #{Aro::Dom}.")
251
303
  else
252
304
  # todo: support dots in paths
253
305
  # this only supports moving one level up
254
306
 
255
- pwd_arr = you.pwd.split("/")
307
+ pwd_arr = @you.pwd.split("/")
256
308
  new_pwd = (pwd_arr.first(pwd_arr.length - 1)).join("/")
257
309
 
258
- you.update(pwd: new_pwd)
310
+ @you.update(pwd: new_pwd)
259
311
  end
260
312
  else
261
313
  # this particular block needs to be better
@@ -266,12 +318,12 @@ module Aos
266
318
  args[1] = args[1][1..]
267
319
  new_pwd = File.join(Aro::Dom.dom_root, args[1])
268
320
  if Dir.exist?(new_pwd)
269
- you.update(pwd: new_pwd)
321
+ @you.update(pwd: new_pwd)
270
322
  end
271
323
  elsif Dir.exist?(args[1]) && args[1] != Aro::Dom::DOT.to_s
272
- new_pwd = File.join(you.pwd, args[1])
324
+ new_pwd = File.join(@you.pwd, args[1])
273
325
  Aro::V.say("new_pwd: #{new_pwd}")
274
- you.update(pwd: new_pwd)
326
+ @you.update(pwd: new_pwd)
275
327
  else
276
328
  Aos::S.say("that directory is invalid.")
277
329
  end
data/sys/aos/db.rb CHANGED
@@ -11,12 +11,12 @@
11
11
  module Aos
12
12
  class Db < Aro::Db
13
13
  DATABASE_YML = :"database.yml"
14
- SQL_FILE = :"database.sql"
14
+ SQL_FILE = :"aos.sql"
15
15
  SCHEMA_FILE = :"schema.rb"
16
16
  MIGRATIONS_DIR = :"db/migrate"
17
17
 
18
18
  def initialize
19
- # ActiveRecord::Base.logger = Logger.new(STDOUT)
19
+ Aos::Db.configure_logger
20
20
  if Aro::Dom.in_arodom?
21
21
  set_up_aos
22
22
  else
@@ -24,6 +24,14 @@ module Aos
24
24
  end
25
25
  end
26
26
 
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
33
+ end
34
+
27
35
  def self.base_aro_dir
28
36
  Aro::Dom.ethergeist_path
29
37
  end
@@ -13,49 +13,50 @@ require :aro.to_s
13
13
  module Aos
14
14
  module Vi
15
15
  class Base
16
- BAR = :"|".to_s
16
+ BAR = :"".to_s
17
+ COL_POW = Proc.new{|n| n.pow(Aro::Mancy::S.to_f / Aro::Mancy::OS.to_f).to_i}
17
18
  MARGIN_V = Aro::Mancy::S
18
19
  MARGIN_H = Aro::Mancy::S
19
20
 
20
21
  def self.show(model)
21
- unless Aro::Mancy.game.nil?
22
- Aro::Mancy.game.show
23
- return
24
- end
25
-
26
- # default view
27
22
  draw([self.name], model)
28
23
  end
29
24
 
25
+ def self.get_json(lines, you = nil)
26
+ {
27
+ body: lines,
28
+ you: you&.to_json,
29
+ domain: self.get_domain,
30
+ clock: self.get_clock,
31
+ dimension: self.get_dimension,
32
+ dev_tarot: self.get_dt,
33
+ }
34
+ end
35
+
30
36
  def self.draw(lines, you = nil)
37
+ unless CLI::Config.is_format_text?
38
+ Aos::S.say(self.get_json(lines, you))
39
+ return true
40
+ end
41
+
31
42
  return false unless lines.kind_of?(Array)
32
43
 
33
44
  dc = CLI::Config.display_config
34
45
  height = dc[:HEIGHT]
35
46
  width = dc[:WIDTH]
36
47
 
37
- # lines printed
38
- printed = Aro::Mancy::O
39
-
40
- # max printable lines
41
- # vertical margins
42
- max_lines = height - Aos::Vi::Base::MARGIN_V * Aro::Mancy::OS
43
- # footer
44
- max_lines = max_lines + Aro::Mancy::S
48
+ print_aos_div
45
49
 
46
50
  # header
47
51
  Aro::Mancy::S.times do |i|
48
- printed += Aro::Mancy::OS
49
52
  Aos::S.say("".center(width, dc[:DIVIDER]))
50
- printed += Aro::Mancy::OS
51
53
  Aos::S.say("".center(width))
52
54
  Aos::S.say("\n")
53
55
  end
54
56
 
55
57
  half = ((width - self.name.length) / Aro::Mancy::OS.to_f).ceil
56
- domain = Aro::Dom.in_arodom? ? Aro::Dom::domain : Aro::Mancy.domain
57
- clock = Time.now.strftime(Aos::Os::DATE_FORMAT)
58
- printed += Aro::Mancy::S
58
+ domain = self.get_domain
59
+ clock = self.get_clock
59
60
  Aos::S.say(
60
61
  (
61
62
  domain.ljust(half) + self.name.to_s.upcase
@@ -63,54 +64,64 @@ module Aos
63
64
  )
64
65
 
65
66
  Aro::Mancy::S.times do
66
- printed += Aro::Mancy::S
67
67
  Aos::S.say("".center(width, dc[:DIVIDER]))
68
68
  end
69
69
 
70
70
  # top vertical margin
71
71
  Aos::Vi::Base::MARGIN_V.times do
72
- printed += Aro::Mancy::S
73
- print_regular_line("")
72
+ Aos::S.say(get_body_line(""))
74
73
  end
75
74
 
76
75
  # yield => print lines
77
76
  lines.each{|line|
78
- next if printed == max_lines
79
-
80
- printed += Aro::Mancy::S
81
- print_regular_line(line)
77
+ Aos::S.say(get_body_line(line))
82
78
  }
83
79
 
84
- # fill empty space
85
- while printed < max_lines
86
- printed += Aro::Mancy::S
87
- print_regular_line("")
88
- end
89
-
90
80
  # bottom vertical margin
91
81
  Aos::Vi::Base::MARGIN_V.times do
92
- printed += Aro::Mancy::S
93
- Aos::S.say("[#{Aos::Os} v#{Aro::VERSION.to_s}]".center(width, :"-".to_s))
82
+ Aos::S.say("[#{Aos::Os} v#{Aro::VERSION.to_s}]".center(width))
94
83
  end
95
84
 
96
85
  # footer
97
- dimension = (Aro::T.is_dev_tarot? ? Aro::T::DEV_TAROT : Aro::T::RUBY_FACOT)
98
- dt = Aro::T.read_dev_tarot.strip[Aro::Mancy::S..]
99
- display_dim = "#{dt.rjust(Aro::Mancy::V)} :<[#{dimension}]<"
86
+ display_dim = self.get_display_dimension
100
87
  Aos::S.say(
101
88
  (
102
- ">#{domain}>#{Aos::Os::osify(you&.pwd || Dir.pwd)}"
89
+ ">[#{domain}]>#{Aos::Os::osify(you&.pwd || Dir.pwd)}"
103
90
  ).ljust(width - display_dim.length) + display_dim
104
91
  )
105
- Aos::S.say("".center(width, dc[:DIVIDER]))
106
-
107
- # debug logging
108
- Aro::D.say("invalid printed height: #{height}, printed: #{printed}") if printed != height
109
92
 
93
+ print_aos_div
110
94
  # explicitly return true
111
95
  true
112
96
  end
113
97
 
98
+ def self.get_display_dimension
99
+ "#{self.get_dt.rjust(Aro::Mancy::V)} :<[#{self.get_dimension}]<"
100
+ end
101
+
102
+ def self.get_dt
103
+ Aro::T.read_dev_tarot.strip[Aro::Mancy::S..]
104
+ end
105
+
106
+ def self.get_dimension
107
+ (Aro::T.is_dev_tarot? ? Aro::T::DEV_TAROT : Aro::T::RUBY_FACOT)
108
+ end
109
+
110
+ def self.get_domain
111
+ Aro::Dom.in_arodom? ? Aro::Dom::domain : Aro::Mancy.domain
112
+ end
113
+
114
+ def self.get_clock
115
+ Time.now.strftime(Aos::Os::DATE_FORMAT)
116
+ end
117
+
118
+ def self.print_aos_div
119
+ Aro::Mancy::S.times do
120
+ Aos::S.say("\n")
121
+ Aos::S.say("".center(CLI::Config.display_config[:WIDTH], "="))
122
+ end
123
+ end
124
+
114
125
  def self.viewport_width
115
126
  dc = CLI::Config.display_config
116
127
  width = dc[:WIDTH]
@@ -120,12 +131,12 @@ module Aos
120
131
  (width - (bar_width + h_margin_width))
121
132
  end
122
133
 
123
- def self.print_regular_line(line)
134
+ def self.get_body_line(line)
124
135
  hm = Aos::Vi::Base::MARGIN_H
125
136
  bar = Aos::Vi::Base::BAR
126
137
  hm_space = " " * Aos::Vi::Base::MARGIN_H
127
138
  just = CLI::Config.display_config[:WIDTH] - (hm_space.length + bar.length)
128
- Aos::S.say((bar + hm_space + (line || "")).ljust(just) + hm_space + bar)
139
+ (bar + hm_space + (line || "")).ljust(just) + hm_space + bar
129
140
  end
130
141
 
131
142
  def self.lines_for_cmd(cmd)
@@ -55,8 +55,8 @@ module Aos
55
55
  order_o = model[:order_o]
56
56
 
57
57
  dc = CLI::Config.display_config
58
- width = dc[:WIDTH] = viewport_width
59
- divider = dc[:DIVIDER] * viewport_width
58
+ width = count_n == Aro::Mancy::S ? viewport_width : dc[:WIDTH]
59
+ divider = dc[:DIVIDER] * width
60
60
  lines = []
61
61
  lines << "#{deck.name.upcase.center(width)}"
62
62
  h_logs.each_with_index{|l, i|
@@ -94,7 +94,9 @@ module Aos
94
94
  end
95
95
 
96
96
  def self.get_display_for_cards(input = [])
97
- columns = CLI::Config.display_config[:COLUMNS].to_i
97
+ columns = Aos::Vi::Base::COL_POW.call(
98
+ CLI::Config.display_config[:WIDTH].to_i
99
+ )
98
100
  lines = []
99
101
  return lines unless input.any?
100
102
  card_line = ""
data/sys/aos/you.rb CHANGED
@@ -10,10 +10,10 @@
10
10
 
11
11
  module Aos
12
12
  class You < ActiveRecord::Base
13
- after_commit :update_aos_pwd
13
+ # after_commit :update_aos_pwd
14
14
 
15
- def update_aos_pwd
16
- Dir.chdir(pwd)
17
- end
15
+ # def update_aos_pwd
16
+ # Dir.chdir(pwd)
17
+ # end
18
18
  end
19
19
  end
data/sys/aro/db.rb CHANGED
@@ -16,11 +16,17 @@ module Aro
16
16
  MIGRATIONS_DIR = :"db/migrate"
17
17
 
18
18
  def initialize
19
- # ActiveRecord::Base.logger = Logger.new(STDOUT)
19
+ Aro::Db.configure_logger
20
20
  if Aro::Mancy.in_aro?
21
21
  setup_local_aro
22
+ end
23
+ end
24
+
25
+ def self.configure_logger
26
+ if CLI::Config.ivar(:LOG_ARO_DB).to_s == CLI::Config::BOOLS[:TRUE].to_s
27
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
22
28
  else
23
- Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Mancy::I2097I))
29
+ ActiveRecord::Base.logger = nil
24
30
  end
25
31
  end
26
32