-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --endpoint
option for beacon.gen.site
#761
Conversation
lib/mix/tasks/beacon.gen.site.ex
Outdated
@@ -101,6 +104,7 @@ if Code.ensure_loaded?(Igniter) do | |||
|
|||
port = Keyword.get_lazy(options, :port, fn -> Enum.random(4101..4999) end) | |||
secure_port = Keyword.get_lazy(options, :secure_port, fn -> Enum.random(8444..8999) end) | |||
site_endpoint = Keyword.get_lazy(options, :endpoint, fn -> site_endpoint_module!(igniter, site) end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Values given from args are in binary so you need to convert to a proper module:
site_endpoint = Keyword.get_lazy(options, :endpoint, fn -> site_endpoint_module!(igniter, site) end) | |
site_endpoint = Keyword.get_lazy(options, :endpoint, fn -> site_endpoint_module!(igniter, site) end) | |
site_endpoint = Module.concat([site_endpoint]) |
@@ -33,6 +33,8 @@ defmodule Mix.Tasks.Beacon.Gen.Site.Docs do | |||
* `--host` (optional) - If provided, site will be served on that host. | |||
* `--port` (optional) - The port to use for http requests. Only needed when `--host` is provided. If no port is given, one will be chosen at random. | |||
* `--secure-port` (optional) - The port to use for https requests. Only needed when `--host` is provided. If no port is given, one will be chosen at random. | |||
* `--endpoint` (optional) - The name of the Endpoint Module for your site. If not provided, a default will be generated based on the `site`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on the name, Igniter will try to create files in a path that users may not expect. For eg:
--endpoint DockYardWeb.Endpoint
Creates the file lib/dock_yard_web/endpoint.ex
Which is expected because it follows the Phoenix convention. Are we just follow that pattern or find a way to overwrite the path name as well?
Resolves #759