Remove a couple of files that were accidentally introduced in the last commit

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-07-02 18:30:34 -07:00
parent f004b0ed01
commit 62a1064e87
2 changed files with 0 additions and 77 deletions

View File

@@ -1,37 +0,0 @@
defmodule Omnibot.Plugin.Meta do
defmodule Hooks do
defmacro __before_compile(_env) do
quote do
def children(_cfg), do: []
end
end
end
defmacro __using__([]) do
quote do
use Omnibot.Plugin.Base
use Supervisor
@behaviour Omnibot.Plugin.Meta
## Client API
def start_link(opts) do
Supervisor.start_link(opts)
end
## Server callbacks
def init(opts) do
cfg = opts[:cfg]
children = children(cfg)
Supervisor.init(children, opts)
end
defoverridable Omnibot.Plugin.Meta
@before_compile Omnibot.Plugin.Meta.Hooks
end
end
@callback children(cfg :: any) :: [{atom(), [{atom(), any}]}]
end

View File

@@ -1,40 +0,0 @@
defmodule Omnibot.Plugin.Supervisor do
defmacro __using__(_opts) do
quote do
import Omnibot.Plugin.Supervisor
alias Omnibot.Plugin
use Supervisor
@behaviour Omnibot.Plugin.Supervisor
def start_link(opts) do
Supervisor.start_link(__MODULE__, opts[:cfg], opts)
end
def init(_cfg) do
Supervisor.init(children(), strategy: :one_for_one)
end
end
end
@callback children() :: [any]
end
# TODO :
# - figure out the best way to allow for including of supervisors and agents into a bot module
# - have to `use Agent` both places, this is not optimal
# - probably just lacks child_spec/1 ?
# - Do away with actual Plugin.Agent set of functions (outside of macro),
# and make it behaviours + `use Plugin.Agent` instead?
# Allow for ergonomic supervisor declarations, maybe like:
#
# Plugin.supervisor [
# SomeAgent,
# SomeGenSever,
# SomeWorker,
# ], strategy: one_for_all
#
#
# And it implements all of the stuff for you? This may be too broad for how I'm doing things
# - rename MODULES to PLUGINS