Current section

14 Versions

Jump to

Compare versions

41 files changed
+1647 additions
-1799 deletions
  @@ -6,33 +6,35 @@ locals_without_parens = [
6 6 socket: 3,
7 7
8 8 # Combo.Router
9 - connect: 3,
10 - connect: 4,
11 - delete: 3,
12 - delete: 4,
9 + match: 4,
10 + match: 5,
13 11 forward: 2,
14 12 forward: 3,
15 13 forward: 4,
16 14 get: 3,
17 15 get: 4,
18 - head: 3,
19 - head: 4,
20 - match: 4,
21 - match: 5,
22 - options: 3,
23 - options: 4,
24 - patch: 3,
25 - patch: 4,
26 - pipeline: 2,
27 - pipe_through: 1,
28 16 post: 3,
29 17 post: 4,
30 18 put: 3,
31 19 put: 4,
32 - resources: 2,
33 - resources: 3,
34 - resources: 4,
20 + patch: 3,
21 + patch: 4,
22 + delete: 3,
23 + delete: 4,
24 + options: 3,
25 + options: 4,
26 + connect: 3,
27 + connect: 4,
28 + trace: 3,
35 29 trace: 4,
30 + head: 3,
31 + head: 4,
32 + pipeline: 2,
33 + # plug: 2 has been included by Combo.Endpoint.
34 + pipe_through: 1,
35 + scope: 2,
36 + scope: 3,
37 + scope: 4,
36 38
37 39 # Combo.Controller
38 40 action_fallback: 1,
  @@ -1,6 +1,9 @@
1 1 # Changelog
2 2
3 - ## Unreleased
3 + ## v0.9.0
4 +
5 + - [`Combo.Router`] remove catch-all functions in route helpers, because we can find the type violation by using Elixir compiler.
6 + - [`Combo.Router`] remove `resources/_`
4 7
5 8 ## v0.8.0
  @@ -1,9 +1,9 @@
1 1 {<<"links">>,
2 2 [{<<"Source">>,<<"https://github.com/combo-lab/combo">>},
3 3 {<<"Changelog">>,
4 - <<"https://github.com/combo-lab/combo/blob/v0.8.0/CHANGELOG.md">>}]}.
4 + <<"https://github.com/combo-lab/combo/blob/v0.9.0/CHANGELOG.md">>}]}.
5 5 {<<"name">>,<<"combo">>}.
6 - {<<"version">>,<<"0.8.0">>}.
6 + {<<"version">>,<<"0.9.0">>}.
7 7 {<<"description">>,
8 8 <<"A web framework, that combines the good parts of modern web development.">>}.
9 9 {<<"elixir">>,<<"~> 1.18">>}.
  @@ -87,9 +87,10 @@
87 87 <<"lib/combo/live_reloader/socket.ex">>,<<"lib/combo/static.ex">>,
88 88 <<"lib/combo/flash.ex">>,<<"lib/combo/template.ex">>,<<"lib/combo/router">>,
89 89 <<"lib/combo/router/route.ex">>,<<"lib/combo/router/console_formatter.ex">>,
90 - <<"lib/combo/router/resource.ex">>,<<"lib/combo/router/scope.ex">>,
91 - <<"lib/combo/router/helpers.ex">>,<<"priv">>,<<"priv/logo">>,
92 - <<"priv/logo/combo.svg">>,<<"priv/static">>,
90 + <<"lib/combo/router/module_attr.ex">>,<<"lib/combo/router/scope.ex">>,
91 + <<"lib/combo/router/helpers.ex">>,<<"lib/combo/router/utils.ex">>,
92 + <<"lib/combo/router/pipeline.ex">>,<<"lib/combo/router/forward.ex">>,
93 + <<"priv">>,<<"priv/logo">>,<<"priv/logo/combo.svg">>,<<"priv/static">>,
93 94 <<"priv/static/live_reloader.min.js.map">>,
94 95 <<"priv/static/live_reloader.min.js">>,<<"mix.exs">>,<<".formatter.exs">>,
95 96 <<"README.md">>,<<"CHANGELOG.md">>,<<"LICENSE">>,
  @@ -341,8 +341,16 @@ defmodule Combo.CodeReloader.Server do
341 341 # assets in priv are copied to the build directory.
342 342 Mix.Project.build_structure(config)
343 343
344 - # TODO: The purge option may no longer be required from Elixir v1.18
345 - args = ["--purge-consolidation-path-if-stale", consolidation_path | compile_args]
344 + args = [
345 + # TODO: The purge option may no longer be required from Elixir v1.18
346 + "--purge-consolidation-path-if-stale",
347 + consolidation_path,
348 + # Since Elixir v1.20, Elixir no longer automatically purges compiler
349 + # modules, which is ok for most workflows, but since code reloading never
350 + # shuts down the server, we enable purging to avoid too many temp modules.
351 + "--purge-compiler-modules"
352 + | compile_args
353 + ]
346 354
347 355 {status, diagnostics} =
348 356 with_logger_app(config, fn ->
  @@ -1510,4 +1510,39 @@ defmodule Combo.Conn do
1510 1510 def current_url(%Plug.Conn{} = conn, %{} = params) do
1511 1511 Combo.URLBuilder.url(conn, current_path(conn, params))
1512 1512 end
1513 +
1514 + ## Assigns
1515 +
1516 + @doc """
1517 + Adds key-value pairs to the connection's `assigns`.
1518 +
1519 + Accepts a keyword list, a map, or a single-argument function.
1520 +
1521 + When a keyword list or map is given as the second argument, it merges into
1522 + the connection's `assigns`. It is equivalent to calling `Plug.Conn.assign/3`
1523 + multiple times.
1524 +
1525 + When a function is given as the second argument, it takes the current
1526 + `assigns` as an argument and merges its return value into the connection's
1527 + `assigns`.
1528 +
1529 + ## Examples
1530 +
1531 + iex> assign(conn, name: "Combo", lang: "Elixir")
1532 + iex> assign(conn, %{name: "Combo", lang: "Elixir"})
1533 + iex> assign(conn, fn %{name: name, lang: lang} ->
1534 + ...> %{title: Enum.join([name, lang], " | ")}
1535 + ...> end)
1536 +
1537 + """
1538 + def assign(conn, keyword_or_map_or_fun)
1539 +
1540 + def assign(conn, keyword_or_map)
1541 + when is_map(keyword_or_map) or is_list(keyword_or_map) do
1542 + Plug.Conn.merge_assigns(conn, keyword_or_map)
1543 + end
1544 +
1545 + def assign(conn, fun) when is_function(fun, 1) do
1546 + assign(conn, fun.(conn.assigns))
1547 + end
1513 1548 end
Loading more files…