aro 0.1.7 → 0.1.8

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/aro.gemspec +3 -3
  3. data/bin/aos +19 -0
  4. data/checksums/aro-0.1.7.gem.sha512 +1 -0
  5. data/checksums/aro-0.1.8.gem.sha512 +1 -0
  6. data/db/migrate/1763374647_create_decks.rb +3 -0
  7. data/db/migrate/1763432541_create_logs.rb +1 -0
  8. data/db/migrate/1765148774_create_yous.rb +19 -0
  9. data/locale/en.aos.yml +27 -0
  10. data/locale/en.cngelog.yml +5 -0
  11. data/locale/en.usage.yml +9 -10
  12. data/locale/en.yml +46 -31
  13. data/sys/aos/aos.rb +199 -0
  14. data/sys/aos/db.rb +81 -0
  15. data/sys/aos/s.rb +25 -0
  16. data/sys/aos/views/base.rb +139 -0
  17. data/sys/aos/views/dom.rb +45 -0
  18. data/sys/aos/views/games/abpps.rb +21 -0
  19. data/sys/aos/views/games/deck.rb +95 -0
  20. data/sys/aos/views/games/game.rb +24 -0
  21. data/sys/aos/views/games/hbpps.rb +21 -0
  22. data/sys/aos/views/games/shpps.rb +21 -0
  23. data/sys/aos/views/games/vipps.rb +21 -0
  24. data/sys/aos/views/games.rb +19 -0
  25. data/sys/aos/views/know/library.rb +19 -0
  26. data/sys/aos/views/know/temple.rb +19 -0
  27. data/sys/aos/views/know.rb +19 -0
  28. data/sys/aos/views/setup/settings.rb +50 -0
  29. data/sys/aos/views/setup.rb +19 -0
  30. data/sys/aos/views/welcome/waite.rb +19 -0
  31. data/sys/aos/views/welcome/winner.rb +19 -0
  32. data/sys/aos/views/welcome.rb +19 -0
  33. data/sys/aos/you.rb +15 -0
  34. data/sys/aro/d.rb +1 -1
  35. data/sys/aro/db.rb +5 -12
  36. data/sys/aro/mancy.rb +12 -15
  37. data/sys/aro/p.rb +1 -1
  38. data/sys/aro/v.rb +2 -3
  39. data/sys/aro.rb +1 -0
  40. data/sys/cli/config.rb +168 -104
  41. data/sys/cli/constants.rb +5 -2
  42. data/sys/cli/dom.rb +5 -13
  43. data/sys/cli/nterface.rb +6 -0
  44. data/sys/dom/d.rb +0 -5
  45. data/sys/dom/dom.rb +52 -85
  46. data/sys/models/deck.rb +13 -7
  47. data/sys/models/log.rb +12 -2
  48. data/sys/reiquire.rb +2 -2
  49. data/sys/shr/prompt.rb +8 -4
  50. data/sys/shr/t.rb +1 -1
  51. data/sys/shr/version.rb +2 -4
  52. metadata +50 -27
  53. data/sys/views/base.rb +0 -29
  54. data/sys/views/dom.rb +0 -27
  55. data/sys/views/games/deck.rb +0 -97
  56. data/sys/views/games/menu.rb +0 -27
  57. data/sys/views/setup/setup.rb +0 -27
data/sys/aro/mancy.rb CHANGED
@@ -17,6 +17,7 @@ module Aro
17
17
  O = 0
18
18
  S = 1
19
19
  OS = 2
20
+ E = 3
20
21
  N = 4
21
22
  PS1 = Aro::Mancy.name
22
23
  NAME_FILE = :".name"
@@ -26,7 +27,6 @@ module Aro
26
27
  ALL = :all
27
28
 
28
29
  ARO_ENV_DEBUG_MODES = [:development, :test]
29
- DEBUG_VERBOSE = false
30
30
 
31
31
  NUMERALS = {
32
32
  O: 0,
@@ -52,22 +52,15 @@ module Aro
52
52
  XX: 20,
53
53
  XXI: 21,
54
54
  XXII: 22,
55
+ XXXVII: 37,
56
+ XLII: 42,
57
+ C: 100,
55
58
  MMXCVII: Aro::Mancy::I2097I[Aro::Mancy::S..Aro::Mancy::N].to_i,
56
59
  }
57
60
 
58
61
  def initialize
59
- # ENV bindings
60
- ENV[:ARO_ENV_O.to_s] = "#{Aro::Mancy::O}"
61
- ENV[:ARO_ENV_S.to_s] = "#{Aro::Mancy::S}"
62
- ENV[:ARO_ENV_OS.to_s] = "#{Aro::Mancy::OS}"
63
- ENV[:ARO_ENV_N.to_s] = "#{Aro::Mancy::N}"
64
- ENV[:ARO_ENV_PS1.to_s] = "#{Aro::Mancy::PS1}"
65
- ENV[:ARO_ENV_NAME_FILE.to_s] = "#{Aro::Mancy::NAME_FILE}"
66
- ENV[:ARO_ENV_I2097I.to_s] = "#{Aro::Mancy::I2097I}"
67
- ENV[:ARO_ENV_YES.to_s] = "#{Aro::Mancy::YES}"
68
-
69
- if Aro::Mancy.is_aro_space?
70
- Aro::Db.new
62
+ if Aro::Mancy.is_aro_space? && Aro::Mancy.is_initialized?
63
+ Aro::Mancy.init
71
64
  self.game = Aro::Deck.current_deck
72
65
  end
73
66
  end
@@ -97,13 +90,17 @@ module Aro
97
90
  end
98
91
 
99
92
  Dir.chdir(name) do
100
- Aro::Db.new.setup_local_aro
93
+ Aro::Mancy.init
101
94
  end
102
95
  return true
103
96
  end
104
97
 
105
98
  def self.init
106
- Aro::Db.new.setup_local_aro
99
+ Aro::Db.new
100
+ end
101
+
102
+ def self.start
103
+ Aos.start(:aro)
107
104
  end
108
105
 
109
106
  def self.is_initialized?
data/sys/aro/p.rb CHANGED
@@ -14,7 +14,7 @@ require_relative :"./r".to_s
14
14
  module Aro
15
15
  class P < Aro::Prompt
16
16
  def self.say(message)
17
- unless Aro::T.is_dev_tarot?
17
+ if !Aro::Dom.in_arodom? && !Aro::T.is_dev_tarot?
18
18
  Aro::R.say(message)
19
19
  else
20
20
  Aro::P::p.say(">[#{Aro::Mancy::PS1}]>: #{message}")
data/sys/aro/v.rb CHANGED
@@ -14,12 +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
- Aro::P::p.say(">[Aro::Mancy::DEBUG_VERBOSE]>: #{message}\n")
17
+ Aro::P::p.say(">[VERBOSE]>: #{message}\n")
18
18
  end
19
19
 
20
20
  def self.should_print?
21
- Aro::Mancy::DEBUG_VERBOSE && super
21
+ CLI::Config.ivar(:VERBOSE).to_s == CLI::Config::BOOLS[:TRUE].to_s && super
22
22
  end
23
23
  end
24
24
  end
25
-
data/sys/aro.rb CHANGED
@@ -12,4 +12,5 @@ require_relative :reiquire.to_s
12
12
  Reiquire::aro
13
13
 
14
14
  module Aro
15
+
15
16
  end
data/sys/cli/config.rb CHANGED
@@ -53,19 +53,51 @@ module CLI
53
53
  RUBY_FACOT: :ruby_facot,
54
54
  }
55
55
 
56
+ # ovar and ivar access
57
+ #
58
+ # example usage:
59
+ # CLI::Config::DEF_ACCESS[:READ]
56
60
  DEF_ACCESS = {
57
61
  READ: :read,
58
62
  WRITE: :write
59
63
  }
60
64
 
65
+ BOOLS = {
66
+ FALSE: false,
67
+ TRUE: true,
68
+ }
69
+
70
+ TYPES = {
71
+ BOOL: :bool,
72
+ INT: :int,
73
+ STRING: :string,
74
+ VALUES: :values
75
+ }
76
+
61
77
  # types used in definition
62
78
  #
63
79
  # example usage:
64
80
  # CLI::Config::DEF_TYPES[:INT][:validator].call(unvalid, CLI::Config::DEF[:DIMENSION])
65
81
  DEF_TYPES = {
82
+ BOOL: {
83
+ name: CLI::Config::TYPES[:BOOL],
84
+ description: I18n.t("cli.config.type.bool_description"),
85
+ converter: Proc.new{|v|
86
+ if v == CLI::Config::BOOLS[:TRUE].to_s
87
+ CLI::Config::BOOLS[:TRUE]
88
+ else
89
+ CLI::Config::BOOLS[:FALSE]
90
+ end
91
+ },
92
+ validator: Proc.new{|unvalid, k, v|
93
+ CLI::Config.def_valid?(k, v) &&
94
+ CLI::Config.bool_valid?(unvalid)
95
+ }
96
+ },
66
97
  INT: {
67
98
  name: :int,
68
- description: I18n.t("cli.config.type_int_description"),
99
+ description: I18n.t("cli.config.type.int_description"),
100
+ converter: Proc.new{|v| v.to_i},
69
101
  validator: Proc.new{|unvalid, k, v|
70
102
  int_valid = CLI::Config.def_valid?(k, v) &&
71
103
  CLI::Config.int_valid?(unvalid) &&
@@ -80,14 +112,17 @@ module CLI
80
112
  },
81
113
  STRING: {
82
114
  name: :string,
83
- description: I18n.t("cli.config.type_string_description"),
115
+ description: I18n.t("cli.config.type.string_description"),
116
+ converter: Proc.new{|v| v.to_s},
84
117
  validator: Proc.new{|unvalid, k, v|
85
- unvalid.is_a?(String)
118
+ CLI::Config.def_valid?(k, v) &&
119
+ CLI::Config.string_valid?(unvalid)
86
120
  }
87
121
  },
88
122
  VALUES: {
89
123
  name: :values,
90
- description: I18n.t("cli.config.type_values_description"),
124
+ description: I18n.t("cli.config.type.values_description"),
125
+ converter: Proc.new{|v| v.to_s},
91
126
  validator: Proc.new{|unvalid, k, v|
92
127
  CLI::Config.def_valid?(k, v) &&
93
128
  v[:possible_values].keys.include?(unvalid&.to_sym)
@@ -95,10 +130,18 @@ module CLI
95
130
  },
96
131
  }
97
132
 
133
+ def self.bool_valid?(unvalid)
134
+ CLI::Config::BOOLS.include?(unvalid&.to_s&.to_sym)
135
+ end
136
+
98
137
  def self.int_valid?(unvalid)
99
138
  !unvalid&.to_i.nil?
100
139
  end
101
140
 
141
+ def self.string_valid?(unvalid)
142
+ unvalid.is_a?(String)
143
+ end
144
+
102
145
  def self.def_valid?(key, deff)
103
146
  def_valid = deff == CLI::Config::DEF[key]
104
147
  unless def_valid
@@ -109,80 +152,93 @@ module CLI
109
152
  end
110
153
 
111
154
  def validate_config
112
- invalid_defs = []
113
- CLI::Config::DEF.each{|k, v|
114
- invalid_defs << k unless validate_value(CLI::Config.ivar(k), k, v)
155
+ invalid_vars = []
156
+ CLI::Config::DEF.each{|k, v|
157
+ is_valid = valid_var?(ENV[CLI::Config.ivar_k(k)], k, v)
158
+ invalid_vars << k unless is_valid
115
159
  }
116
- invalid_defs
160
+ invalid_vars
117
161
  end
118
162
 
119
- def validate_value(var_value, k, v)
163
+ def valid_var?(var_value, k, v)
120
164
  CLI::Config::DEF_TYPES[
121
165
  v[:type].to_s.upcase.to_sym
122
166
  ][:validator].call(var_value, k, v)
123
- end
167
+ end
168
+
169
+ def convert_var_for_def(k)
170
+ CLI::Config::DEF_TYPES[
171
+ CLI::Config::DEF[k][:type].upcase
172
+ ][:converter].call(ENV[CLI::Config.ivar_k(k)])
173
+ end
124
174
 
125
175
  # adapts I18n translations to generate bash environment vars.
126
176
  #
127
177
  # example usage:
128
178
  # CLI::Config::DEF[:Z_MAX]
129
179
  DEF = {
130
- # writable variables
180
+
181
+ #
182
+ # => ivars
183
+ #
131
184
  ENV: {
132
- type: :values,
185
+ type: CLI::Config::TYPES[:VALUES],
133
186
  access: CLI::Config::DEF_ACCESS[:WRITE],
134
187
  value: CLI::Config::ENVS[:PRODUCTION],
135
- description: I18n.t(
136
- "cli.config.env_description",
137
- possible_values: CLI::Config::ENVS.values.join(", ")
138
- ),
188
+ description: I18n.t("cli.config.env.description"),
139
189
  possible_values: {
140
- development: I18n.t("cli.config.env_development_description"),
141
- production: I18n.t("cli.config.env_production_description"),
142
- test: I18n.t("cli.config.env_test_description"),
190
+ development: I18n.t("cli.config.env.development_description"),
191
+ production: I18n.t("cli.config.env.production_description"),
192
+ test: I18n.t("cli.config.env.test_description"),
143
193
  }
144
194
  },
145
195
  FORMAT: { # not implemented yet.
146
- type: :values,
196
+ type: CLI::Config::TYPES[:VALUES],
147
197
  implemented: false,
148
198
  access: CLI::Config::DEF_ACCESS[:WRITE],
149
199
  value: CLI::Config::FORMATS[:TEXT],
150
- description: I18n.t(
151
- "cli.config.format_description",
152
- possible_values: CLI::Config::FORMATS.values.join(", ")
153
- ),
200
+ description: I18n.t("cli.config.format.description"),
154
201
  possible_values: {
155
- text: I18n.t("cli.config.text_format_description"),
156
- json: I18n.t("cli.config.json_format_description")
202
+ text: I18n.t("cli.config.format.text_description"),
203
+ json: I18n.t("cli.config.format.json_description")
157
204
  }
158
205
  },
159
206
  DIMENSION: {
160
- type: :values,
207
+ type: CLI::Config::TYPES[:VALUES],
161
208
  access: CLI::Config::DEF_ACCESS[:WRITE],
162
209
  value: CLI::Config::DMS[:DEV_TAROT],
163
- description: I18n.t(
164
- "cli.config.dimension_description",
165
- possible_values: CLI::Config::DMS.values.join(", ")
166
- ),
210
+ description: I18n.t("cli.config.dimension.description"),
167
211
  possible_values: {
168
- dev_tarot: I18n.t("cli.config.dimension_dev_tarot_description"),
169
- ruby_facot: I18n.t("cli.config.dimension_ruby_facot_description"),
212
+ dev_tarot: I18n.t("cli.config.dimension.dev_tarot_description"),
213
+ ruby_facot: I18n.t("cli.config.dimension.ruby_facot_description"),
170
214
  }
171
215
  },
172
- DISPLAY_COLUMNS: {
173
- type: :int,
216
+ HEIGHT: {
217
+ type: CLI::Config::TYPES[:INT],
174
218
  access: CLI::Config::DEF_ACCESS[:WRITE],
175
- value: Aro::Mancy::NUMERALS[:VII],
219
+ value: Aro::Mancy::NUMERALS[:XLII],
176
220
  min: Aro::Mancy::NUMERALS[:I],
177
- max: Aro::Mancy::NUMERALS[:XXII] / Aro::Mancy::OS,
221
+ max: Aro::Mancy::NUMERALS[:VII].pow(Aro::Mancy::OS),
178
222
  description: I18n.t(
179
- "cli.config.display_columns_description",
223
+ "cli.config.height_description",
180
224
  min: Aro::Mancy::NUMERALS[:I],
181
- max: Aro::Mancy::NUMERALS[:XXII] / Aro::Mancy::OS,
225
+ max: Aro::Mancy::NUMERALS[:VII].pow(Aro::Mancy::OS),
226
+ ),
227
+ },
228
+ WIDTH: {
229
+ type: CLI::Config::TYPES[:INT],
230
+ access: CLI::Config::DEF_ACCESS[:WRITE],
231
+ value: Aro::Mancy::NUMERALS[:C] + Aro::Mancy::NUMERALS[:XXXVII] - Aro::Mancy::S,
232
+ min: Aro::Mancy::NUMERALS[:I],
233
+ max: Aro::Mancy::NUMERALS[:XI].pow(Aro::Mancy::OS),
234
+ description: I18n.t(
235
+ "cli.config.width_description",
236
+ min: Aro::Mancy::NUMERALS[:I],
237
+ max: Aro::Mancy::NUMERALS[:XI].pow(Aro::Mancy::OS),
182
238
  ),
183
239
  },
184
240
  Z: {
185
- type: :int,
241
+ type: CLI::Config::TYPES[:INT],
186
242
  access: CLI::Config::DEF_ACCESS[:WRITE],
187
243
  value: Aro::Mancy::NUMERALS[:I],
188
244
  min: Aro::Mancy::NUMERALS[:I],
@@ -194,7 +250,7 @@ module CLI
194
250
  ),
195
251
  },
196
252
  Z_MAX: {
197
- type: :int,
253
+ type: CLI::Config::TYPES[:INT],
198
254
  access: CLI::Config::DEF_ACCESS[:WRITE],
199
255
  value: Aro::Mancy::NUMERALS[:VII],
200
256
  min: Aro::Mancy::NUMERALS[:I],
@@ -205,79 +261,88 @@ module CLI
205
261
  max: Aro::Mancy::NUMERALS[:XXII],
206
262
  ),
207
263
  },
264
+ VERBOSE: {
265
+ type: CLI::Config::TYPES[:BOOL],
266
+ access: CLI::Config::DEF_ACCESS[:WRITE],
267
+ value: CLI::Config::BOOLS[:FALSE],
268
+ description: I18n.t("cli.config.verbose_description"),
269
+ },
208
270
 
209
- # read only variables
271
+ #
272
+ # => ovars
273
+ #
210
274
  ARO_ENV_O: {
211
- type: :string,
275
+ type: CLI::Config::TYPES[:INT],
212
276
  access: CLI::Config::DEF_ACCESS[:READ],
213
277
  value: Aro::Mancy::O,
214
- description: I18n.t(
215
- "cli.config.aro_env_O_description"
216
- ),
278
+ description: I18n.t("cli.config.aro_env.O_description"),
217
279
  },
218
280
  ARO_ENV_S: {
219
- type: :string,
281
+ type: CLI::Config::TYPES[:INT],
220
282
  access: CLI::Config::DEF_ACCESS[:READ],
221
283
  value: Aro::Mancy::S,
222
- description: I18n.t(
223
- "cli.config.aro_env_S_description"
224
- ),
284
+ description: I18n.t("cli.config.aro_env.S_description"),
225
285
  },
226
286
  ARO_ENV_OS: {
227
- type: :string,
287
+ type: CLI::Config::TYPES[:INT],
228
288
  access: CLI::Config::DEF_ACCESS[:READ],
229
289
  value: Aro::Mancy::OS,
230
- description: I18n.t(
231
- "cli.config.aro_env_OS_description"
232
- ),
290
+ description: I18n.t("cli.config.aro_env.OS_description"),
291
+ },
292
+ ARO_ENV_E: {
293
+ type: CLI::Config::TYPES[:INT],
294
+ access: CLI::Config::DEF_ACCESS[:READ],
295
+ value: Aro::Mancy::E,
296
+ description: I18n.t("cli.config.aro_env.E_description"),
233
297
  },
234
298
  ARO_ENV_N: {
235
- type: :string,
299
+ type: CLI::Config::TYPES[:INT],
236
300
  access: CLI::Config::DEF_ACCESS[:READ],
237
301
  value: Aro::Mancy::N,
238
- description: I18n.t(
239
- "cli.config.aro_env_N_description"
240
- ),
302
+ description: I18n.t("cli.config.aro_env.N_description"),
241
303
  },
242
304
  ARO_ENV_PS1: {
243
- type: :string,
305
+ type: CLI::Config::TYPES[:STRING],
244
306
  access: CLI::Config::DEF_ACCESS[:READ],
245
307
  value: Aro::Mancy::PS1,
246
- description: I18n.t(
247
- "cli.config.aro_env_PS1_description"
248
- ),
308
+ description: I18n.t("cli.config.aro_env.PS1_description"),
249
309
  },
250
310
  ARO_ENV_NAME_FILE: {
251
- type: :string,
311
+ type: CLI::Config::TYPES[:STRING],
252
312
  access: CLI::Config::DEF_ACCESS[:READ],
253
313
  value: Aro::Mancy::NAME_FILE,
254
- description: I18n.t(
255
- "cli.config.aro_env_NAME_FILE_description"
256
- ),
314
+ description: I18n.t("cli.config.aro_env.NAME_FILE_description"),
257
315
  },
258
316
  ARO_ENV_I2097I: {
259
- type: :string,
317
+ type: CLI::Config::TYPES[:STRING],
260
318
  access: CLI::Config::DEF_ACCESS[:READ],
261
- description: I18n.t(
262
- "cli.config.aro_env_I2097I_description"
263
- ),
264
- value: Aro::Mancy::I2097I
319
+ value: Aro::Mancy::I2097I,
320
+ description: I18n.t("cli.config.aro_env.I2097I_description"),
265
321
  },
266
322
  ARO_ENV_YES: {
267
- type: :string,
323
+ type: CLI::Config::TYPES[:STRING],
268
324
  access: CLI::Config::DEF_ACCESS[:READ],
269
325
  value: Aro::Mancy::YES,
270
- description: I18n.t(
271
- "cli.config.aro_env_YES_description"
272
- ),
326
+ description: I18n.t("cli.config.aro_env.YES_description"),
327
+ },
328
+ ARO_ENV_ALL: {
329
+ type: CLI::Config::TYPES[:STRING],
330
+ access: CLI::Config::DEF_ACCESS[:READ],
331
+ value: Aro::Mancy::ALL,
332
+ description: I18n.t("cli.config.aro_env.ALL_description"),
273
333
  },
274
-
275
- # ...
276
334
  }
277
335
 
278
336
  def initialize
279
- Aro::P.say("config init")
280
- return unless Aro::Mancy.is_aro_space? && Aro::Mancy.is_initialized?
337
+ @@context = nil
338
+ if Aro::Mancy.is_aro_space? && Aro::Mancy.is_initialized?
339
+ @@context = Aro::Mancy.name
340
+ elsif Aro::Dom.in_arodom?
341
+ @@context = Aro::Dom.name
342
+ end
343
+
344
+ return if @@context.nil?
345
+
281
346
  unless File.exist?(CLI::Config.config_filepath)
282
347
  generate_config
283
348
  end
@@ -287,33 +352,28 @@ module CLI
287
352
  end
288
353
 
289
354
  def self.config_filepath
290
- File.join(Aro::Db.base_aro_dir, CLI::Config::CONFIG_FILE.to_s)
355
+ db_cls = @@context == Aro::Dom.name ? Aos::Db : Aro::Db
356
+ File.join(db_cls.base_aro_dir, CLI::Config::CONFIG_FILE.to_s)
291
357
  end
292
358
 
293
359
  def self.display_config
294
- Aro::V.say("getting display config...")
295
- columns = CLI::Config.ivar(:DISPLAY_COLUMNS)
296
- Aro::V.say("DISPLAY_COLUMNS: #{columns}")
297
-
298
- # default
299
- width = CLI::Config::DEF[:DISPLAY_COLUMNS][:value]
300
- if columns.respond_to?(:to_i)
301
- # user setting
302
- columns = columns.to_i
303
- width = columns.to_i.pow(Aro::Mancy::OS)
304
- end
305
- Aro::V.say("WIDTH: #{width}")
306
-
307
- {
360
+ Aro::V.say(__method__)
361
+ width = CLI::Config.ivar(:WIDTH).to_i
362
+ columns = width.pow(Aro::Mancy::S.to_f / Aro::Mancy::OS.to_f).to_i
363
+ result = {
308
364
  COLUMNS: columns,
365
+ HEIGHT: CLI::Config.ivar(:HEIGHT).to_i,
309
366
  WIDTH: width,
310
367
  DIVIDER: :"-".to_s
311
368
  }
369
+ Aro::V.say(result)
370
+
371
+ result
312
372
  end
313
373
 
314
374
  # out vars
315
375
  def self.ovar(suffix)
316
- ENV[CLI::Config.ovar_k(suffix)]
376
+ CLI::Config::DEF[suffix][:value]
317
377
  end
318
378
  # out vars
319
379
  def self.ovar_k(suffix)
@@ -334,8 +394,8 @@ module CLI
334
394
  #
335
395
  # default is production
336
396
  varenv = CLI::Config.ivar(:ENV)
337
- var_valid = validate_value(varenv, :ENV, CLI::Config::DEF[:ENV])
338
- ENV[:ARO_ENV.to_s] = var_valid ? varenv : CLI::Config::ENVS[:PRODUCTION].to_s
397
+ is_valid = valid_var?(varenv, :ENV, CLI::Config::DEF[:ENV])
398
+ ENV[:ARO_ENV.to_s] = is_valid ? varenv : CLI::Config::ENVS[:PRODUCTION].to_s
339
399
  Aro::D.say("setup_env: #{ENV[:ARO_ENV.to_s]}")
340
400
  end
341
401
 
@@ -344,9 +404,9 @@ module CLI
344
404
  end
345
405
 
346
406
  def source_config
347
- Aro::D.say(I18n.t("cli.config.sourcing_config", name: CLI::Config.config_filepath))
407
+ Aro::D.say(I18n.t("cli.config.source", name: CLI::Config.config_filepath))
348
408
  File.read(CLI::Config.config_filepath).split("\n").select{|line|
349
- line.match?(/export #{:ARO_}/)
409
+ line.match?(/export #{CLI::Config::ARO_CONFIG_PREFIX}/)
350
410
  }.map{|line|
351
411
  line.gsub("export ", "").split("=")
352
412
  }.each{|kv|
@@ -369,7 +429,7 @@ module CLI
369
429
 
370
430
  def generate_config
371
431
  # todo: localize generated config text
372
- Aro::D.say(I18n.t("cli.config.generating_default_config", name: CLI::Config.config_filepath))
432
+ Aro::D.say(I18n.t("cli.config.generate", name: CLI::Config.config_filepath))
373
433
  File.open(CLI::Config.config_filepath, "w+") do |file|
374
434
  # intro
375
435
  Aro::Mancy::OS.times do
@@ -490,14 +550,14 @@ module CLI
490
550
  file.write("# => #{I18n.t("cli.config.def_type")}: #{v[:type]}\n")
491
551
  case v[:type]
492
552
  when CLI::Config::DEF_TYPES[:INT][:name]
493
- file.write("# => #{I18n.t("cli.config.type_int_description")}\n")
553
+ file.write("# => #{I18n.t("cli.config.type.int_description")}\n")
494
554
  file.write("# => #{I18n.t("cli.config.minimum")}: #{v[:min]}\n")
495
555
  file.write("# => #{I18n.t("cli.config.maximum")}: #{v[:max]}\n")
496
556
  when CLI::Config::DEF_TYPES[:STRING][:name]
497
- file.write("# => #{I18n.t("cli.config.type_string_description")}\n")
557
+ file.write("# => #{I18n.t("cli.config.type.string_description")}\n")
498
558
  file.write("# => use \"double quotes\" if there are any spaces.\n")
499
559
  when CLI::Config::DEF_TYPES[:VALUES][:name]
500
- file.write("# => #{I18n.t("cli.config.type_values_description")}\n")
560
+ file.write("# => #{I18n.t("cli.config.type.values_description")}\n")
501
561
  file.write("# => #{I18n.t("cli.config.possible_values")}:\n")
502
562
  print_sr f_object_id
503
563
  v[:possible_values].each{|name, description|
@@ -510,7 +570,11 @@ module CLI
510
570
  print_osr f_object_id
511
571
  file.write("# => description:\n")
512
572
  file.write("# => #{v[:description]}\n")
513
- file.write("export #{var_name}=#{v[:value]}\n")
573
+ if is_ovar && CLI::Config::DEF_TYPES[:STRING][:name] == v[:type]
574
+ file.write("export #{var_name}=\"#{v[:value]}\"\n")
575
+ else
576
+ file.write("export #{var_name}=#{v[:value]}\n")
577
+ end
514
578
  print_osr f_object_id
515
579
  end
516
580
 
data/sys/cli/constants.rb CHANGED
@@ -24,6 +24,10 @@ module CLI
24
24
  }
25
25
 
26
26
  CMDS = {
27
+ AOS: {
28
+ RUN: :run,
29
+ WATCH: :watch,
30
+ },
27
31
  ARO: {
28
32
  CREATE: :create,
29
33
  CONFIG: :config,
@@ -45,9 +49,8 @@ module CLI
45
49
  },
46
50
  DOM: {
47
51
  INIT: :init,
48
- MAP: :map,
49
52
  NEW: :new,
50
- }
53
+ },
51
54
  }
52
55
 
53
56
  end
data/sys/cli/dom.rb CHANGED
@@ -10,21 +10,17 @@
10
10
 
11
11
  module CLI
12
12
  def self.dom
13
- action = CLI::ARGV1&.to_sym
14
-
15
- CLI::Nterface.exit_error_invalid_usage! unless CLI::CMDS[:DOM].values.include?(action)
16
-
17
13
  if CLI::FLAGS[:HELP].include?(CLI::ARGV1)
18
14
  CLI.usage::usage
19
15
  exit(CLI::EXIT_CODES[:SUCCESS])
20
- elsif CLI::ARGV1.nil?
21
- # no args, default dom action
22
- Aro::Dom.map
23
16
  end
24
17
 
18
+ action = CLI::ARGV1&.to_sym
19
+
20
+ CLI::Nterface.exit_error_invalid_usage! unless !action.nil? &&
21
+ CLI::CMDS[:DOM].values.include?(action)
22
+
25
23
  case action
26
- when CLI::CMDS[:DOM][:MAP]
27
- Aro::Dom.map
28
24
  when CLI::CMDS[:DOM][:INIT]
29
25
  arodome = Aro::Dom.new
30
26
  arodome.generate
@@ -36,10 +32,6 @@ module CLI
36
32
  else
37
33
  Aro::Dom.create(CLI::ARGV2.to_s)
38
34
  end
39
- else
40
- if CLI::CMDS[:DOM].values.include?(action)
41
- # todo:
42
- end
43
35
  end
44
36
  end
45
37
  end
data/sys/cli/nterface.rb CHANGED
@@ -21,5 +21,11 @@ module CLI
21
21
  Aro::P.say(I18n.t("cli.errors.invalid_usage", cmd: Aro::Mancy::I2097I))
22
22
  exit(CLI::EXIT_CODES[:INVALID_ARG])
23
23
  end
24
+
25
+ def self.exit_error_not_initialized!
26
+ Aro::P.say(I18n.t("cli.errors.header", cmd: Aro::Mancy::I2097I))
27
+ Aro::P.say(I18n.t("cli.errors.not_initialized", cmd: Aro::Mancy::I2097I))
28
+ exit(CLI::EXIT_CODES[:INVALID_ARG])
29
+ end
24
30
  end
25
31
  end
data/sys/dom/d.rb CHANGED
@@ -19,10 +19,6 @@ module Aro
19
19
  name: Aro::Dom::WAITE,
20
20
  description: "sign up."
21
21
  },
22
- WELCOME: {
23
- name: Aro::Dom::WELCOME,
24
- description: "sign in."
25
- },
26
22
  WINNER: {
27
23
  name: Aro::Dom::WINNER,
28
24
  description: "win."
@@ -71,7 +67,6 @@ module Aro
71
67
  description: "sign up process.",
72
68
  rooms: [
73
69
  Aro::Dom::D::WINGS[:WELCOME][:WAITE],
74
- Aro::Dom::D::WINGS[:WELCOME][:WELCOME],
75
70
  Aro::Dom::D::WINGS[:WELCOME][:WINNER],
76
71
  ]
77
72
  },