Packages

A modular, open templating system, designed for use with `mix gen`. You care about this if: ① you'd like different templates than the ones built in to mix, ② you'd like to create your own templates, or ③ you have created a package such as Phoenix or Nerves that needs its own project se...

Retired package: out of sequence

Current section

Files

Jump to
mix_templates lib mix tasks template.uninstall.ex
Raw

lib/mix/tasks/template.uninstall.ex

defmodule Mix.Tasks.Template.Uninstall do
@moduledoc(
Path.join([__DIR__, "../../../README.md"])
|> File.read!
|> String.replace(~r/\A.*^### Use\w+/m, "")
|> String.replace(~r/^###.*/m, ""))
use Private
use Mix.Task
alias MixTemplates.Cache
def run([ source ]) do
case uninstall(source) do
{ :error, reason } ->
Mix.shell.error([ :red, "Error: ",
:reset, "uninstalling template “#{source}:” #{reason}" ])
{ :ok, project } ->
Mix.shell.info("template “#{project}” uninstalled")
other ->
raise inspect other
end
end
defp uninstall(project) do
if MixTemplates.find(project) do
Cache.uninstall_template(project)
else
{ :error, "template “#{project}” is not installed" }
end
end
end