Browse Source

ref: rename wiki app to blog

master
Inhji Y. 10 months ago
parent
commit
02ed23b194
  1. 0
      apps/blog/.formatter.exs
  2. 2
      apps/blog/.gitignore
  3. 8
      apps/blog/README.md
  4. 38
      apps/blog/lib/blog.ex
  5. 8
      apps/blog/lib/blog/post.ex
  6. 4
      apps/blog/mix.exs
  7. 0
      apps/blog/test/test_helper.exs
  8. 8
      apps/blog/test/wiki_test.exs
  9. 38
      apps/wiki/lib/wiki.ex
  10. 8
      apps/wiki/test/wiki_test.exs
  11. 4
      mix.exs

0
apps/wiki/.formatter.exs → apps/blog/.formatter.exs

2
apps/wiki/.gitignore → apps/blog/.gitignore

@ -20,5 +20,5 @@ erl_crash.dump
*.ez
# Ignore package tarball (built via "mix hex.build").
wiki-*.tar
blog-*.tar

8
apps/wiki/README.md → apps/blog/README.md

@ -1,21 +1,21 @@
# Wiki
# Blog
**TODO: Add description**
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `wiki` to your list of dependencies in `mix.exs`:
by adding `blog` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:wiki, "~> 0.1.0"}
{:blog, "~> 0.1.0"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/wiki](https://hexdocs.pm/wiki).
be found at [https://hexdocs.pm/blog](https://hexdocs.pm/blog).

38
apps/blog/lib/blog.ex

@ -0,0 +1,38 @@
defmodule Blog do
@moduledoc """
Documentation for `Blog`.
"""
import Ecto.Query, warn: false
alias Blog.Post
@preloads [:tags]
def create_post(attrs \\ %{}) do
%Post{}
|> Post.changeset(attrs)
|> Db.Repo.insert()
end
def update_post(post, attrs) do
post
|> Db.Repo.preload(@preloads)
|> Post.changeset(attrs)
|> Db.Repo.update()
end
def get_post!(id),
do:
Db.Repo.get!(Post, id)
|> Db.Repo.preload(@preloads)
def list_posts() do
%Post{}
|> Db.Repo.all()
|> Db.Repo.preload(@preloads)
end
def delete_post(post) do
Db.Repo.delete(post)
end
end

8
apps/wiki/lib/wiki/page.ex → apps/blog/lib/blog/post.ex

@ -1,9 +1,9 @@
defmodule Wiki.Page do
defmodule Blog.Post do
use Ecto.Schema
import Ecto.Changeset
schema "posts" do
field :type, :string, default: "page"
field :type, :string, default: "post"
field :source, :string
field :title, :string
@ -28,8 +28,8 @@ defmodule Wiki.Page do
timestamps()
end
def changeset(bookmark, attrs \\ %{}) do
bookmark
def changeset(post, attrs \\ %{}) do
post
|> cast(attrs, [
:source,
:title,

4
apps/wiki/mix.exs → apps/blog/mix.exs

@ -1,9 +1,9 @@
defmodule Wiki.MixProject do
defmodule Blog.MixProject do
use Mix.Project
def project do
[
app: :wiki,
app: :blog,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",

0
apps/wiki/test/test_helper.exs → apps/blog/test/test_helper.exs

8
apps/blog/test/wiki_test.exs

@ -0,0 +1,8 @@
defmodule BlogTest do
use ExUnit.Case
doctest Blog
test "greets the world" do
assert Blog.hello() == :world
end
end

38
apps/wiki/lib/wiki.ex

@ -1,38 +0,0 @@
defmodule Wiki do
@moduledoc """
Documentation for `Wiki`.
"""
import Ecto.Query, warn: false
alias Wiki.Page
@preloads [:tags]
def create_page(attrs \\ %{}) do
%Page{}
|> Page.changeset(attrs)
|> Db.Repo.insert()
end
def update_page(page, attrs) do
page
|> Db.Repo.preload(@preloads)
|> Page.changeset(attrs)
|> Db.Repo.update()
end
def get_page!(id),
do:
Db.Repo.get!(Page, id)
|> Db.Repo.preload(@preloads)
def list_pages() do
%Page{}
|> Db.Repo.all()
|> Db.Repo.preload(@preloads)
end
def delete_page(page) do
Db.Repo.delete(page)
end
end

8
apps/wiki/test/wiki_test.exs

@ -1,8 +0,0 @@
defmodule WikiTest do
use ExUnit.Case
doctest Wiki
test "greets the world" do
assert Wiki.hello() == :world
end
end

4
mix.exs

@ -12,6 +12,7 @@ defmodule Tomie.Umbrella.MixProject do
releases: [
tomie: [
applications: [
blog: :permanent,
bookmarks: :permanent,
db: :permanent,
http: :permanent,
@ -19,8 +20,7 @@ defmodule Tomie.Umbrella.MixProject do
listens: :permanent,
tags: :permanent,
tomie: :permanent,
tomie_web: :permanent,
wiki: :permanent
tomie_web: :permanent
]
]
]

Loading…
Cancel
Save