aro 0.2.0 → 0.2.2

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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +3 -2
  4. data/README.md +1 -1
  5. data/aro.gemspec +1 -0
  6. data/bin/aos +2 -2
  7. data/bin/aro +4 -4
  8. data/checksums/aro-0.2.1.gem.sha512 +1 -0
  9. data/checksums/aro-0.2.2.gem.sha512 +1 -0
  10. data/listen.rb +1 -1
  11. data/locale/en.amg.yml +44 -0
  12. data/locale/en.aos.yml +13 -8
  13. data/locale/en.data.yml +30 -0
  14. data/locale/en.dom.yml +10 -8
  15. data/locale/en.usage.yml +22 -22
  16. data/locale/en.yml +16 -11
  17. data/sys/aos/amg.rb +184 -0
  18. data/sys/aos/aos.rb +203 -89
  19. data/sys/aos/data.rb +117 -0
  20. data/{db → sys/aos/db}/migrate/1765148774_create_yous.rb +1 -0
  21. data/sys/aos/db/migrate/1765762724_create_ilibs.rb +22 -0
  22. data/sys/aos/db/migrate/1765907766_create_ilogs.rb +18 -0
  23. data/sys/aos/db.rb +44 -25
  24. data/sys/aos/models/ilib.rb +46 -0
  25. data/sys/aos/models/ilog.rb +27 -0
  26. data/sys/aos/models/you.rb +50 -0
  27. data/sys/aos/vws/base.rb +120 -0
  28. data/sys/aos/{views → vws}/dom.rb +6 -10
  29. data/sys/aos/vws/games/abpps.rb +19 -0
  30. data/sys/aos/{views → vws}/games/game.rb +26 -25
  31. data/sys/aos/vws/games/hbpps.rb +19 -0
  32. data/sys/aos/vws/games/shpps.rb +19 -0
  33. data/sys/aos/vws/games/vipps.rb +19 -0
  34. data/sys/aos/{views → vws}/games.rb +3 -3
  35. data/sys/aos/vws/know/body.rb +19 -0
  36. data/sys/aos/vws/know/mind.rb +19 -0
  37. data/sys/aos/vws/know/spirit.rb +19 -0
  38. data/sys/aos/{views → vws}/know.rb +3 -3
  39. data/sys/aos/vws/root/amg.rb +21 -0
  40. data/sys/aos/vws/root/config.rb +21 -0
  41. data/sys/aos/vws/root/data.rb +21 -0
  42. data/sys/aos/{views/setup.rb → vws/root.rb} +4 -4
  43. data/sys/aos/vws/welcome/waite.rb +31 -0
  44. data/sys/aos/{views → vws}/welcome/winner.rb +3 -3
  45. data/sys/aos/vws/welcome.rb +30 -0
  46. data/{db/migrate/1763374647_create_decks.rb → sys/aro/db/migrate/1763374647_create_tecks.rb} +5 -5
  47. data/sys/aro/db/migrate/1763432541_create_tlogs.rb +20 -0
  48. data/sys/aro/db.rb +16 -15
  49. data/sys/aro/mancy.rb +4 -3
  50. data/sys/{models/deck.rb → aro/models/teck.rb} +56 -62
  51. data/sys/aro/models/tlog.rb +20 -0
  52. data/sys/aro/v.rb +1 -1
  53. data/sys/cli/constants.rb +1 -1
  54. data/sys/cli/dom.rb +1 -1
  55. data/sys/cli/{deck.rb → teck.rb} +20 -15
  56. data/sys/cli.rb +12 -12
  57. data/sys/dom/config.rb +718 -0
  58. data/sys/dom/d.rb +36 -18
  59. data/sys/dom/dom.rb +24 -14
  60. data/sys/reiquire.rb +8 -8
  61. data/sys/shr/ilib/crs/CMakeLists.txt +12 -0
  62. data/sys/shr/ilib/crs/compile.sh +5 -0
  63. data/sys/shr/ilib/crs/crs.c +24 -0
  64. data/sys/shr/ilib/crs/crs.o +0 -0
  65. data/sys/shr/ilib/crs/libcrs.so +0 -0
  66. data/sys/shr/prompt.rb +1 -5
  67. data/sys/shr/t.rb +14 -8
  68. data/sys/shr/version.rb +1 -1
  69. metadata +63 -26
  70. data/db/migrate/1763432541_create_logs.rb +0 -20
  71. data/locale/en.cngelog.yml +0 -5
  72. data/sys/aos/views/base.rb +0 -166
  73. data/sys/aos/views/games/abpps.rb +0 -21
  74. data/sys/aos/views/games/hbpps.rb +0 -21
  75. data/sys/aos/views/games/shpps.rb +0 -21
  76. data/sys/aos/views/games/vipps.rb +0 -21
  77. data/sys/aos/views/know/library.rb +0 -19
  78. data/sys/aos/views/know/temple.rb +0 -19
  79. data/sys/aos/views/setup/settings.rb +0 -37
  80. data/sys/aos/views/welcome/waite.rb +0 -19
  81. data/sys/aos/views/welcome.rb +0 -19
  82. data/sys/aos/you.rb +0 -19
  83. data/sys/cli/config.rb +0 -669
  84. data/sys/models/log.rb +0 -20
data/sys/aos/aos.rb CHANGED
@@ -29,14 +29,25 @@ module Aos
29
29
  class Os
30
30
  include Singleton
31
31
 
32
- attr_accessor :you, :running, :view, :db
32
+ attr_accessor :display_lines,
33
+ :running,
34
+ :view,
35
+ :you,
36
+ :you_flag
33
37
 
34
38
  A = :"@"
35
39
  STAR = :"*"
40
+ YOU = :you.to_s
41
+ YOU_FLAG = :"--you".to_s
36
42
  PS1 = :">[#{Aos::Os}]>: "
37
43
  DATE_FORMAT = "%A %d %b %Y %I:%M:%S %p"
38
44
 
39
45
  CMDS = {
46
+ AMG: {
47
+ key: :amg,
48
+ description: I18n.t("aos.commands.description.amg"),
49
+ usage: I18n.t("aos.commands.usage.amg"),
50
+ },
40
51
  CD: {
41
52
  key: :cd,
42
53
  description: I18n.t("aos.commands.description.cd"),
@@ -46,19 +57,22 @@ module Aos
46
57
  key: :config,
47
58
  description: I18n.t("aos.commands.description.config"),
48
59
  usage: I18n.t("aos.commands.usage.config"),
49
- cmds: {
50
- SET: {
51
- key: :set,
52
- description: I18n.t("aos.commands.description.config_set", prefix: CLI::Config::ARO_CONFIG_PREFIX),
53
- usage: I18n.t("aos.commands.usage.config_set"),
54
- }
55
- }
60
+ },
61
+ DATA: {
62
+ key: :data,
63
+ description: I18n.t("aos.commands.description.data"),
64
+ usage: I18n.t("aos.commands.usage.data"),
56
65
  },
57
66
  EXIT: {
58
67
  key: :exit,
59
68
  description: I18n.t("aos.commands.description.exit"),
60
69
  usage: I18n.t("aos.commands.usage.exit"),
61
70
  },
71
+ HELP: {
72
+ key: :help,
73
+ description: I18n.t("aos.commands.description.help"),
74
+ usage: I18n.t("aos.commands.usage.help"),
75
+ },
62
76
  LS: {
63
77
  key: :ls,
64
78
  description: I18n.t("aos.commands.description.ls"),
@@ -76,32 +90,93 @@ module Aos
76
90
  },
77
91
  }
78
92
 
79
- def initialize
80
- if Aro::Dom.in_arodom? && !Aro::Dom.is_initialized?
81
- Aro::Dom.new.generate
93
+ def self.osify(path, leading_slash = false)
94
+ return path unless Aro::Dom.in_arodom?
95
+ path_arr = path.split("/")
96
+ Aro::Dom::dom_root.split("/").each{|rdp| path_arr.delete(rdp)}
97
+ result = path_arr.join("/")
98
+ if leading_slash
99
+ result = "/" + result
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ def self.is_aos_command?(arg)
106
+ # determine if command is Aos::Os::CMDS
107
+ Aos::Os::CMDS.values.map{|v| v[:key]}.include?(arg.to_sym)
108
+ end
109
+
110
+ def self.you_flagd?
111
+ self.instance.you_flag
112
+ end
113
+
114
+ def self.sanitize_you(cmd)
115
+ if cmd.present? && cmd.include?(Aos::Os::YOU_FLAG)
116
+ cmd_split = cmd.split(" ")
117
+ i = cmd_split.index(Aos::Os::YOU_FLAG)
118
+ cmd_split.delete_at(i)
119
+ cmd_split.delete_at(i)
120
+ cmd = cmd_split.join(" ")
82
121
  end
83
- @db = Aos::Db.new
122
+
123
+ cmd
124
+ end
125
+
126
+ def initialize
127
+ self.you_flag = false
128
+ Aro::Config.instance.load
129
+ # if Aro::Dom.in_arodom? && !Aro::Dom.is_initialized?
130
+ # Aro::Dom.new.generate unless Aro::Mancy.in_aro?
131
+ # end
132
+ Aos::Db.load
133
+ load_ilibs
84
134
  load_you
85
135
  end
86
136
 
137
+ def load_ilibs
138
+ # todo: load from directory of ilibs.
139
+ # something like:
140
+ #
141
+ # Dir[lib_something_something].each do{|l| Aos::Ilib.install(l)}
142
+
143
+ # for now static
144
+ Aos::Amg.load(:crs)
145
+ end
146
+
87
147
  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)
148
+ return if @you.present?
149
+
150
+ if ARGV.include?(Aos::Os::YOU_FLAG)
151
+ self.you_flag = true
152
+ you_name = ARGV[ARGV.index(Aos::Os::YOU_FLAG) + Aro::Mancy::S]
153
+ @you = Aos::You.find_by(name: you_name)
154
+ if @you.nil?
155
+ @you = Aos::You.create(name: you_name)
156
+ end
157
+ else
158
+ # todo: make more secure
159
+ @you = Aos::You.find_by(access: :root)
160
+ end
161
+
162
+ self.display_lines = [Aos::Os.osify(@you.pwd, true)]
91
163
  end
92
164
 
93
165
  def load_view
94
166
  view_name = Aos::Os.osify(@you.pwd).split("/").last || :dom.to_s
95
167
  view_cls = nil
168
+
169
+ cls_name = (Aos::Vw.name + "::#{view_name.capitalize}")
170
+ Aro::D.say("attempting to load view class #{cls_name}")
96
171
  begin
97
- view_cls = (Aos::Vi.name + "::#{view_name.capitalize}").constantize
172
+ view_cls = cls_name.constantize
98
173
  rescue
99
- view_cls = Aos::Vi::Base
174
+ view_cls = Aos::Vw::Base
100
175
  end
101
176
 
102
177
  Dir.chdir(@you.pwd) do
103
178
  if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
104
- view_cls = Aos::Vi::Game
179
+ view_cls = Aos::Vw::Game
105
180
  end
106
181
  end
107
182
 
@@ -109,19 +184,6 @@ module Aos
109
184
  @view = view_cls
110
185
  end
111
186
 
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)
123
- end
124
-
125
187
  def render
126
188
  load_view
127
189
  return if @view.nil?
@@ -129,35 +191,54 @@ module Aos
129
191
  if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
130
192
  system(:aro.to_s)
131
193
  else
132
- @view.show(@you)
194
+ @view.show
133
195
  end
134
196
  end
135
197
  end
136
198
 
137
199
  def process_cmd(cmd)
138
200
  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)
201
+ configure_readline
202
+ send_to_system_call = main(cmd)
203
+ if Aro::Config.is_format_text?
204
+ # IO.console.goto(Aro::Mancy::O, Aro::Mancy::O)
142
205
  end
143
- if passthrough
144
- system(cmd)
145
- Aos::S.say("\n")
146
- else
206
+ nothing = nil
207
+ if send_to_system_call
208
+ nothing = system(cmd)
209
+ Aos::S.say(nothing) if nothing.nil?
210
+ end
211
+
212
+ if nothing.nil?
147
213
  render
148
214
  end
215
+
216
+ unless cmd.nil?
217
+ @you.generate_ilog(cmd)
218
+ end
149
219
  end
150
220
 
151
221
  CLI::EXIT_CODES[:SUCCESS]
152
222
  end
153
223
 
154
- def confgiure_readline
224
+ def configure_readline
155
225
  # configure Readline
156
- # Readline.completion_append_character = "/"
226
+ Readline.completion_append_character = "/"
157
227
  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)}/)
228
+ # Aro::V.say(str)
229
+ dir_matcher = @you.pwd + "/" + str + Aos::Os::STAR.to_s
230
+ dir_listing = Dir.glob(dir_matcher, File::FNM_DOTMATCH).map{|d| Aos::Os.osify(d)}
231
+ r_str = Regexp.escape(str)
232
+
233
+ # Aro::V.say(dir_listing.join(" ")) if dir_listing.any?
234
+ # checks pwd
235
+ matches = dir_listing.grep(/^#{r_str}/)
236
+ if matches.any?
237
+ matches
238
+ else
239
+ # checks reserved words
240
+ Aro::Dom::D.reserved_words.grep(/^#{r_str}/)
241
+ end
161
242
  }
162
243
  end
163
244
 
@@ -170,10 +251,10 @@ module Aos
170
251
  cmd = nil
171
252
  loop do
172
253
  # erase before cursor
173
- IO.console.erase_screen(Aro::Mancy::S)
174
254
  process_cmd(cmd)
175
- IO.console.goto(CLI::Config.display_config[:HEIGHT], Aro::Mancy::O)
255
+ IO.console.goto(Aro::Config.display_configuration[:HEIGHT], Aro::Mancy::O)
176
256
  break unless @running && cmd = Readline.readline(calc_ps1, true)
257
+ IO.console.erase_screen(Aro::Mancy::S)
177
258
  end
178
259
 
179
260
  out
@@ -189,58 +270,93 @@ module Aos
189
270
  return false if cmd.nil?
190
271
 
191
272
  # get args
192
- args = cmd.split(" ")
273
+ args = Aos::Os.sanitize_you(cmd).split(" ")
193
274
  return false if args[0].nil?
194
275
  return false if args[0] == :aos.to_s
195
276
 
196
- # reconfigure for updates to pwd
197
- # todo: not working for tab completion
198
- confgiure_readline
199
-
200
277
  args = handle_aro_override(args)
201
278
 
202
- passthrough = !Aos::Os.is_aos_command?(args[Aro::Mancy::O]) ||
279
+ # send to "system" call in process_cmd method
280
+ # if args[Aro::Mancy::O] is not in Aos::Os::CMDS
281
+ send_to_system_call = !Aos::Os.is_aos_command?(args[Aro::Mancy::O]) ||
203
282
  args.include?(:aos.to_s)
204
283
 
205
- return false if handle_room_path(args[Aro::Mancy::O])
206
-
207
284
  # set aos pwd
208
- unless passthrough
285
+ unless send_to_system_call
209
286
  Dir.chdir(@you.pwd) do
210
287
  # process commands
211
288
  case args[Aro::Mancy::O].to_sym
289
+ when Aos::Os::CMDS[:AMG][:key]
290
+ # amg
291
+ send_to_system_call = handle_amg(args)
292
+ when Aos::Os::CMDS[:CD][:key]
293
+ # cd
294
+ handle_cd(args)
212
295
  when Aos::Os::CMDS[:CONFIG][:key]
213
296
  # config
214
- passthrough = handle_config(args)
215
- when Aos::Os::CMDS[:LS][:key]
216
- # ls
217
- handle_ls(args)
297
+ send_to_system_call = handle_config(args)
298
+ when Aos::Os::CMDS[:DATA][:key]
299
+ # data
300
+ send_to_system_call = handle_data(args)
301
+ when Aos::Os::CMDS[:EXIT][:key]
302
+ # exit
303
+ send_to_system_call = true
304
+ handle_exit(args)
305
+ when Aos::Os::CMDS[:HELP][:key]
306
+ # help
307
+ send_to_system_call = handle_help(args)
218
308
  when Aos::Os::CMDS[:LL][:key]
219
309
  # ll
220
310
  handle_ll(args)
311
+ when Aos::Os::CMDS[:LS][:key]
312
+ # ls
313
+ handle_ls(args)
221
314
  when Aos::Os::CMDS[:PWD][:key]
222
315
  # pwd
223
316
  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
317
  end
232
318
  end
233
319
  end
234
320
 
235
- return passthrough
321
+ if send_to_system_call
322
+ # process ilib commands
323
+ ilib = Aos::Ilib.find_by(
324
+ name: args[Aro::Mancy::O],
325
+ status: :installed
326
+ )
327
+ unless ilib.nil?
328
+ self.display_lines = [ilib.usage]
329
+ send_to_system_call = false
330
+ end
331
+
332
+ # if system is going to run, but redirect happens,
333
+ # cancel system run.
334
+ if redirect_to_room(args[Aro::Mancy::O])
335
+ send_to_system_call = false
336
+ end
337
+ end
338
+
339
+ return send_to_system_call
236
340
  end
237
341
 
238
342
  def calc_ps1
239
343
  you_pwd = Aos::Os::osify(@you.pwd)
240
- "#{Aos::Os::PS1}" # #{you_pwd.empty? ? "" : "#{you_pwd}:"}$ "
344
+ "#{Aos::Os::PS1}"
345
+ end
346
+
347
+ def handle_aro_override(args)
348
+ if args[0].include?(:aro.to_s)
349
+ args = "#{args.join(" ")} #{:aos.to_s}".split(" ")
350
+ end
351
+ args
241
352
  end
242
353
 
243
- def handle_room_path(arg)
354
+ def handle_config(args)
355
+ Aro::Config.process_config_command(args)
356
+ return true
357
+ end
358
+
359
+ def redirect_to_room(arg)
244
360
  # search for reserved room path
245
361
  handled = false
246
362
  room_path = Aro::Dom.room_path(arg)
@@ -254,36 +370,34 @@ module Aos
254
370
  handled
255
371
  end
256
372
 
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
373
+ def handle_amg(args)
374
+ Aos::Amg.process_cmd(args)
262
375
  end
263
376
 
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
377
+ def handle_data(args)
378
+ Aos::Data.process_cmd(args)
379
+ end
380
+
381
+ def handle_help(args)
382
+ redirect_to_room(Aro::Dom::WAITE)
383
+ return false
274
384
  end
275
385
 
276
386
  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"))
387
+ self.display_lines = [
388
+ Dir.glob(File.join(@you.pwd, (args[1] || "") + Aos::Os::STAR.to_s), File::FNM_EXTGLOB).map{|p| "/" + Aos::Os::osify(p)}.join("\n")
389
+ ]
278
390
  end
279
391
 
280
392
  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"))
393
+ self.display_lines = [
394
+ Dir.glob(File.join(@you.pwd, (args[1] || "") + Aos::Os::STAR.to_s), File::FNM_DOTMATCH).map{|p| Aos::Os::osify(p.strip, true)}.join("\n")
395
+ ]
282
396
  end
283
397
 
284
398
  def handle_pwd(args)
285
399
  osified = "/" + Aos::Os::osify(@you.pwd)
286
- Aos::S.say(osified)
400
+ self.display_lines = [osified]
287
401
  end
288
402
 
289
403
  def handle_exit(args)
@@ -299,7 +413,7 @@ module Aos
299
413
  if args[1].include?(Aro::Dom::DOTT.to_s)
300
414
  # going up
301
415
  if File.dirname(Aro::Dom.ethergeist_path) == @you.pwd
302
- Aos::S.say("within #{Aos::Os}, one cannot leave the #{Aro::Dom}.")
416
+ self.display_lines = ["within #{Aos::Os}, one cannot leave the #{Aro::Dom}."]
303
417
  else
304
418
  # todo: support dots in paths
305
419
  # this only supports moving one level up
@@ -325,7 +439,7 @@ module Aos
325
439
  Aro::V.say("new_pwd: #{new_pwd}")
326
440
  @you.update(pwd: new_pwd)
327
441
  else
328
- Aos::S.say("that directory is invalid.")
442
+ self.display_lines = ["that directory is invalid."]
329
443
  end
330
444
  end
331
445
  end
data/sys/aos/data.rb ADDED
@@ -0,0 +1,117 @@
1
+ =begin
2
+
3
+ data.rb
4
+
5
+ aos data management.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ module Aos
12
+ class Data
13
+ include Singleton
14
+
15
+ attr_accessor :display_lines
16
+
17
+ CMDS = {
18
+ ILOGS: {
19
+ key: :ilogs,
20
+ description: I18n.t("data.commands.description.ilogs"),
21
+ usage: I18n.t("data.commands.usage.ilogs"),
22
+ },
23
+ YOUS: {
24
+ key: :yous,
25
+ description: I18n.t("data.commands.description.yous"),
26
+ usage: I18n.t("data.commands.usage.yous"),
27
+ },
28
+ }
29
+
30
+ def initialize
31
+ self.display_lines = Aos::Data.base_lines
32
+ end
33
+
34
+ def self.process_cmd(args)
35
+ self.instance.display_lines = []
36
+ if args[Aro::Mancy::S].nil? ||
37
+ CLI::FLAGS[:HELP].include?(args[Aro::Mancy::S].to_sym)
38
+ Aos::Data.data
39
+ return true
40
+ end
41
+
42
+ case args[Aro::Mancy::S].to_sym
43
+ when Aos::Data::CMDS[:ILOGS][:key]
44
+ Aos::Data.ilogs
45
+ return true
46
+ when Aos::Data::CMDS[:YOUS][:key]
47
+ Aos::Data.yous
48
+ return true
49
+ end
50
+
51
+ return false
52
+ end
53
+
54
+ def self.ilogs
55
+ self.instance.display_lines = Aos::Data.ilog_lines
56
+ end
57
+
58
+ def self.yous
59
+ self.instance.display_lines = Aos::Data.you_lines
60
+ end
61
+
62
+ def self.data
63
+ self.instance.display_lines = Aos::Data.base_lines
64
+ end
65
+
66
+ def self.base_lines
67
+ # print data commands
68
+ lines = []
69
+ lines << ""
70
+ lines << I18n.t("aos.constants.commands")
71
+ lines += Aos::Vw::Base.lines_for_cmd(Aos::Os::CMDS[:DATA])
72
+ lines << I18n.t("aos.constants.subcommands")
73
+ Aos::Data::CMDS.keys.each{|k|
74
+ lines += Aos::Vw::Base.lines_for_cmd(Aos::Data::CMDS[k])
75
+ }
76
+ lines << ""
77
+
78
+ lines
79
+ end
80
+
81
+ def self.ilog_lines
82
+ # list input ilogs
83
+ lines = []
84
+ lines << ""
85
+ iilogs = Aos::Ilog.all
86
+ unless iilogs.any?
87
+ lines << I18n.t("data.messages.no_ilogs")
88
+ else
89
+ lines << I18n.t("data.messages.listing_ilogs")
90
+ iilogs.each{|il|
91
+ lines += il.get_lines
92
+ }
93
+ end
94
+ lines << ""
95
+
96
+ lines
97
+ end
98
+
99
+ def self.you_lines
100
+ # list yous
101
+ lines = []
102
+ lines << ""
103
+ yous = Aos::You.all
104
+ unless yous.any?
105
+ lines << I18n.t("data.messages.no_yous")
106
+ else
107
+ lines << I18n.t("data.messages.listing_yous")
108
+ yous.each{|y|
109
+ lines += y.get_lines
110
+ }
111
+ end
112
+ lines << ""
113
+
114
+ lines
115
+ end
116
+ end
117
+ end
@@ -4,6 +4,7 @@ class CreateYous < ActiveRecord::Migration[8.1]
4
4
  create_table :yous do |t|
5
5
  t.string :name, null: false
6
6
  t.string :pwd
7
+ t.integer :access, default: Aro::Mancy::O
7
8
 
8
9
  t.timestamps
9
10
 
@@ -0,0 +1,22 @@
1
+ class CreateIlibs < ActiveRecord::Migration[8.1]
2
+
3
+ def self.up
4
+ create_table :ilibs do |t|
5
+ t.string :name, null: false
6
+ t.string :so_path, null: false
7
+ t.integer :status, default: Aro::Mancy::O
8
+
9
+ t.timestamps
10
+
11
+ t.index :name, unique: true
12
+ t.index :so_path, unique: true
13
+ end
14
+ end
15
+
16
+ def self.down
17
+ remove_index :ilibs, :name
18
+ remove_index :ilibs, :so_path
19
+ drop_table :ilibs
20
+ end
21
+
22
+ end
@@ -0,0 +1,18 @@
1
+ class CreateIlogs < ActiveRecord::Migration[8.1]
2
+
3
+ def self.up
4
+ create_table :ilogs do |t|
5
+ t.belongs_to :you, null: false, foreign_key: true
6
+ t.string :cmd, null: false
7
+ t.string :pwd, null: false
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ remove_index :ilogs, :pwd
15
+ drop_table :ilogs
16
+ end
17
+
18
+ end