Failed to run `gen.site` with `--host` on existing site in a scope without opts
- Dominant language
- Elixir
- Stars
- 1.3k
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
Given this existing scope:
```elixir
scope "/blog" do
pipe_through [:browser, :beacon]
beacon_site "/", site: :blog
end
```
Running `mix beacon.gen.site --site blog --host blog.mysite.com` failed with:
```
** (FunctionClauseError) no function clause matching in Mix.Tasks.Beacon.Gen.Site.add_host_to_scope/2
The following arguments were given to Mix.Tasks.Beacon.Gen.Site.add_host_to_scope/2:
# 1
{:scope, [trailing_comments: [], leading_comments: [], end_of_expression: [newlines: 2, line: 37, column: 6], do: [line: 34, column: 17], end: [line: 37, column: 3], line: 34, column: 3], [{:__block__, [trailing_comments: [], leading_comments: [], delimiter: "\"", line: 34, column: 9], ["/blog"]}, [{{:__block__, [trailing_comments: [], leading_comments: [], line: 34, column: 17], [:do]}, {:__block__, [trailing_comments: [], leading_comments: []], [{:pipe_through, [trailing_comments: [], leading_comments: [], end_of_expression: [newlines: 1, line: 35, column: 37], line: 35, column: 5], [{:__block__, [trailing_comments: [], leading_comments: [], closing: [line: 35, column: 36], line: 35, column: 18], [[{:__block__, [trailing_comments: [], leading_comments: [], line: 35, column: 19], [:browser]}, {:__block__, [trailing_comments: [], leading_comments: [], line: 35, column: 29], [:beacon]}]]}]}, {:beacon_site, [trailing_comments: [], leading_comments: [], end_of_expression: [newlines: 1, line: 36, column: 33], line: 36, column: 5], [{:__block__, [trailing_comments: [], leading_comments: [], delimiter: "\"", line: 36, column: 17], ["/"]}, [{{:__block__, [trailing_comments: [], leading_comments: [], format: :keyword, line: 36, column: 22], [:site]}, {:__block__, [trailing_comments: [], leading_comments: [], line: 36, column: 28], [:blog]}}]]}]}}]]}
# 2
"blog.mysite.com"
Attempted function clauses (showing 1 out of 1):
defp add_host_to_scope({:scope, scope, [scope_path, scope_opts, rest]}, host)
(beacon 0.4.0) lib/mix/tasks/beacon.gen.site.ex:279: Mix.Tasks.Beacon.Gen.Site.add_host_to_scope/2
(sourceror 1.7.1) lib/sourceror/zipper.ex:295: Sourceror.Zipper.update/2
(beacon 0.4.0) lib/mix/tasks/beacon.gen.site.ex:271: anonymous fn/4 in Mix.Tasks.Beacon.Gen.Site.mount_site_in_router/5
```
Contributor guide
Research direction
Start with lib/mix/tasks/beacon.gen.site.ex, especially add_host_to_scope/2 around line 279 and mount_site_in_router/5, then reproduce the failure with mix beacon.gen.site --site blog --host blog.mysite.com using the scope shown. Done means the command handles an existing scope without opts and adds the requested host without raising FunctionClauseError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100