aro 0.2.1 → 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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/aro.gemspec +3 -3
- data/bin/aos +10 -3
- data/bin/aro +18 -11
- data/checksums/aro-0.2.1.gem.sha512 +1 -0
- data/checksums/aro-0.2.2.gem.sha512 +1 -0
- data/checksums/aro-0.2.3.gem.sha512 +1 -0
- data/locale/en.abot.yml +81 -0
- data/locale/en.amg.yml +44 -0
- data/locale/en.aos.yml +8 -38
- data/locale/en.cor.yml +47 -0
- data/locale/en.data.yml +30 -0
- data/locale/en.dom.yml +22 -18
- data/locale/en.flie.yml +29 -0
- data/locale/en.usage.yml +39 -26
- data/locale/en.yml +10 -51
- data/sys/aos/abot.rb +256 -0
- data/sys/aos/amg.rb +58 -56
- data/sys/aos/aos.rb +425 -180
- data/sys/aos/cor.rb +773 -0
- data/sys/aos/data.rb +117 -0
- data/sys/aos/db/migrate/1765148774_create_yous.rb +1 -0
- data/sys/aos/db/migrate/{1765762724_create_libs.rb → 1765762724_create_ilibs.rb} +5 -5
- data/sys/aos/db/migrate/1765907766_create_ilogs.rb +18 -0
- data/sys/aos/db/migrate/1765933985_create_agodos.rb +22 -0
- data/sys/aos/db/migrate/1766203888_create_fpxies.rb +18 -0
- data/sys/aos/db.rb +47 -27
- data/sys/aos/flie.rb +144 -0
- data/sys/aos/models/agodo.rb +96 -0
- data/sys/aos/models/base_model.rb +13 -0
- data/sys/aos/models/fpxy.rb +28 -0
- data/sys/{shr/lib/lib.rb → aos/models/ilib.rb} +11 -6
- data/sys/aos/models/ilog.rb +29 -0
- data/sys/aos/models/you.rb +98 -0
- data/sys/aos/s.rb +2 -1
- data/sys/aos/vws/base.rb +69 -78
- data/sys/aos/vws/dom.rb +1 -2
- data/sys/aos/vws/games/abot.rb +21 -0
- data/sys/aos/vws/games/{game.rb → teck.rb} +27 -24
- data/sys/aos/vws/home.rb +23 -0
- data/sys/aos/vws/know/{temple.rb → body.rb} +3 -3
- data/sys/aos/vws/know/{library.rb → mind.rb} +3 -3
- data/sys/aos/vws/know/spirit.rb +19 -0
- data/sys/aos/vws/{setup → root}/amg.rb +1 -2
- data/sys/aos/vws/{setup → root}/config.rb +4 -4
- data/sys/aos/vws/root/data.rb +21 -0
- data/sys/aos/vws/root/flie.rb +21 -0
- data/sys/aos/vws/{setup.rb → root.rb} +3 -3
- data/sys/aos/vws/welcome/waite.rb +1 -0
- data/sys/aos/vws/welcome.rb +47 -0
- data/sys/aro/d.rb +4 -2
- data/sys/aro/db/migrate/{1763374647_create_decks.rb → 1763374647_create_tecks.rb} +5 -5
- data/sys/aro/db/migrate/1763432541_create_tlogs.rb +20 -0
- data/sys/aro/db.rb +28 -19
- data/sys/aro/mancy.rb +18 -22
- data/sys/aro/models/base_model.rb +13 -0
- data/sys/{models/deck.rb → aro/models/teck.rb} +60 -57
- data/sys/aro/models/tlog.rb +21 -0
- data/sys/aro/p.rb +1 -1
- data/sys/aro/r.rb +2 -1
- data/sys/aro/v.rb +2 -2
- data/sys/cli/constants.rb +4 -10
- data/sys/cli/create.rb +2 -3
- data/sys/cli/dom.rb +1 -2
- data/sys/cli/{deck.rb → teck.rb} +38 -45
- data/sys/cli.rb +10 -11
- data/sys/dom/d.rb +68 -46
- data/sys/dom/dom.rb +79 -44
- data/sys/dom/p.rb +1 -1
- data/sys/fpx.rb +116 -0
- data/sys/reiquire.rb +8 -8
- data/sys/shr/prompt.rb +2 -6
- data/sys/shr/t.rb +11 -13
- data/sys/shr/version.rb +1 -1
- data/tasks/make.rake +1 -1
- metadata +82 -62
- data/locale/en.cngelog.yml +0 -5
- data/sys/aos/vws/games/abpps.rb +0 -19
- data/sys/aos/vws/games/hbpps.rb +0 -19
- data/sys/aos/vws/games/shpps.rb +0 -19
- data/sys/aos/vws/games/vipps.rb +0 -19
- data/sys/aos/you.rb +0 -21
- data/sys/aro/db/migrate/1763432541_create_logs.rb +0 -20
- data/sys/dom/config.rb +0 -665
- data/sys/models/log.rb +0 -20
- /data/sys/shr/{lib → ilib}/crs/CMakeLists.txt +0 -0
- /data/sys/shr/{lib → ilib}/crs/compile.sh +0 -0
- /data/sys/shr/{lib → ilib}/crs/crs.c +0 -0
- /data/sys/shr/{lib → ilib}/crs/crs.o +0 -0
- /data/sys/shr/{lib → ilib}/crs/libcrs.so +0 -0
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
|
+
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,7 +1,7 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateIlibs < ActiveRecord::Migration[8.1]
|
|
2
2
|
|
|
3
3
|
def self.up
|
|
4
|
-
create_table :
|
|
4
|
+
create_table :ilibs do |t|
|
|
5
5
|
t.string :name, null: false
|
|
6
6
|
t.string :so_path, null: false
|
|
7
7
|
t.integer :status, default: Aro::Mancy::O
|
|
@@ -14,9 +14,9 @@ class CreateLibs < ActiveRecord::Migration[8.1]
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def self.down
|
|
17
|
-
remove_index :
|
|
18
|
-
remove_index :
|
|
19
|
-
drop_table :
|
|
17
|
+
remove_index :ilibs, :name
|
|
18
|
+
remove_index :ilibs, :so_path
|
|
19
|
+
drop_table :ilibs
|
|
20
20
|
end
|
|
21
21
|
|
|
22
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
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1,18 @@
|
|
|
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
CHANGED
|
@@ -9,21 +9,28 @@
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
11
|
module Aos
|
|
12
|
-
class Db
|
|
12
|
+
class Db
|
|
13
|
+
include Singleton
|
|
14
|
+
|
|
15
|
+
DATABASE_YML = :"database.yml"
|
|
13
16
|
GEM_DB_PATH = :"sys/aos/db"
|
|
17
|
+
MIGRATIONS_DIR = :"db/migrate"
|
|
18
|
+
SCHEMA_FILE = :"schema.rb"
|
|
14
19
|
SQL_FILE = :"aos.sql"
|
|
15
20
|
|
|
16
|
-
def
|
|
21
|
+
def self.load(password = nil)
|
|
17
22
|
Aos::Db.configure_logger
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
Mutex.new.synchronize do
|
|
24
|
+
if Aro::Dom.in_arodom?
|
|
25
|
+
self.instance.set_up_aos(password)
|
|
26
|
+
else
|
|
27
|
+
Aro::P.say(I18n.t("cli.errors.not_in_aro" , cmd: Aro::Dom.name))
|
|
28
|
+
end
|
|
22
29
|
end
|
|
23
30
|
end
|
|
24
31
|
|
|
25
32
|
def self.configure_logger
|
|
26
|
-
if
|
|
33
|
+
if Aos::Cor.ivar(:LOG_AOS_DB).to_s == Aos::Cor::BOOLS[:TRUE].to_s
|
|
27
34
|
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
|
28
35
|
else
|
|
29
36
|
ActiveRecord::Base.logger = nil
|
|
@@ -31,45 +38,58 @@ module Aos
|
|
|
31
38
|
end
|
|
32
39
|
|
|
33
40
|
def self.base_aro_dir
|
|
34
|
-
Aro::Dom.
|
|
41
|
+
File.join(Aro::Dom.dom_root, Aro::Dom.room_path(:data))
|
|
35
42
|
end
|
|
36
43
|
|
|
37
44
|
def db_config_filepath
|
|
38
45
|
# intentionally using Aro::Db::DATABASE_YML here
|
|
39
|
-
File.join(Aos::Db.base_aro_dir, Aro::Db::DATABASE_YML.to_s)
|
|
46
|
+
@db_config_filepath = File.join(Aos::Db.base_aro_dir, Aro::Db::DATABASE_YML.to_s)
|
|
40
47
|
end
|
|
41
48
|
|
|
42
|
-
def set_up_aos
|
|
43
|
-
|
|
44
|
-
return if name.nil?
|
|
45
|
-
|
|
49
|
+
def set_up_aos(password)
|
|
50
|
+
ActiveRecord::Base.connection_pool.flush! unless password.nil?
|
|
46
51
|
# create local /.ethergeist directory
|
|
47
52
|
unless File.exist?(Aos::Db.base_aro_dir)
|
|
48
53
|
FileUtils.mkdir(Aos::Db.base_aro_dir)
|
|
49
54
|
end
|
|
50
55
|
|
|
51
56
|
unless File.exist?(db_config_filepath)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
unless password.nil?
|
|
58
|
+
Aro::D.say("creating database: #{db_config_filepath}")
|
|
59
|
+
# create database config yaml file
|
|
60
|
+
db_file_path = File.join(Aos::Db.base_aro_dir, Aos::Db::SQL_FILE.to_s)
|
|
61
|
+
File.open(db_config_filepath, "w") do |file|
|
|
62
|
+
file.write({
|
|
63
|
+
adapter: :sqlite3.to_s,
|
|
64
|
+
database: db_file_path,
|
|
65
|
+
username: Aro::Dom.ethergeist_name,
|
|
66
|
+
password: password,
|
|
67
|
+
pool: Aos::Os::DB_POOL
|
|
68
|
+
}.to_yaml)
|
|
69
|
+
end
|
|
70
|
+
else
|
|
71
|
+
Aro::D.say("unable to create database without root password.")
|
|
62
72
|
end
|
|
63
73
|
end
|
|
64
74
|
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
if File.exist?(db_config_filepath)
|
|
76
|
+
connect
|
|
77
|
+
migrate
|
|
78
|
+
else
|
|
79
|
+
Aro::D.say("unable to set up database without root password.")
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def connect
|
|
84
|
+
ActiveRecord::Base.establish_connection(
|
|
85
|
+
YAML.load_file(db_config_filepath)
|
|
86
|
+
)
|
|
67
87
|
end
|
|
68
88
|
|
|
69
|
-
def migrate
|
|
89
|
+
def migrate
|
|
70
90
|
local_migrate_dir = File.join(Aos::Db.base_aro_dir, Aro::Db::MIGRATIONS_DIR.to_s)
|
|
71
91
|
unless Dir.exist?(local_migrate_dir)
|
|
72
|
-
gem_dir = Dir[
|
|
92
|
+
gem_dir = Dir[Reiquire::GEM_PATH || '.'].first
|
|
73
93
|
FileUtils.cp_r(File.join(gem_dir, Aos::Db::GEM_DB_PATH.to_s), Aos::Db::base_aro_dir)
|
|
74
94
|
end
|
|
75
95
|
|
data/sys/aos/flie.rb
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
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
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
agodo.rb
|
|
4
|
+
|
|
5
|
+
agodo object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require :base64.to_s
|
|
12
|
+
require_relative :"./base_model".to_s
|
|
13
|
+
|
|
14
|
+
class Aos::Agodo < ActiveRecord::Base
|
|
15
|
+
belongs_to :you
|
|
16
|
+
validate :run_validations
|
|
17
|
+
|
|
18
|
+
enum :power, [
|
|
19
|
+
:off,
|
|
20
|
+
:on
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
def godo
|
|
24
|
+
godos_per_minute = Aro::Mancy::NUMERALS[:LX].to_f / rate.to_f
|
|
25
|
+
|
|
26
|
+
if Time.now - updated_at >= godos_per_minute
|
|
27
|
+
system("#{:aos} #{self.go} #{Aos::Os::YOU_FLAG} #{self.you.name}")
|
|
28
|
+
system("#{:aos} #{self.do.gsub("_", " ")} #{Aos::Os::YOU_FLAG} #{self.you.name}")
|
|
29
|
+
system("#{:aos} #{self.home.nil? ? "cd" : self.home} #{Aos::Os::YOU_FLAG} #{self.you.name}")
|
|
30
|
+
reload.touch
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def get_lines
|
|
35
|
+
[
|
|
36
|
+
I18n.t(
|
|
37
|
+
"abot.agodo.display",
|
|
38
|
+
power: Aos::Agodo::powers[self.power],
|
|
39
|
+
go: self.go,
|
|
40
|
+
do: self.do,
|
|
41
|
+
rate: self.rate,
|
|
42
|
+
home: self.home.nil? ? "/" : Aos::Os.osify(self.home)
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def create_you
|
|
50
|
+
# todo: deal with potential name clashes
|
|
51
|
+
self.you = Aos::You.create(
|
|
52
|
+
access: :agodo,
|
|
53
|
+
pwd: Aos::Os.instance.you.pwd,
|
|
54
|
+
name: [
|
|
55
|
+
Aro::T.read_dev_tarot(false),
|
|
56
|
+
Aro::T.summon_ruby_facot(false),
|
|
57
|
+
rand(99..999)
|
|
58
|
+
].join("_").strip
|
|
59
|
+
)
|
|
60
|
+
self.home = self.you.pwd.split("/").last
|
|
61
|
+
if self.home == Aro::Dom.ethergeist_name
|
|
62
|
+
self.home = nil
|
|
63
|
+
end
|
|
64
|
+
Aro::P.say("spawned agodo named #{you.name}")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def run_validations
|
|
68
|
+
# validate args
|
|
69
|
+
room_path = Aro::Dom.room_path(self.go)
|
|
70
|
+
unless !room_path.nil? && !room_path.empty?
|
|
71
|
+
errors.add(
|
|
72
|
+
:go,
|
|
73
|
+
:invalid,
|
|
74
|
+
message: I18n.t("abot.messages.invalid_go")
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# unless errors.empty? && Aos::Os.is_aos_command?(self.do)
|
|
79
|
+
# errors.add(
|
|
80
|
+
# :do,
|
|
81
|
+
# :invalid,
|
|
82
|
+
# message: I18n.t("abot.messages.invalid_do")
|
|
83
|
+
# )
|
|
84
|
+
# end
|
|
85
|
+
|
|
86
|
+
unless errors.empty? && Aos::Cor.int_valid?(self.rate)
|
|
87
|
+
errors.add(
|
|
88
|
+
:rate,
|
|
89
|
+
:invalid,
|
|
90
|
+
message: I18n.t("abot.messages.invalid_rate")
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
create_you if self.you.nil? && errors.empty?
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
fpxy.rb
|
|
4
|
+
|
|
5
|
+
aos fpxy object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"./base_model".to_s
|
|
12
|
+
|
|
13
|
+
module Aos
|
|
14
|
+
class Fpxy < ActiveRecord::Base
|
|
15
|
+
# table_name :fpxies
|
|
16
|
+
belongs_to :you
|
|
17
|
+
|
|
18
|
+
def get_lines
|
|
19
|
+
[
|
|
20
|
+
I18n.t(
|
|
21
|
+
"flie.fpxies.display",
|
|
22
|
+
you: self.you.name.ljust(Aro::Mancy::NUMERALS[:XIV]),
|
|
23
|
+
cmd: self.cmd.ljust(Aro::Mancy::NUMERALS[:XXXVII])
|
|
24
|
+
)
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ilib.rb
|
|
4
4
|
|
|
5
|
-
aos
|
|
5
|
+
aos ilib object.
|
|
6
6
|
|
|
7
7
|
by i2097i
|
|
8
8
|
|
|
9
9
|
=end
|
|
10
10
|
|
|
11
|
-
# todo: put in separate file and require it
|
|
12
11
|
# installed lib modules section
|
|
13
12
|
|
|
13
|
+
require_relative :"./base_model".to_s
|
|
14
|
+
|
|
14
15
|
module CRS
|
|
15
16
|
SO_FILE = :"libcrs.so".to_s
|
|
16
|
-
SO_PATH = File.join(
|
|
17
|
+
SO_PATH = File.join(
|
|
18
|
+
Reiquire::GEM_PATH,
|
|
19
|
+
:"sys/shr/ilib/crs".to_s,
|
|
20
|
+
CRS::SO_FILE
|
|
21
|
+
)
|
|
17
22
|
extend FFI::Library
|
|
18
23
|
ffi_lib CRS::SO_PATH
|
|
19
24
|
attach_function :hello, [], :string
|
|
@@ -21,7 +26,7 @@ end
|
|
|
21
26
|
|
|
22
27
|
# installed lib modules section
|
|
23
28
|
|
|
24
|
-
class Aos::
|
|
29
|
+
class Aos::Ilib < ActiveRecord::Base
|
|
25
30
|
before_create :set_so_path
|
|
26
31
|
|
|
27
32
|
enum :status, [
|
|
@@ -37,7 +42,7 @@ class Aos::Lib < ActiveRecord::Base
|
|
|
37
42
|
private
|
|
38
43
|
|
|
39
44
|
def set_so_path
|
|
40
|
-
# todo make configurable
|
|
45
|
+
# todo make configurable for other modules
|
|
41
46
|
self.so_path = CRS::SO_PATH
|
|
42
47
|
end
|
|
43
48
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
ilog.rb
|
|
4
|
+
|
|
5
|
+
aos ilog object.
|
|
6
|
+
|
|
7
|
+
by i2097i
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require_relative :"./base_model".to_s
|
|
12
|
+
|
|
13
|
+
module Aos
|
|
14
|
+
class Ilog < ActiveRecord::Base
|
|
15
|
+
belongs_to :you
|
|
16
|
+
|
|
17
|
+
def get_lines
|
|
18
|
+
[
|
|
19
|
+
I18n.t(
|
|
20
|
+
"data.ilogs.display",
|
|
21
|
+
you: self.you.name.ljust(Aro::Mancy::NUMERALS[:XIV]),
|
|
22
|
+
cmd: self.cmd.ljust(Aro::Mancy::NUMERALS[:XXXVII]),
|
|
23
|
+
timestamp: self.created_at.strftime(Aos::Os::DATE_FORMAT),
|
|
24
|
+
pwd: Aos::Os.osify(self.pwd).ljust(Aro::Mancy::NUMERALS[:XIV])
|
|
25
|
+
)
|
|
26
|
+
]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|