aro 0.2.5 → 0.2.6

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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.ruby-version +1 -0
  4. data/Gemfile.lock +106 -89
  5. data/aro.gemspec +10 -11
  6. data/bin/oss_om +15 -0
  7. data/checksums/aro-0.2.5.gem.sha512 +1 -0
  8. data/checksums/aro-0.2.6.gem.sha512 +1 -0
  9. data/locale/en.cards.yml +1 -1
  10. data/locale/en.cmd.yml +34 -0
  11. data/locale/en.cor.yml +5 -8
  12. data/locale/en.menu_items.yml +2 -0
  13. data/locale/en.menus.yml +2 -0
  14. data/locale/en.usage.yml +21 -98
  15. data/locale/en.yml +61 -50
  16. data/sys/aro/cmd.rb +96 -0
  17. data/sys/{aos → aro}/cor.rb +224 -268
  18. data/sys/aro/d.rb +4 -3
  19. data/sys/aro/db/migrate/.DS_Store +0 -0
  20. data/sys/aro/db/migrate/1793913747_create_data_bases.rb +13 -0
  21. data/sys/aro/db/migrate/1793913777_create_data_base_directories.rb +14 -0
  22. data/sys/aro/db/migrate/1793913796_create_data_base_files.rb +12 -0
  23. data/sys/aro/db/migrate/1793913841_create_menus.rb +11 -0
  24. data/sys/aro/db/migrate/1793913861_create_menu_items.rb +14 -0
  25. data/sys/aro/db.rb +72 -33
  26. data/sys/aro/designer.rb +281 -0
  27. data/sys/aro/locale.rb +136 -0
  28. data/sys/aro/ma_ain.rb +54 -0
  29. data/sys/aro/mancy.rb +53 -28
  30. data/sys/aro/models/concerns/.keep +0 -0
  31. data/sys/aro/models/concerns/uuid.rb +29 -0
  32. data/sys/aro/models/data_base.rb +97 -0
  33. data/sys/aro/models/directory.rb +44 -0
  34. data/sys/aro/models/file.rb +27 -0
  35. data/sys/aro/models/menu.rb +27 -0
  36. data/sys/aro/models/menu_item.rb +47 -0
  37. data/sys/aro/models/teck.rb +19 -28
  38. data/sys/aro/p.rb +6 -3
  39. data/sys/aro/r.rb +1 -2
  40. data/sys/aro/store.rb +147 -0
  41. data/sys/aro/v.rb +2 -2
  42. data/sys/aro/views/base.rb +25 -0
  43. data/sys/aro/views/teck.rb +30 -0
  44. data/sys/aro.rb +1 -2
  45. data/sys/cli/constants.rb +1 -6
  46. data/sys/cli/create.rb +3 -3
  47. data/sys/cli/nterface.rb +8 -8
  48. data/sys/cli/teck.rb +17 -18
  49. data/sys/cli/usage.rb +4 -8
  50. data/sys/cli.rb +0 -1
  51. data/sys/reiquire.rb +146 -25
  52. data/sys/shr/.DS_Store +0 -0
  53. data/sys/shr/prompt.rb +8 -2
  54. data/sys/shr/t.rb +5 -5
  55. data/sys/shr/version.rb +9 -2
  56. data/tasks/make.rake +2 -1
  57. metadata +53 -116
  58. data/bin/aos +0 -31
  59. data/bin/aro +0 -50
  60. data/bin/ino +0 -22
  61. data/ino_rules_todo.txt +0 -28
  62. data/locale/en.abot.yml +0 -81
  63. data/locale/en.amg.yml +0 -44
  64. data/locale/en.aos.yml +0 -40
  65. data/locale/en.data.yml +0 -30
  66. data/locale/en.dom.yml +0 -47
  67. data/locale/en.flie.yml +0 -29
  68. data/locale/en.ino.yml +0 -9
  69. data/sys/aos/abot.rb +0 -254
  70. data/sys/aos/amg.rb +0 -184
  71. data/sys/aos/aos.rb +0 -672
  72. data/sys/aos/data.rb +0 -117
  73. data/sys/aos/db/migrate/1765148774_create_yous.rb +0 -20
  74. data/sys/aos/db/migrate/1765762724_create_ilibs.rb +0 -22
  75. data/sys/aos/db/migrate/1765907766_create_ilogs.rb +0 -18
  76. data/sys/aos/db/migrate/1765933985_create_agodos.rb +0 -22
  77. data/sys/aos/db/migrate/1766203888_create_fpxies.rb +0 -18
  78. data/sys/aos/db.rb +0 -105
  79. data/sys/aos/flie.rb +0 -144
  80. data/sys/aos/models/agodo.rb +0 -103
  81. data/sys/aos/models/fpxy.rb +0 -26
  82. data/sys/aos/models/ilib.rb +0 -46
  83. data/sys/aos/models/ilog.rb +0 -27
  84. data/sys/aos/models/you.rb +0 -138
  85. data/sys/aos/s.rb +0 -26
  86. data/sys/aos/vws/base.rb +0 -159
  87. data/sys/aos/vws/dom.rb +0 -32
  88. data/sys/aos/vws/games/abot.rb +0 -21
  89. data/sys/aos/vws/games/ino.rb +0 -21
  90. data/sys/aos/vws/games/teck.rb +0 -122
  91. data/sys/aos/vws/games.rb +0 -19
  92. data/sys/aos/vws/home.rb +0 -23
  93. data/sys/aos/vws/know/body.rb +0 -19
  94. data/sys/aos/vws/know/mind.rb +0 -19
  95. data/sys/aos/vws/know/spirit.rb +0 -19
  96. data/sys/aos/vws/know.rb +0 -19
  97. data/sys/aos/vws/root/amg.rb +0 -21
  98. data/sys/aos/vws/root/config.rb +0 -21
  99. data/sys/aos/vws/root/data.rb +0 -21
  100. data/sys/aos/vws/root/flie.rb +0 -21
  101. data/sys/aos/vws/root.rb +0 -19
  102. data/sys/aos/vws/welcome/waite.rb +0 -31
  103. data/sys/aos/vws/welcome/winner.rb +0 -19
  104. data/sys/aos/vws/welcome.rb +0 -66
  105. data/sys/aro/db/migrate/1768856981_create_scrolls.rb +0 -20
  106. data/sys/aro/db/migrate/1768858841_create_legends.rb +0 -16
  107. data/sys/aro/db/migrate/1768858967_create_stories.rb +0 -17
  108. data/sys/aro/db/migrate/1768859060_create_chapters.rb +0 -15
  109. data/sys/aro/db/migrate/1768859126_create_statements.rb +0 -22
  110. data/sys/aro/db/migrate/1768859144_create_players.rb +0 -18
  111. data/sys/aro/ino.rb +0 -64
  112. data/sys/aro/models/chapter.rb +0 -18
  113. data/sys/aro/models/legend.rb +0 -28
  114. data/sys/aro/models/player.rb +0 -17
  115. data/sys/aro/models/scroll.rb +0 -46
  116. data/sys/aro/models/statement.rb +0 -14
  117. data/sys/aro/models/story.rb +0 -28
  118. data/sys/cli/dom.rb +0 -43
  119. data/sys/dom/d.rb +0 -138
  120. data/sys/dom/dom.rb +0 -215
  121. data/sys/dom/p.rb +0 -17
  122. data/sys/fpx.rb +0 -104
  123. data/sys/shr/ilib/crs/CMakeLists.txt +0 -12
  124. data/sys/shr/ilib/crs/compile.sh +0 -5
  125. data/sys/shr/ilib/crs/crs.c +0 -24
  126. data/sys/shr/ilib/crs/crs.o +0 -0
  127. data/sys/shr/ilib/crs/libcrs.so +0 -0
data/sys/aos/data.rb DELETED
@@ -1,117 +0,0 @@
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
- ilogs = Aos::Ilog.all
86
- unless ilogs.any?
87
- lines << I18n.t("data.messages.no_ilogs")
88
- else
89
- lines << I18n.t("data.messages.listing_ilogs")
90
- ilogs.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
@@ -1,20 +0,0 @@
1
- class CreateYous < ActiveRecord::Migration[8.1]
2
-
3
- def self.up
4
- create_table :yous do |t|
5
- t.string :name, null: false
6
- t.string :pwd
7
- t.integer :access, default: Aro::Mancy::S
8
-
9
- t.timestamps
10
-
11
- t.index :name, unique: true
12
- end
13
- end
14
-
15
- def self.down
16
- remove_index :yous, :name
17
- drop_table :yous
18
- end
19
-
20
- end
@@ -1,22 +0,0 @@
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
@@ -1,18 +0,0 @@
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
@@ -1,22 +0,0 @@
1
- class CreateAgodos < ActiveRecord::Migration[8.1]
2
-
3
- def self.up
4
- create_table :agodos do |t|
5
- t.integer :power, default: Aro::Mancy::O
6
- t.belongs_to :you, null: false, foreign_key: true
7
- t.string :home
8
- t.string :go, null: false
9
- t.string :do, null: false, default: ""
10
-
11
- # rate is commands-per-minute (default 1)
12
- t.integer :rate, default: Aro::Mancy::S
13
-
14
- t.timestamps
15
- end
16
- end
17
-
18
- def self.down
19
- drop_table :agodos
20
- end
21
-
22
- end
@@ -1,18 +0,0 @@
1
- class CreateFpxies < ActiveRecord::Migration[8.1]
2
-
3
- def self.up
4
- create_table :fpxies do |t|
5
- t.belongs_to :you, null: false, foreign_key: true
6
- t.string :cmd, null: false
7
-
8
- t.timestamps
9
- end
10
-
11
- add_index :fpxies, [:you_id, :cmd], unique: true
12
- end
13
-
14
- def self.down
15
- drop_table :fpxies
16
- end
17
-
18
- end
data/sys/aos/db.rb DELETED
@@ -1,105 +0,0 @@
1
- =begin
2
-
3
- db.rb
4
-
5
- database for aos.
6
-
7
- by i2097i
8
-
9
- =end
10
-
11
- module Aos
12
- class Db
13
- include Singleton
14
-
15
- DATABASE_YML = :"database.yml"
16
- GEM_DB_PATH = :"sys/aos/db"
17
- MIGRATIONS_DIR = :"db/migrate"
18
- SCHEMA_FILE = :"schema.rb"
19
- SQL_FILE = :"aos.sql"
20
-
21
- def self.load(password = nil)
22
- Mutex.new.synchronize do
23
- if Aro::Dom.in_arodom?
24
- Aos::Db.configure_logger
25
- self.instance.set_up_aos(password)
26
- end
27
- end
28
- end
29
-
30
- def self.configure_logger
31
- if Aos::Cor.ivar(:LOG_AOS_DB).to_s == Aos::Cor::BOOLS[:TRUE].to_s
32
- ActiveRecord::Base.logger = Logger.new(STDOUT)
33
- else
34
- ActiveRecord::Base.logger = nil
35
- end
36
- end
37
-
38
- def self.base_aro_dir
39
- File.join(Aro::Dom.dom_root, Aro::Dom.room_path(:data))
40
- end
41
-
42
- def db_config_filepath
43
- # intentionally using Aro::Db::DATABASE_YML here
44
- @db_config_filepath = File.join(Aos::Db.base_aro_dir, Aro::Db::DATABASE_YML.to_s)
45
- end
46
-
47
- def set_up_aos(password)
48
- ActiveRecord::Base.connection_pool.flush! unless password.nil?
49
- # create local /.ethergeist directory
50
- unless File.exist?(Aos::Db.base_aro_dir)
51
- FileUtils.mkdir(Aos::Db.base_aro_dir)
52
- end
53
-
54
- unless File.exist?(db_config_filepath)
55
- unless password.nil?
56
- Aro::D.say("creating database: #{db_config_filepath}")
57
- # create database config yaml file
58
- db_file_path = File.join(Aos::Db.base_aro_dir, Aos::Db::SQL_FILE.to_s)
59
- File.open(db_config_filepath, "w") do |file|
60
- file.write({
61
- adapter: :sqlite3.to_s,
62
- database: db_file_path,
63
- username: Aro::Dom.ethergeist_name,
64
- password: password,
65
- pool: Aos::Os::DB_POOL
66
- }.to_yaml)
67
- end
68
- else
69
- Aro::D.say("unable to create database without root password.")
70
- end
71
- end
72
-
73
- if File.exist?(db_config_filepath)
74
- connect
75
- migrate
76
- else
77
- Aro::D.say("unable to set up database without root password.")
78
- end
79
- end
80
-
81
- def connect
82
- ActiveRecord::Base.establish_connection(
83
- YAML.load_file(db_config_filepath)
84
- )
85
- end
86
-
87
- def migrate
88
- local_migrate_dir = File.join(Aos::Db.base_aro_dir, Aro::Db::MIGRATIONS_DIR.to_s)
89
- unless Dir.exist?(local_migrate_dir)
90
- gem_dir = Dir[Reiquire::GEM_PATH || '.'].first
91
- FileUtils.cp_r(File.join(gem_dir, Aos::Db::GEM_DB_PATH.to_s), Aos::Db::base_aro_dir)
92
- end
93
-
94
- migration_version = Dir["#{local_migrate_dir}/*.rb"].map{|n|
95
- Pathname.new(n).basename.to_s.split("_")[0].to_i
96
- }.max
97
- ActiveRecord::MigrationContext.new(local_migrate_dir).migrate(migration_version)
98
-
99
- filename = File.join(Aos::Db.base_aro_dir, Aro::Db::SCHEMA_FILE.to_s)
100
- File.open(filename, "w+") do |f|
101
- ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection_pool, f)
102
- end
103
- end
104
- end
105
- end
data/sys/aos/flie.rb DELETED
@@ -1,144 +0,0 @@
1
- =begin
2
-
3
- flie.rb
4
-
5
- aos flie management.
6
-
7
- by i2097i
8
-
9
- =end
10
-
11
- module Aos
12
- class Flie
13
- include Singleton
14
-
15
- attr_accessor :display_lines, :pxy_running
16
-
17
- CMDS = {
18
- PXY: {
19
- key: :pxy,
20
- description: I18n.t("flie.commands.description.pxy"),
21
- usage: I18n.t("flie.commands.usage.pxy"),
22
- },
23
- }
24
-
25
- def initialize
26
- self.pxy_running = false
27
- self.display_lines = Aos::Flie.base_lines
28
- end
29
-
30
- PXY_CMDS = {
31
- CREATE: :create,
32
- LIST: :list,
33
- DEREZ: :derez,
34
- HELP: :help,
35
- EXIT: :exit,
36
- }
37
- def self.pxy
38
- Aos::Os.say(I18n.t("flie.messages.enter_email"))
39
- Aos::Os.say("\n")
40
- em = Aos::S.p.ask("#{Aos::Os::PS1}")
41
- if you = Aos::You.find_by(name: em)
42
- Aos::Os.instance.display_lines = []
43
- self.instance.pxy_running = true
44
- self.instance.display_lines = [I18n.t("flie.messages.pxy_starting")]
45
- while self.instance.pxy_running
46
- answer = Aos::S.p.select(
47
- Aos::Os::PS1.to_s + I18n.t("flie.messages.main_menu", name: you.name),
48
- Aos::Flie::PXY_CMDS,
49
- default: Aro::Mancy::S
50
- )
51
-
52
- case answer.to_sym
53
- when Aos::Flie::PXY_CMDS[:CREATE]
54
- Aos::Os.say(I18n.t("flie.messages.enter_cmd"))
55
- Aos::Os.say("\n")
56
- cmd = Aos::S.p.ask("#{Aos::Os::PS1}")
57
- you.fpxies.create(cmd: cmd)
58
- self.instance.display_lines = you.fpxies.map{|f| f.get_lines.join("\n")}
59
- when Aos::Flie::PXY_CMDS[:LIST]
60
- if you.fpxies.any?
61
- self.instance.display_lines = you.fpxies.map{|f| f.get_lines.join("\n")}
62
- else
63
- self.instance.display_lines = [I18n.t("flie.messages.no_fpxies")]
64
- end
65
- when Aos::Flie::PXY_CMDS[:DEREZ]
66
- unless you.fpxies.any?
67
- self.instance.display_lines = [I18n.t("flie.messages.no_fpxies")]
68
- else
69
- derez_answer = Aos::S.p.select(
70
- Aos::Os::PS1.to_s + I18n.t("flie.messages.derez_menu"),
71
- ([[:cancel, Aro::Mancy::O]] + you.fpxies.map{|f| [f.cmd, f.id]}).to_h,
72
- default: Aro::Mancy::S
73
- )
74
- unless derez_answer == Aro::Mancy::O
75
- you.fpxies.find_by(id: derez_answer)&.destroy
76
- you.reload
77
- self.instance.display_lines = [I18n.t("flie.messages.fpxy_derez_success")]
78
- end
79
- end
80
- when Aos::Flie::PXY_CMDS[:HELP]
81
- Aos::Flie.flie
82
- when Aos::Flie::PXY_CMDS[:EXIT]
83
- self.instance.pxy_running = false
84
- end
85
-
86
- Aos::Os.instance.render
87
- end
88
-
89
- # exit display
90
- Aos::Flie.flie
91
- self.instance.display_lines += [I18n.t("flie.messages.pxy_exited")]
92
- else
93
- self.instance.display_lines += [I18n.t("flie.messages.invalid_email")]
94
- end
95
-
96
- end
97
-
98
- def self.pxies(email_address)
99
- self.instance.get_pxies_for_email_address(email_address)
100
- end
101
-
102
- def get_pxies_for_email_address(email_address)
103
- you = Aos::You.find_by(name: email_address)
104
- return you.fpxies.to_a unless you.nil?
105
- return []
106
- end
107
-
108
- def self.flie
109
- self.instance.display_lines = Aos::Flie.base_lines
110
- end
111
-
112
- def self.process_cmd(args)
113
- self.instance.display_lines = []
114
- if args[Aro::Mancy::S].nil? ||
115
- CLI::FLAGS[:HELP].include?(args[Aro::Mancy::S].to_sym)
116
- Aos::Flie.flie
117
- return true
118
- end
119
-
120
- case args[Aro::Mancy::S].to_sym
121
- when Aos::Flie::CMDS[:PXY][:key]
122
- Aos::Flie.pxy
123
- return true
124
- end
125
-
126
- return false
127
- end
128
-
129
- def self.base_lines
130
- # print flie commands
131
- lines = []
132
- lines << ""
133
- lines << I18n.t("aos.constants.commands")
134
- lines += Aos::Vw::Base.lines_for_cmd(Aos::Os::CMDS[:FLIE])
135
- lines << I18n.t("aos.constants.subcommands")
136
- Aos::Flie::CMDS.keys.each{|k|
137
- lines += Aos::Vw::Base.lines_for_cmd(Aos::Flie::CMDS[k])
138
- }
139
- lines << ""
140
-
141
- lines
142
- end
143
- end
144
- end
@@ -1,103 +0,0 @@
1
- =begin
2
-
3
- agodo.rb
4
-
5
- agodo object.
6
-
7
- by i2097i
8
-
9
- =end
10
-
11
- require :base64.to_s
12
-
13
- class Aos::Agodo < ActiveRecord::Base
14
- belongs_to :you
15
- validate :run_validations
16
-
17
- enum :power, [
18
- :off,
19
- :on
20
- ]
21
-
22
- def godo
23
- godos_per_minute = Aro::Mancy::NUMERALS[:LX].to_f / rate.to_f
24
- # todo: this is awful
25
- if Time.now - updated_at >= godos_per_minute
26
- system("#{:aos} #{self.go} #{Aos::Os::YOU_FLAG} #{self.you.name}")
27
- system("#{:aos} #{self.do.gsub("_", " ")} #{Aos::Os::YOU_FLAG} #{self.you.name}")
28
- system("#{:aos} #{self.home.nil? ? "cd" : self.home} #{Aos::Os::YOU_FLAG} #{self.you.name}")
29
- reload.touch
30
- end
31
- end
32
-
33
- def get_lines
34
- [
35
- I18n.t(
36
- "abot.agodo.display",
37
- power: Aos::Agodo::powers[self.power],
38
- go: self.go,
39
- do: self.do,
40
- rate: self.rate,
41
- home: self.home.nil? ? "/" : Aos::Os.osify(self.home)
42
- )
43
- ]
44
- end
45
-
46
- def create_home_directory
47
- Aro::Dom.instance.generate_agodo_home(self)
48
- end
49
-
50
- def home
51
- File.join(Aro::Dom.room_path(Aro::Dom::ABOT), Aos::Abot::AGODOS_DIR.to_s, self.you.name)
52
- end
53
-
54
- private
55
-
56
- def create_you
57
- # todo: deal with potential name clashes
58
- self.you = Aos::You.create(
59
- access: :agodo,
60
- pwd: Aos::Os.instance.you.pwd,
61
- name: [
62
- Aro::T.read_dev_tarot(false),
63
- Aro::T.summon_ruby_facot(false),
64
- rand(99..999)
65
- ].join("_").strip
66
- )
67
- self.home = self.you.pwd.split("/").last
68
- if self.home == Aro::Dom.ethergeist_name
69
- self.home = nil
70
- end
71
- Aro::P.say("spawned agodo named #{you.name}")
72
- end
73
-
74
- def run_validations
75
- # validate args
76
- room_path = Aro::Dom.room_path(self.go)
77
- unless !room_path.nil? && !room_path.empty?
78
- errors.add(
79
- :go,
80
- :invalid,
81
- message: I18n.t("abot.messages.invalid_go")
82
- )
83
- end
84
-
85
- # unless errors.empty? && Aos::Os.is_aos_command?(self.do)
86
- # errors.add(
87
- # :do,
88
- # :invalid,
89
- # message: I18n.t("abot.messages.invalid_do")
90
- # )
91
- # end
92
-
93
- unless errors.empty? && Aos::Cor.int_valid?(self.rate)
94
- errors.add(
95
- :rate,
96
- :invalid,
97
- message: I18n.t("abot.messages.invalid_rate")
98
- )
99
- end
100
-
101
- create_you if self.you.nil? && errors.empty?
102
- end
103
- end
@@ -1,26 +0,0 @@
1
- =begin
2
-
3
- fpxy.rb
4
-
5
- aos fpxy object.
6
-
7
- by i2097i
8
-
9
- =end
10
-
11
- module Aos
12
- class Fpxy < ActiveRecord::Base
13
- # table_name :fpxies
14
- belongs_to :you
15
-
16
- def get_lines
17
- [
18
- I18n.t(
19
- "flie.fpxies.display",
20
- you: self.you.name.ljust(Aro::Mancy::NUMERALS[:XIV]),
21
- cmd: self.cmd.ljust(Aro::Mancy::NUMERALS[:XXXVII])
22
- )
23
- ]
24
- end
25
- end
26
- end
@@ -1,46 +0,0 @@
1
- =begin
2
-
3
- ilib.rb
4
-
5
- aos ilib object.
6
-
7
- by i2097i
8
-
9
- =end
10
-
11
- # installed lib modules section
12
-
13
- module CRS
14
- SO_FILE = :"libcrs.so".to_s
15
- SO_PATH = File.join(
16
- Reiquire::GEM_PATH,
17
- :"sys/shr/ilib/crs".to_s,
18
- CRS::SO_FILE
19
- )
20
- extend FFI::Library
21
- ffi_lib CRS::SO_PATH
22
- attach_function :hello, [], :string
23
- end
24
-
25
- # installed lib modules section
26
-
27
- class Aos::Ilib < ActiveRecord::Base
28
- before_create :set_so_path
29
-
30
- enum :status, [
31
- :available,
32
- :installed,
33
- ]
34
-
35
- def usage
36
- # todo: each ffi lib should expose a 'usage' method
37
- CRS.hello.strip
38
- end
39
-
40
- private
41
-
42
- def set_so_path
43
- # todo make configurable for other modules
44
- self.so_path = CRS::SO_PATH
45
- end
46
- end
@@ -1,27 +0,0 @@
1
- =begin
2
-
3
- ilog.rb
4
-
5
- aos ilog object.
6
-
7
- by i2097i
8
-
9
- =end
10
-
11
- module Aos
12
- class Ilog < ActiveRecord::Base
13
- belongs_to :you
14
-
15
- def get_lines
16
- [
17
- I18n.t(
18
- "data.ilogs.display",
19
- you: self.you.name.ljust(Aro::Mancy::NUMERALS[:XIV]),
20
- cmd: self.cmd.ljust(Aro::Mancy::NUMERALS[:XXXVII]),
21
- timestamp: self.created_at.strftime(Aos::Os::DATE_FORMAT),
22
- pwd: Aos::Os.osify(self.pwd).ljust(Aro::Mancy::NUMERALS[:XIV])
23
- )
24
- ]
25
- end
26
- end
27
- end