Packages
torch
3.6.2
6.0.0
5.6.0
5.5.0
5.4.0
5.3.2
5.3.1
5.2.0
5.1.2
5.1.1
5.1.0
5.0.0
5.0.0-rc.4
5.0.0-rc.3
5.0.0-rc.2
5.0.0-rc.1
5.0.0-rc.0
4.3.2
4.3.1
4.3.0
4.2.1
4.2.0
retired
4.1.0
4.0.0
4.0.0-rc.0
3.9.1
3.9.0
3.8.0
3.7.1
3.7.0-rc.0
3.6.4
3.6.3
3.6.2
3.6.1
3.6.0
3.5.0
3.4.1
3.4.0
3.3.1
3.3.0
3.2.1
3.2.0
3.1.0
3.0.0
2.1.0
2.0.0
2.0.0-rc.3
2.0.0-rc.2
2.0.0-rc.1
1.0.0-rc.6
1.0.0-rc.5
1.0.0-rc.4
1.0.0-rc.3
1.0.0-rc.2
1.0.0-rc.1
0.2.0-rc.5
0.2.0-rc.4
0.2.0-rc.3
0.2.0-rc.2
0.2.0-rc.1
0.1.0
Rapid admin generator for Phoenix
Current section
Files
Jump to
Current section
Files
lib/mix/tasks/torch.install.ex
defmodule Mix.Tasks.Torch.Install do
@moduledoc """
Installs torch layout to your `_web/templates` directory.
## Configuration
config :torch,
otp_app: :my_app,
template_format: :eex
## Example
Running without options will read configuration from your `config.exs` file,
as shown above.
mix torch.install
Also accepts `--format` and `--app` options:
mix torch.install --format slime --app my_app
"""
def run(args) do
if Mix.Project.umbrella?() do
Mix.raise("mix torch.install can only be run inside an application directory")
end
%{format: format, otp_app: otp_app} = Mix.Torch.parse_config!("torch.install", args)
Mix.Torch.ensure_phoenix_is_loaded!("torch.install")
phoenix_version = Application.spec(:phoenix, :vsn)
Mix.Torch.copy_from("priv/templates/#{format}", [
{template_file(phoenix_version, format),
"lib/#{otp_app}_web/templates/layout/torch.html.#{format}"}
])
end
defp template_file(phoenix_version, format) when is_list(phoenix_version),
do: phoenix_version |> to_string() |> template_file(format)
defp template_file(phoenix_version, format) when is_binary(phoenix_version) do
if Version.match?(phoenix_version, ">= 1.5.0") do
"layout.phx1_5.html.#{format}"
else
"layout.html.#{format}"
end
end
end