Current section

Files

Jump to
sagents lib mix tasks sagents gen persistence context.ex
Raw

lib/mix/tasks/sagents/gen/persistence/context.ex

defmodule Mix.Sagents.Gen.Persistence.Context do
@moduledoc false
alias Mix.Sagents.Gen.Persistence.Template
def generate(config) do
path = context_path(config)
content = Template.render("context.ex", config)
File.write!(path, content)
path
end
defp context_path(config) do
config.context_module
|> String.split(".")
|> Enum.map(&Macro.underscore/1)
|> Path.join()
|> then(&"lib/#{&1}.ex")
end
end