aro 0.2.2 → 0.2.3

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +1 -1
  4. data/aro.gemspec +3 -3
  5. data/bin/aos +10 -3
  6. data/bin/aro +18 -11
  7. data/checksums/aro-0.2.3.gem.sha512 +1 -0
  8. data/locale/en.abot.yml +81 -0
  9. data/locale/en.aos.yml +6 -2
  10. data/locale/en.cor.yml +47 -0
  11. data/locale/en.data.yml +2 -2
  12. data/locale/en.dom.yml +15 -13
  13. data/locale/en.flie.yml +29 -0
  14. data/locale/en.usage.yml +24 -11
  15. data/locale/en.yml +2 -47
  16. data/sys/aos/abot.rb +256 -0
  17. data/sys/aos/aos.rb +373 -161
  18. data/sys/aos/cor.rb +773 -0
  19. data/sys/aos/data.rb +3 -3
  20. data/sys/aos/db/migrate/1765148774_create_yous.rb +1 -1
  21. data/sys/aos/db/migrate/1765933985_create_agodos.rb +22 -0
  22. data/sys/aos/db/migrate/1766203888_create_fpxies.rb +18 -0
  23. data/sys/aos/db.rb +16 -16
  24. data/sys/aos/flie.rb +144 -0
  25. data/sys/aos/models/agodo.rb +96 -0
  26. data/sys/aos/models/base_model.rb +13 -0
  27. data/sys/aos/models/fpxy.rb +28 -0
  28. data/sys/aos/models/ilib.rb +2 -0
  29. data/sys/aos/models/ilog.rb +5 -3
  30. data/sys/aos/models/you.rb +52 -4
  31. data/sys/aos/s.rb +2 -1
  32. data/sys/aos/vws/base.rb +62 -22
  33. data/sys/aos/vws/dom.rb +1 -1
  34. data/sys/aos/vws/games/abot.rb +21 -0
  35. data/sys/aos/vws/games/{game.rb → teck.rb} +19 -16
  36. data/sys/aos/vws/home.rb +23 -0
  37. data/sys/aos/vws/root/config.rb +4 -4
  38. data/sys/aos/vws/root/flie.rb +21 -0
  39. data/sys/aos/vws/welcome.rb +40 -4
  40. data/sys/aro/d.rb +4 -2
  41. data/sys/aro/db.rb +19 -10
  42. data/sys/aro/mancy.rb +16 -20
  43. data/sys/aro/models/base_model.rb +13 -0
  44. data/sys/aro/models/teck.rb +16 -12
  45. data/sys/aro/models/tlog.rb +2 -1
  46. data/sys/aro/p.rb +1 -1
  47. data/sys/aro/r.rb +2 -1
  48. data/sys/aro/v.rb +2 -2
  49. data/sys/cli/constants.rb +4 -10
  50. data/sys/cli/create.rb +2 -3
  51. data/sys/cli/dom.rb +1 -2
  52. data/sys/cli/teck.rb +26 -33
  53. data/sys/cli.rb +7 -9
  54. data/sys/dom/d.rb +38 -29
  55. data/sys/dom/dom.rb +62 -36
  56. data/sys/dom/p.rb +1 -1
  57. data/sys/fpx.rb +116 -0
  58. data/sys/reiquire.rb +3 -2
  59. data/sys/shr/prompt.rb +2 -2
  60. data/sys/shr/t.rb +11 -13
  61. data/sys/shr/version.rb +1 -1
  62. data/tasks/make.rake +1 -1
  63. metadata +55 -43
  64. data/sys/aos/vws/games/abpps.rb +0 -19
  65. data/sys/aos/vws/games/hbpps.rb +0 -19
  66. data/sys/aos/vws/games/shpps.rb +0 -19
  67. data/sys/aos/vws/games/vipps.rb +0 -19
  68. data/sys/dom/config.rb +0 -718
data/sys/aos/vws/base.rb CHANGED
@@ -17,16 +17,26 @@ module Aos
17
17
  MARGIN_H = Aro::Mancy::S
18
18
 
19
19
  def self.show
20
- draw([self.name])
20
+ draw([
21
+ "the #{self.name} room.",
22
+ "",
23
+ "getting directory listing...",
24
+ "",
25
+ Aos::Os.instance.get_ls([])
26
+ ])
21
27
  end
22
28
 
23
29
  def self.draw(body_lines)
24
30
  return false unless body_lines.kind_of?(Array)
25
31
  lines = []
26
- dc = Aro::Config.display_configuration
27
- height = dc[:HEIGHT]
32
+
33
+ dc = Aos::Cor.display_configuration
28
34
  width = dc[:WIDTH]
29
35
 
36
+ if Aro::Dom.in_arodom?
37
+ lines += get_main_divider(width, true)
38
+ end
39
+
30
40
  # top vertical margin
31
41
  Aos::Vw::Base::MARGIN_V.times do
32
42
  lines << get_body_line("")
@@ -37,39 +47,73 @@ module Aos
37
47
  lines << get_body_line(line)
38
48
  }
39
49
 
40
- lines += get_aos_display_lines if Aro::Dom.in_arodom?
50
+ if Aro::Dom.in_arodom?
51
+ lines += get_aos_display_lines
52
+ end
41
53
 
42
54
  # print everything
43
- Aos::S.say(lines.join("\n"))
55
+
56
+ Aro::Prompt.say(lines)
44
57
 
45
58
  # explicitly return true
46
59
  true
47
60
  end
48
61
 
62
+ def self.get_main_divider(width, clock = false)
63
+ left = "#{Aos::Os::PS1}"
64
+ if clock
65
+ left = "#{left}#{get_domain} >"
66
+ else
67
+ left = "#{left}v#{Aro::VERSION} >"
68
+ end
69
+ right = "< " + (clock ? get_clock : get_display_dimension.strip)
70
+ lines = []
71
+ lines << ""
72
+ lines << left.ljust(width - right.length, "-".to_s) + right
73
+ lines << ""
74
+ lines
75
+ end
76
+
49
77
  def self.get_aos_display_lines
50
78
  # current Aos::Os output
79
+
80
+ width = Aos::Cor.display_configuration[:WIDTH]
51
81
  lines = []
82
+ Aos::Os.instance.display_lines ||= []
52
83
  unless Aos::Os.instance.display_lines.empty?
53
- dc = Aro::Config.display_configuration
54
- width = dc[:WIDTH]
55
- lines << "".center(width)
56
- display_dim = get_display_dimension
57
84
  Aos::Os.instance.display_lines.each{|line|
58
85
  lines << line
59
86
  }
87
+ Aos::Os.instance.display_lines = []
60
88
  lines << "".center(width)
61
- lines << "v#{Aro::VERSION.to_s}".ljust(width - display_dim.length) + display_dim
62
89
  end
63
90
 
91
+ Aos::Db.load
92
+
93
+ the_you = Aos::Os.instance.you_flag || Aos::Os.instance.you
94
+ Aro::V.say(Aos::Os.you_name_from_flag_arg)
95
+ Aro::V.say(the_you.inspect)
96
+ present_users = Aos::You.order(
97
+ name: :asc
98
+ ).where(
99
+ pwd: the_you.pwd,
100
+ access: [:agodo, :user]
101
+ ).map{|y|
102
+ (the_you == y ? Aos::Os::STAR.to_s : "") +
103
+ y.name
104
+ }
105
+
106
+ if present_users.any?
107
+ lines << "[ yous in the room ]".center(width)
108
+ lines << ("[ " + present_users.join(" ") + " ]").center(width)
109
+ end
110
+ lines << ":you_are_root".center(width) if the_you.root?
111
+ lines += get_main_divider(width)
64
112
  lines
65
113
  end
66
114
 
67
115
  def self.get_display_dimension
68
- "#{self.get_dt.rjust(Aro::Mancy::V)} :<[#{self.get_dimension}]<"
69
- end
70
-
71
- def self.get_dt
72
- Aro::T.read_dev_tarot.strip[Aro::Mancy::S..]
116
+ "#{Aro::T.read_dev_tarot(true).rjust(Aro::Mancy::V)} :<[#{self.get_dimension}]<"
73
117
  end
74
118
 
75
119
  def self.get_dimension
@@ -77,7 +121,7 @@ module Aos
77
121
  end
78
122
 
79
123
  def self.get_domain
80
- Aro::Dom.in_arodom? ? Aro::Dom::domain : Aro::Mancy.domain
124
+ Aro::Mancy.in_aro? ? Aro::Mancy.domain : Aro::Dom.domain
81
125
  end
82
126
 
83
127
  def self.get_clock
@@ -85,7 +129,7 @@ module Aos
85
129
  end
86
130
 
87
131
  def self.viewport_width
88
- dc = Aro::Config.display_configuration
132
+ dc = Aos::Cor.display_configuration
89
133
  width = dc[:WIDTH]
90
134
  bar_width = (Aos::Vw::Base::BAR.length * Aro::Mancy::OS)
91
135
  h_margin_width = (Aos::Vw::Base::MARGIN_H * Aro::Mancy::OS)
@@ -97,7 +141,7 @@ module Aos
97
141
  hm = Aos::Vw::Base::MARGIN_H
98
142
  bar = Aos::Vw::Base::BAR
99
143
  hm_space = " " * Aos::Vw::Base::MARGIN_H
100
- just = Aro::Config.display_configuration[:WIDTH] - (hm_space.length + bar.length)
144
+ just = Aos::Cor.display_configuration[:WIDTH] - (hm_space.length + bar.length)
101
145
  (bar + hm_space + (line || "")).ljust(just) + hm_space + bar
102
146
  end
103
147
 
@@ -111,10 +155,6 @@ module Aos
111
155
  lines << ""
112
156
  lines
113
157
  end
114
-
115
- def self.debug_log(lines)
116
- Aro::V.say(lines)
117
- end
118
158
  end
119
159
  end
120
160
  end
data/sys/aos/vws/dom.rb CHANGED
@@ -23,7 +23,7 @@ module Aos
23
23
  lines << ""
24
24
  lines << I18n.t("aos.views.dom.quick_navigation")
25
25
  lines << ""
26
- lines << " => #{Aro::Dom::D.reserved_words.join(" ")}"
26
+ lines << " => #{Aro::Dom::D.reserved_words(Aos::Os.instance.you.root?).join(" ")}"
27
27
  lines << ""
28
28
  draw(lines)
29
29
  end
@@ -0,0 +1,21 @@
1
+ =begin
2
+
3
+ vws/games/abot.rb
4
+
5
+ the abot view.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require_relative :"../base".to_s
12
+
13
+ module Aos
14
+ module Vw
15
+ class Abot < Aos::Vw::Base
16
+ def self.show
17
+ draw(Aos::Abot.instance.display_lines)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -13,24 +13,26 @@ require_relative :"../base".to_s
13
13
 
14
14
  module Aos
15
15
  module Vw
16
- class Game < Aos::Vw::Base
16
+ class Teck < Aos::Vw::Base
17
17
 
18
- DECK_PARAMS = [
18
+ TECK_PARAMS = [
19
19
  :teck,
20
20
  :tlog_records,
21
21
  :count_n,
22
22
  :order_o,
23
23
  ]
24
24
 
25
+ DIV_CHAR = :"."
26
+
25
27
  def self.show
26
- unless Aro::Mancy.game.nil?
27
- Aro::Mancy.game.show
28
+ unless Aro::Mancy.teck.nil?
29
+ Aro::Mancy.teck.show
28
30
  return
29
31
  end
30
32
 
31
33
  lines = []
32
- lines << I18n.t("aos.views.game.title").center(viewport_width)
33
- lines << I18n.t("aos.views.game.description").center(viewport_width)
34
+ lines << I18n.t("aos.views.game.title").center(Aos::Vw::Base.viewport_width)
35
+ lines << I18n.t("aos.views.game.description").center(Aos::Vw::Base.viewport_width)
34
36
 
35
37
  room_def = Aro::Dom::D::WINGS[:GAMES].values.filter{|gr|
36
38
  "#{Aos::Vw.name}::#{gr[:name].to_s.downcase.capitalize}" == self.name
@@ -45,27 +47,28 @@ module Aos
45
47
 
46
48
  def self.show_game(model)
47
49
  mk = model.keys
48
- dp = Aos::Vw::Game::DECK_PARAMS
50
+ dp = Aos::Vw::Teck::TECK_PARAMS
49
51
  return nil unless (mk & dp).count == dp.count
50
52
  return nil unless model.values.all?{|v| v != nil}
51
53
 
52
54
  teck = model[:teck]
53
55
  tlog_records = model[:tlog_records]
56
+ teck_tlog_count = teck.tlogs.count
54
57
  count_n = model[:count_n]
55
58
  order_o = model[:order_o]
56
59
 
57
- dc = Aro::Config.display_configuration
58
- width = count_n == Aro::Mancy::S ? viewport_width : dc[:WIDTH]
59
- divider = dc[:DIVIDER] * width
60
+ divider = Aos::Vw::Teck::DIV_CHAR.to_s * Aos::Vw::Base.viewport_width
60
61
  lines = []
61
62
  lines << divider
62
- lines << "#{teck.name.upcase.center(width)}"
63
+ lines << "#{teck.name.upcase.center(Aos::Vw::Base.viewport_width)}"
63
64
  tlog_records.each_with_index{|l, i|
64
65
  lines << divider
65
66
  lines << ""
66
- timestamp = l.created_at.strftime(Aro::Config::DATE_FORMAT)
67
- of_text = "#{order_o.to_sym == Aro::Tlog::ORDERING[:DESC] ? teck.tlogs.count - i : 1 + i} of #{teck.tlogs.count}"
68
- lines << of_text.ljust(width - timestamp.length) + timestamp
67
+ timestamp = l.created_at.strftime(Aos::Cor::DATE_FORMAT)
68
+ of_text = "#{order_o.to_sym == Aro::Tlog::ORDERING[:DESC] ? teck_tlog_count - i : 1 + i} of #{teck_tlog_count}"
69
+ lines << Aos::Vw::Base.get_body_line(
70
+ of_text.ljust(Aos::Vw::Base.viewport_width - timestamp.length - Aro::Mancy::OS) + timestamp
71
+ )
69
72
  lines << divider
70
73
  cards = Base64::decode64(l.card_data).split(Aro::Teck::CARD_DELIM.to_s)
71
74
  if !cards.nil? && cards.any?
@@ -77,7 +80,7 @@ module Aos
77
80
  drawn_cards = Base64::decode64(l.drawn_data).split(Aro::Teck::CARD_DELIM.to_s)
78
81
  if !drawn_cards.nil? && drawn_cards.any?
79
82
  lines << ""
80
- lines << I18n.t("cli.messages.history_drawn").center(width)
83
+ lines << I18n.t("cli.messages.history_drawn").center(Aos::Vw::Base.viewport_width)
81
84
  lines << divider
82
85
  lines << ""
83
86
  lines += self.get_display_for_cards(
@@ -96,7 +99,7 @@ module Aos
96
99
 
97
100
  def self.get_display_for_cards(input = [])
98
101
  columns = Aos::Vw::Base::COL_POW.call(
99
- Aro::Config.display_configuration[:WIDTH].to_i
102
+ Aos::Cor.display_configuration[:WIDTH].to_i
100
103
  )
101
104
  lines = []
102
105
  return lines unless input.any?
@@ -0,0 +1,23 @@
1
+ =begin
2
+
3
+ vws/root/home.rb
4
+
5
+ the home view.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require_relative :"./base".to_s
12
+
13
+ module Aos
14
+ module Vw
15
+ class Home < Aos::Vw::Base
16
+ def self.show
17
+ if Aos::Os.instance.you.home?
18
+ draw(Aos::Cor.instance.display_lines)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,8 +1,8 @@
1
1
  =begin
2
2
 
3
- vws/root/config.rb
3
+ vws/root/cor.rb
4
4
 
5
- the config view.
5
+ the cor view.
6
6
 
7
7
  by i2097i
8
8
 
@@ -12,9 +12,9 @@ require_relative :"../base".to_s
12
12
 
13
13
  module Aos
14
14
  module Vw
15
- class Config < Aos::Vw::Base
15
+ class Cor < Aos::Vw::Base
16
16
  def self.show
17
- draw(Aro::Config.instance.display_lines)
17
+ draw(Aos::Cor.instance.display_lines)
18
18
  end
19
19
  end
20
20
  end
@@ -0,0 +1,21 @@
1
+ =begin
2
+
3
+ vws/root/flie.rb
4
+
5
+ the flie view.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ require_relative :"../base".to_s
12
+
13
+ module Aos
14
+ module Vw
15
+ class Flie < Aos::Vw::Base
16
+ def self.show
17
+ draw(Aos::Flie.instance.display_lines)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -16,13 +16,49 @@ module Aos
16
16
  def self.show
17
17
  lines = []
18
18
 
19
- dc = Aro::Config.display_configuration
20
- height = dc[:HEIGHT]
19
+ dc = Aos::Cor.display_configuration
21
20
  width = dc[:WIDTH]
22
21
 
23
-
24
22
  lines << "welcome to #{Aro::Dom.ethergeist_name}".center(width)
25
- lines <<
23
+ lines << ""
24
+ hwidth = width - (Aos::Vw::Base::MARGIN_H * Aro::Mancy::OS)
25
+ lines << "".ljust(hwidth, dc[:DIVIDER])
26
+ lines << "map".center(hwidth)
27
+ lines << "".ljust(hwidth, dc[:DIVIDER])
28
+ lines << ""
29
+ yous = Aos::You.where(pwd: Aro::Dom.dom_root)
30
+ dom_line = "#{Aro::Dom.ethergeist_name}"
31
+ dom_line += (yous.any? ? " [#{yous.map{|y| y.name}.join(" ")}]" : "")
32
+ lines << dom_line
33
+ Aro::Dom::D::LAYOUT.values.each{|wing|
34
+ yous = Aos::You.where(pwd: File.join(Aro::Dom.dom_root, wing[:name].to_s))
35
+ wing_line = "".ljust(Aro::Mancy::NUMERALS[:IV])
36
+ wing_line += wing[:name].to_s
37
+ wing_line += (yous.any? ? " [#{yous.map{|y| y.name}.join(" ")}]" : "")
38
+ lines << wing_line
39
+ wing[:rooms].each{|room|
40
+ yous = Aos::You.where(pwd: File.join(Aro::Dom.dom_root, Aro::Dom.room_path(room[:name])))
41
+ room_line = "".ljust(Aro::Mancy::NUMERALS[:VIII])
42
+ room_line += room[:name].to_s
43
+ room_line += (yous.any? ? " [#{yous.map{|y| y.name}.join(" ")}]" : "")
44
+ lines << room_line
45
+ }
46
+ }
47
+ lines << ""
48
+
49
+ yous = Aos::You.order(access: :desc).all
50
+ if yous.empty?
51
+ lines << "no yous."
52
+ else
53
+ lines << "".ljust(hwidth, dc[:DIVIDER])
54
+ lines << "roster".center(hwidth)
55
+ lines << "".ljust(hwidth, dc[:DIVIDER])
56
+ lines << ""
57
+ yous.each{|y|
58
+ next if y.root? && !Aos::Os.instance.you.root?
59
+ lines += y.get_lines.map{|l| l.center(hwidth)}
60
+ }
61
+ end
26
62
  draw(lines)
27
63
  end
28
64
  end
data/sys/aro/d.rb CHANGED
@@ -9,16 +9,18 @@
9
9
  =end
10
10
 
11
11
  require_relative :"../shr/prompt".to_s
12
+ require :aro.to_s
12
13
 
13
14
  module Aro
14
15
  class D < Aro::Prompt
15
16
  def self.say(message)
16
17
  return unless Aro::D.should_print?
17
- Aro::P::p.say(">[#{Aro::Mancy::I2097I}]>: #{message}\n")
18
+ super([">[#{Aro::Mancy::I2097I}]>: #{message}"])
18
19
  end
19
20
 
20
21
  def self.should_print?
21
- Aro::Mancy::ARO_ENV_DEBUG_MODES[Aro::Mancy::O].to_s == ENV[:ARO_ENV.to_s]
22
+ return false unless Aos::Cor.ivar(:ENV).present?
23
+ Aos::Cor::DBG_MODES.include?(Aos::Cor.ivar(:ENV)&.to_sym)
22
24
  end
23
25
  end
24
26
  end
data/sys/aro/db.rb CHANGED
@@ -8,6 +8,9 @@
8
8
 
9
9
  =end
10
10
 
11
+ require_relative :"./mancy".to_s
12
+ require_relative :"../aos/cor".to_s
13
+
11
14
  module Aro
12
15
  class Db
13
16
  include Singleton
@@ -20,13 +23,15 @@ module Aro
20
23
 
21
24
  def self.load
22
25
  Aro::Db.configure_logger
23
- if Aro::Mancy.in_aro?
24
- self.instance.setup_local_aro
26
+ Mutex.new.synchronize do
27
+ if Aro::Mancy.in_aro?
28
+ self.instance.setup_local_aro
29
+ end
25
30
  end
26
31
  end
27
32
 
28
33
  def self.configure_logger
29
- if Aro::Config.ivar(:LOG_ARO_DB).to_s == Aro::Config::BOOLS[:TRUE].to_s
34
+ if Aos::Cor.ivar(:LOG_ARO_DB).to_s == Aos::Cor::BOOLS[:TRUE].to_s
30
35
  ActiveRecord::Base.logger = Logger.new(STDOUT)
31
36
  else
32
37
  ActiveRecord::Base.logger = nil
@@ -35,11 +40,13 @@ module Aro
35
40
 
36
41
  def self.base_aro_dir
37
42
  base_aro_file = Aro::Mancy::ARO_FILE.to_s
38
- Aro::Config.is_test? ? "#{base_aro_file}_test" : base_aro_file
43
+ return "#{base_aro_file}_#{Aos::Cor::ENVS[:TEST]}" if Aos::Cor.is_test?
44
+
45
+ base_aro_file
39
46
  end
40
47
 
41
48
  def db_config_filepath
42
- File.join(Aro::Db.base_aro_dir, Aro::Db::DATABASE_YML.to_s)
49
+ @db_config_filepath ||= File.join(Aro::Db.base_aro_dir, Aro::Db::DATABASE_YML.to_s)
43
50
  end
44
51
 
45
52
  def setup_local_aro
@@ -48,6 +55,7 @@ module Aro
48
55
 
49
56
  # create local .aro/ directory
50
57
  unless File.exist?(Aro::Db.base_aro_dir)
58
+ Aro::P.say("creating #{Aro::Mancy::ARO_FILE.to_s} directory...")
51
59
  FileUtils.mkdir(Aro::Db.base_aro_dir)
52
60
  end
53
61
 
@@ -57,18 +65,19 @@ module Aro
57
65
  adapter: :sqlite3.to_s,
58
66
  database: File.join(Aro::Db.base_aro_dir, Aro::Db::SQL_FILE.to_s),
59
67
  username: name,
60
- password: name
68
+ password: name,
69
+ pool: Aos::Os::DB_POOL
61
70
  }.to_yaml
62
71
  File.open(db_config_filepath, "w") do |file|
63
72
  file.write(c)
64
73
  end
65
74
  end
66
75
 
67
- connect(name)
76
+ connect
68
77
  migrate(name)
69
78
  end
70
79
 
71
- def connect(name)
80
+ def connect
72
81
  ActiveRecord::Base.establish_connection(
73
82
  YAML.load_file(db_config_filepath)
74
83
  )
@@ -77,8 +86,8 @@ module Aro
77
86
  def migrate(name)
78
87
  local_migrate_dir = File.join(Aro::Db.base_aro_dir, Aro::Db::MIGRATIONS_DIR.to_s)
79
88
  unless Dir.exist?(local_migrate_dir)
80
- gem_dir = Dir[Gem.loaded_specs[:aro.to_s]&.full_gem_path || '.'].first
81
- FileUtils.cp_r(File.join(gem_dir, Aro::Db::GEM_DB_PATH.to_s), Aro::Db::base_aro_dir)
89
+ gem_dir = Dir[Reiquire::GEM_PATH || '.'].first
90
+ FileUtils.cp_r(File.join(gem_dir, Aro::Db::GEM_DB_PATH.to_s), Aro::Db.base_aro_dir)
82
91
  end
83
92
 
84
93
  migration_version = Dir["#{local_migrate_dir}/*.rb"].map{|n|
data/sys/aro/mancy.rb CHANGED
@@ -12,7 +12,7 @@ module Aro
12
12
  class Mancy
13
13
  include Singleton
14
14
 
15
- attr_accessor :game
15
+ attr_accessor :current
16
16
 
17
17
  O = 0
18
18
  S = 1
@@ -21,14 +21,12 @@ module Aro
21
21
  N = 4
22
22
  V = 5
23
23
  PS1 = :">[#{Aro::Mancy.name}]>: "
24
- NAME_FILE = :".name"
24
+ NAME_FILE = :".aro_space"
25
25
  ARO_FILE = :".aro"
26
26
  I2097I = :i2097i
27
27
  YES = :aroyes
28
28
  ALL = :all
29
29
 
30
- ARO_ENV_DEBUG_MODES = [:development, :test]
31
-
32
30
  NUMERALS = {
33
31
  O: 0,
34
32
  I: 1,
@@ -55,20 +53,16 @@ module Aro
55
53
  XXII: 22,
56
54
  XXXVII: 37,
57
55
  XLII: 42,
56
+ LX: 60,
58
57
  C: 100,
59
58
  MMXCVII: Aro::Mancy::I2097I[Aro::Mancy::S..Aro::Mancy::N].to_i,
60
59
  }
61
60
 
62
- def initialize
61
+ def self.teck
63
62
  if Aro::Mancy.in_aro? && Aro::Mancy.is_initialized?
64
- Aro::Config.instance.load
65
- Aro::Mancy.init
66
- self.game = Aro::Teck.current_teck
63
+ self.instance.current = Aro::Teck.current_teck
67
64
  end
68
- end
69
-
70
- def self.game
71
- Aro::Mancy.instance.game
65
+ self.instance.current
72
66
  end
73
67
 
74
68
  def self.create(name)
@@ -77,7 +71,6 @@ module Aro
77
71
  # explicitly only allow String/Symbol types for name
78
72
  return false unless name.kind_of?(String) || name.kind_of?(Symbol)
79
73
  name = name.to_s.strip
80
-
81
74
  # create the new aro directory and database
82
75
  if !Dir.exist?(name)
83
76
  Aro::P.say(I18n.t("cli.messages.no_tecks"))
@@ -86,18 +79,23 @@ module Aro
86
79
  return false
87
80
  end
88
81
 
89
- # create name file
90
- File.open(File.join(name, Aro::Mancy::NAME_FILE.to_s), "w+") do |file|
91
- file.write(name)
92
- end
93
-
94
82
  Dir.chdir(name) do
83
+ Aos::Cor.instance.load
95
84
  Aro::Mancy.init
96
85
  end
97
86
  return true
98
87
  end
99
88
 
100
89
  def self.init
90
+ unless Aro::Mancy.in_aro? || Aos::Cor.is_test?
91
+ Aro::P.say("init aro running in present directory...")
92
+ new_name = File.basename(Dir.pwd)
93
+ Aro::P.say("echo #{new_name} > #{Aro::Mancy::NAME_FILE.to_s}")
94
+ File.open(Aro::Mancy::NAME_FILE.to_s, "w") do |file|
95
+ file.write(new_name)
96
+ end
97
+ end
98
+
101
99
  Aro::Db.load
102
100
  end
103
101
 
@@ -114,8 +112,6 @@ module Aro
114
112
  end
115
113
 
116
114
  def self.aro_mancy_name
117
- return nil unless Aro::Mancy.in_aro?
118
-
119
115
  File.read(Aro::Mancy::NAME_FILE.to_s).strip
120
116
  end
121
117
  end
@@ -0,0 +1,13 @@
1
+ =begin
2
+
3
+ aro/base_model.rb
4
+
5
+ aro base_model object.
6
+
7
+ by i2097i
8
+
9
+ =end
10
+
11
+ class Aro::BaseModel < ActiveRecord::Base
12
+
13
+ end