diff --git a/lib/data_layer/data_layer.ex b/lib/data_layer/data_layer.ex index 89dd7f5..90ae340 100644 --- a/lib/data_layer/data_layer.ex +++ b/lib/data_layer/data_layer.ex @@ -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. """ ] ] diff --git a/lib/data_layer/info.ex b/lib/data_layer/info.ex index 297c0a8..1091c24 100644 --- a/lib/data_layer/info.ex +++ b/lib/data_layer/info.ex @@ -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 diff --git a/test/ash_blog_test.exs b/test/ash_blog_test.exs index 9ba94db..7eebce6 100644 --- a/test/ash_blog_test.exs +++ b/test/ash_blog_test.exs @@ -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