Skip to content
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

Move Definition functions defined in before_compile to using as overridable #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions lib/waffle/definition/storage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,16 @@ defmodule Waffle.Definition.Storage do
def default_url(version, _), do: default_url(version)
def default_url(_), do: nil
def __storage, do: Application.get_env(:waffle, :storage, Waffle.Storage.S3)
def acl(_, _), do: @acl
def s3_object_headers(_, _), do: []
def async, do: @async
def remote_file_headers(_), do: []

defoverridable storage_dir_prefix: 0,
defoverridable acl: 2,
async: 0,
remote_file_headers: 1,
s3_object_headers: 2,
storage_dir_prefix: 0,
storage_dir: 2,
filename: 2,
validate: 1,
Expand All @@ -126,17 +134,6 @@ defmodule Waffle.Definition.Storage do
__storage: 0,
bucket: 0,
asset_host: 0

@before_compile Waffle.Definition.Storage
end
end

defmacro __before_compile__(_env) do
quote do
def acl(_, _), do: @acl
def s3_object_headers(_, _), do: []
def async, do: @async
def remote_file_headers(_), do: []
end
end
end