Skip to content

Commit

Permalink
Merge pull request #148 from mojotech/cpj/umbrella_app_support
Browse files Browse the repository at this point in the history
Dont allow torch mix tasks from top-level of umbrella app
  • Loading branch information
cpjolicoeur authored Apr 17, 2020
2 parents 906dd2a + f3c2eda commit 9b6babc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/mix/tasks/torch.gen.html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ defmodule Mix.Tasks.Torch.Gen.Html do
@commands ~w[phx.gen.html phx.gen.context]

def run(args) do
if Mix.Project.umbrella?() do
Mix.raise("mix torch.gen.html can only be run inside an application directory")
end

%{format: format} = Mix.Torch.parse_config!("torch.gen.html", args)

# First, backup the projects existing templates if they exist
Expand Down
4 changes: 4 additions & 0 deletions lib/mix/tasks/torch.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ defmodule Mix.Tasks.Torch.Install do
"""

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.copy_from("priv/templates/#{format}", [
Expand Down
4 changes: 4 additions & 0 deletions lib/mix/tasks/torch.uninstall.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ defmodule Mix.Tasks.Torch.Uninstall do
"""

def run(args) do
if Mix.Project.umbrella?() do
Mix.raise("mix torch.uninstall can only be run inside an application directory")
end

%{format: format, otp_app: otp_app} = Mix.Torch.parse_config!("torch.uninstall", args)

paths = [
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Torch.MixProject do
def project do
[
app: :torch,
version: "3.1.0",
version: "3.2.0",
elixir: "~> 1.8",
start_permanent: Mix.env() == :prod,
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
Expand Down

0 comments on commit 9b6babc

Please sign in to comment.