Skip to content

Commit

Permalink
feat: add ROUTEX_DEBUG for compilation debugging (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
BartOtten authored May 3, 2023
1 parent 75815c3 commit c1d4ca5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Changelog

## 0.1.0-alpha.3 (2023-05-05)

### Enhancements

* Use `ROUTEX_DEBUG=true` to help debugging compilation issues
11 changes: 11 additions & 0 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Troubleshooting

## Compilation

When your application fails to compile you might find the cause by setting the
environment variable `ROUTEX_DEBUG` to `true`.

ROUTEX_DEBUG=true mix compile

Do note that this might show early compilation issues, but will make the final
compilation fail at all times.
3 changes: 3 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,6 @@ admin routes)
end
+ end
```

When you run into issues, please have a look at the [Troubleshooting](TROUBLESHOOTING.md)

4 changes: 2 additions & 2 deletions lib/routex/processing.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ defmodule Routex.Processing do

# Enable to get more descriptive error messages during development.
# Causes compilation failure when enabled.
wrap_in_task = false
wrap_in_task = System.get_env("ROUTEX_DEBUG") == "true"

if wrap_in_task do
IO.warn(
"Routex processing is wrapped in a task for debugging purposes. Compilation will fail"
"\n\n!! Routex processing is wrapped in a task for debugging purposes. Compilation will fail !!\n\n"
)

task = Task.async(fn -> execute_callbacks(env) end)
Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Routex.MixProject do
use Mix.Project

@source_url "https://github.com/BartOtten/routex"
@version "0.1.0-alpha.2"
@version "0.1.0-alpha.3"
@name "Phoenix Routes Extension Framework"

def project do
Expand Down Expand Up @@ -83,7 +83,7 @@ defmodule Routex.MixProject do
maintainers: ["Bart Otten"],
licenses: ["MIT"],
files: ~w(lib .formatter.exs mix.exs README.md LICENSE.md
CHANGELOG.md CONTRIBUTING.md USAGE.md EXTENSIONS.md),
CHANGELOG.md CONTRIBUTING.md USAGE.md EXTENSIONS.md TROUBLESHOOTING.md),
links: %{
Changelog: "https://hexdocs.pm/routex/changelog.html",
GitHub: "https://github.com/BartOtten/routex"
Expand All @@ -102,7 +102,7 @@ defmodule Routex.MixProject do
source_url: @source_url,
assets: "assets",
before_closing_head_tag: &docs_before_closing_head_tag/1,
extras: ["README.md", "USAGE.md", "CHANGELOG.md", "EXTENSIONS.md"],
extras: ["README.md", "USAGE.md", "CHANGELOG.md", "EXTENSIONS.md", "TROUBLESHOOTING.md"],
filter_modules: ~r"Elixir.Routex\..*$",
groups_for_modules: [
Routex: ~r"Routex\.?[^.]*$",
Expand Down

0 comments on commit c1d4ca5

Please sign in to comment.