lib/utils/file_generator.ex
defmodule ScaffoldCa.Utils.FileGenerator do
alias ScaffoldCa.Utils.StringContent
def create_file(project_file_path, template_path, token_list) do
app_path = Application.app_dir(:scaffold_ca)
with {:ok, file_template_content} <- File.read(app_path <> template_path) do
file_content = StringContent.replace(token_list, file_template_content)
File.write!(project_file_path, file_content)
else
err -> IO.inspect(err)
end
end
end