mirror of
https://github.com/ash-project/ash_blog.git
synced 2024-09-19 12:53:45 +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: [
|
folder: [
|
||||||
type: :string,
|
type: :string,
|
||||||
default: "static/blog",
|
default: "blog/published",
|
||||||
doc: """
|
doc: """
|
||||||
A path relative to to the priv directory where the files should be placed.
|
A path relative to to the priv directory where the files should be placed.
|
||||||
"""
|
"""
|
||||||
],
|
],
|
||||||
staging_folder: [
|
staging_folder: [
|
||||||
type: :string,
|
type: :string,
|
||||||
default: "static/blog",
|
default: "blog/staged",
|
||||||
doc: """
|
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
|
alias Spark.Dsl.Extension
|
||||||
|
|
||||||
def folder(resource) do
|
def folder(resource) do
|
||||||
Extension.get_opt(resource, [:blog], :folder, "static/blog")
|
Extension.get_opt(resource, [:blog], :folder, "blog/published")
|
||||||
end
|
end
|
||||||
|
|
||||||
def staging_folder(resource) do
|
def staging_folder(resource) do
|
||||||
Extension.get_opt(resource, [:blog], :staging_folder, "blog/staging")
|
Extension.get_opt(resource, [:blog], :staging_folder, "blog/staged")
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive_folder(resource) do
|
def archive_folder(resource) do
|
||||||
Extension.get_opt(resource, [:blog], :archive_folder, "blog/archive")
|
Extension.get_opt(resource, [:blog], :archive_folder, "blog/archived")
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_namer(resource) do
|
def file_namer(resource) do
|
||||||
|
|
|
@ -6,7 +6,6 @@ defmodule AshBlogTest do
|
||||||
setup do
|
setup do
|
||||||
on_exit(fn ->
|
on_exit(fn ->
|
||||||
File.rm_rf!("priv/blog")
|
File.rm_rf!("priv/blog")
|
||||||
File.rm_rf!("priv/static/blog")
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
|
@ -30,16 +29,16 @@ defmodule AshBlogTest do
|
||||||
post = Post.create!("first\"", "the body")
|
post = Post.create!("first\"", "the body")
|
||||||
assert %{state: :published} = Post.publish!(post)
|
assert %{state: :published} = Post.publish!(post)
|
||||||
assert [%{state: :published, title: "first\"", body: "the body"}] = Post.read!()
|
assert [%{state: :published, title: "first\"", body: "the body"}] = Post.read!()
|
||||||
assert [_] = Path.wildcard("priv/static/blog/**/*.md")
|
assert [_] = Path.wildcard("priv/blog/**/*.md")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "blog posts can be archived" do
|
test "blog posts can be archived" do
|
||||||
post = Post.create!("first\"", "the body")
|
post = Post.create!("first\"", "the body")
|
||||||
assert %{state: :published} = Post.publish!(post)
|
assert %{state: :published} = Post.publish!(post)
|
||||||
assert [%{state: :published, title: "first\"", body: "the body"} = post] = Post.read!()
|
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 %{state: :archived} = Post.archive!(post)
|
||||||
assert [_] = Path.wildcard("priv/blog/archive/**/*.md")
|
assert [_] = Path.wildcard("priv/blog/archived/**/*.md")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue