lib/mix/tasks/needle.new.web.ex
defmodule Mix.Tasks.Needle.New.Web do
@moduledoc """
Creates a new Phoenix web project within an umbrella project.
It expects the command to be run inside an umbrella application's
`apps` directory:
$ cd my_umbrella/apps
$ mix needle.new.web PATH [--app APP] [--module MODULE]
This task is intended to create a bare Phoenix project without context
integration, which can serve as the web interface of the core application
of your domain.
## Options
It supports the same options as the `needle.new` task.
See `mix help needle.new` for details.
## Examples
$ mix needle.new.web hello_web
"""
@shortdoc "Creates a new web project supported by Phoenix within an umbrella project"
use Mix.Task
alias Needle.New
alias Needle.New.Generators.Web
@impl true
def run([base_path | _] = argv) do
unless New.in_umbrella?(base_path) do
Mix.raise("The task can only be run within an umbrella's apps directory")
end
New.run(__MODULE__, argv, Web)
end
end