mirror of
https://github.com/ash-project/ash_blog.git
synced 2024-09-19 04:43:23 +12:00
fix: no need for static
This commit is contained in:
parent
fdf9b75c51
commit
2053a56c20
3 changed files with 16 additions and 10 deletions
|
@ -43,16 +43,23 @@ defmodule AshBlog.DataLayer do
|
|||
],
|
||||
folder: [
|
||||
type: :string,
|
||||
default: "static/blog",
|
||||
default: "blog/published",
|
||||
doc: """
|
||||
A path relative to to the priv directory where the files should be placed.
|
||||
"""
|
||||
],
|
||||
staging_folder: [
|
||||
type: :string,
|
||||
default: "static/blog",
|
||||
default: "blog/staged",
|
||||
doc: """
|
||||
A path relative to to the priv directory where the files should be placed when they are staged.
|
||||
A path relative to to the priv directory where the staged files should be placed when they are staged.
|
||||
"""
|
||||
],
|
||||
archive_folder: [
|
||||
type: :string,
|
||||
default: "blog/archived",
|
||||
doc: """
|
||||
A path relative to to the priv directory where the archived files should be placed when they are staged.
|
||||
"""
|
||||
]
|
||||
]
|
||||
|
|
|
@ -6,15 +6,15 @@ defmodule AshBlog.DataLayer.Info do
|
|||
alias Spark.Dsl.Extension
|
||||
|
||||
def folder(resource) do
|
||||
Extension.get_opt(resource, [:blog], :folder, "static/blog")
|
||||
Extension.get_opt(resource, [:blog], :folder, "blog/published")
|
||||
end
|
||||
|
||||
def staging_folder(resource) do
|
||||
Extension.get_opt(resource, [:blog], :staging_folder, "blog/staging")
|
||||
Extension.get_opt(resource, [:blog], :staging_folder, "blog/staged")
|
||||
end
|
||||
|
||||
def archive_folder(resource) do
|
||||
Extension.get_opt(resource, [:blog], :archive_folder, "blog/archive")
|
||||
Extension.get_opt(resource, [:blog], :archive_folder, "blog/archived")
|
||||
end
|
||||
|
||||
def file_namer(resource) do
|
||||
|
|
|
@ -6,7 +6,6 @@ defmodule AshBlogTest do
|
|||
setup do
|
||||
on_exit(fn ->
|
||||
File.rm_rf!("priv/blog")
|
||||
File.rm_rf!("priv/static/blog")
|
||||
end)
|
||||
|
||||
:ok
|
||||
|
@ -30,16 +29,16 @@ defmodule AshBlogTest do
|
|||
post = Post.create!("first\"", "the body")
|
||||
assert %{state: :published} = Post.publish!(post)
|
||||
assert [%{state: :published, title: "first\"", body: "the body"}] = Post.read!()
|
||||
assert [_] = Path.wildcard("priv/static/blog/**/*.md")
|
||||
assert [_] = Path.wildcard("priv/blog/**/*.md")
|
||||
end
|
||||
|
||||
test "blog posts can be archived" do
|
||||
post = Post.create!("first\"", "the body")
|
||||
assert %{state: :published} = Post.publish!(post)
|
||||
assert [%{state: :published, title: "first\"", body: "the body"} = post] = Post.read!()
|
||||
assert [_] = Path.wildcard("priv/static/blog/**/*.md")
|
||||
assert [_] = Path.wildcard("priv/blog/**/*.md")
|
||||
assert %{state: :archived} = Post.archive!(post)
|
||||
assert [_] = Path.wildcard("priv/blog/archive/**/*.md")
|
||||
assert [_] = Path.wildcard("priv/blog/archived/**/*.md")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue