Skip to content
Browse files

Remove references to public in favor of static

  • Loading branch information...
1 parent 799ae0b commit e061d13bb41b716efc6df0abc415cbfc24c1cccd @josevalim josevalim committed
Showing with 18 additions and 17 deletions.
  1. +11 −10 lib/dynamo/app.ex
  2. +1 −1 lib/mix/tasks/dynamo.ex
  3. +3 −3 test/dynamo/app/config_test.exs
  4. +3 −3 test/dynamo/app_test.exs
View
21 lib/dynamo/app.ex
@@ -14,15 +14,16 @@ defmodule Dynamo.App do
For example, here is a snippet that configures Dynamo
to serve public assets from the :myapp application
- everytime we have a request at `/public`:
+ everytime we have a request at `/static`:
config :dynamo,
- public_root: :myapp,
- public_route: "/public"
+ static_root: :myapp,
+ static_route: "/static"
The available `:dynamo` configurations are:
- * `:public_route` - The route to trigger public assets serving
+ * `:static_route` - The route to serve static assets
+ * `:static_root` - The location static assets are defined
* `:compile_on_demand` - Compiles modules as they are needed
* `:reload_modules` - Reload modules after they are changed
* `:source_paths` - The paths to search when compiling modules on demand
@@ -36,7 +37,7 @@ defmodule Dynamo.App do
filters are added based on your configuration option. The
filters included by default and when they are included are:
- * `Dynamo.Filters.Static` - when a public_route and public_root are set,
+ * `Dynamo.Filters.Static` - when a static_route and static_root are set,
we add this filter to serve static assets;
* `Dynamo.Filters.Reloader` - when `:compile_on_demand` or `:reload_modules`
configs are set to true, allowing code to be compiled and reloaded on demand;
@@ -114,7 +115,7 @@ defmodule Dynamo.App do
@doc false
def default_options(env) do
- [ public_route: "/public",
+ [ static_route: "/static",
compile_on_demand: false,
reload_modules: false,
source_paths: ["app/*"],
@@ -192,14 +193,14 @@ defmodule Dynamo.App do
filters = []
dynamo = Module.get_attribute(mod, :config)[:dynamo]
- public_route = dynamo[:public_route]
- public_root = case dynamo[:public_root] do
+ static_route = dynamo[:static_route]
+ static_root = case dynamo[:static_root] do
nil -> dynamo[:otp_app]
other -> other
end
- if public_root && public_route do
- filters = [Dynamo.Filters.Static.new(public_route, public_root)|filters]
+ if static_root && static_route do
+ filters = [Dynamo.Filters.Static.new(static_route, static_root)|filters]
end
if dynamo[:compile_on_demand] || dynamo[:reload_modules] do
View
2 lib/mix/tasks/dynamo.ex
@@ -170,7 +170,7 @@ defmodule Mix.Tasks.Dynamo do
otp_app: :<%= @app %>,
# The route from where public assets are served
# You can turn off static assets by setting it to false
- public_route: "/public"
+ static_route: "/static"
initializer :start_otp_app do
:application.start config[:dynamo][:otp_app]
View
6 test/dynamo/app/config_test.exs
@@ -10,9 +10,9 @@ defmodule Dynamo.App.ConfigTest do
endpoint Dynamo.App.ConfigTest
- config :dynamo, public_root: :app
+ config :dynamo, static_root: :app
config :linq, adapter: :pg
- config :dynamo, public_root: :myapp
+ config :dynamo, static_root: :myapp
initializer :sample do
Process.put(__MODULE__, :sample)
@@ -36,7 +36,7 @@ defmodule Dynamo.App.ConfigTest do
end
test "sets and overrides config" do
- assert App.config[:dynamo][:public_root] == :myapp
+ assert App.config[:dynamo][:static_root] == :myapp
assert App.config[:linq] == [adapter: :pg]
assert App.config[:other] == nil
end
View
6 test/dynamo/app_test.exs
@@ -10,8 +10,8 @@ defmodule Dynamo.AppTest do
endpoint Dynamo.AppTest
config :dynamo,
- public_root: File.expand_path("../../fixtures/public", __FILE__),
- public_route: "/public",
+ static_root: File.expand_path("../../fixtures/public", __FILE__),
+ static_route: "/public",
compile_on_demand: false,
reload_modules: false,
source_paths: [File.expand_path("../../fixtures/*", __FILE__)],
@@ -24,7 +24,7 @@ defmodule Dynamo.AppTest do
endpoint Dynamo.AppTest
config :dynamo,
- public_root: false,
+ static_root: false,
compile_on_demand: true,
reload_modules: true,
view_paths: [File.expand_path("../../fixtures/views", __FILE__)]

0 comments on commit e061d13

Please sign in to comment.
Something went wrong with that request. Please try again.