Browse Source

ref: rename wiki app to blog

tags/v0.72.0
Inhji Y. 3 months ago
parent
commit
02ed23b194
11 changed files with 59 additions and 59 deletions
  1. +0
    -0
      apps/blog/.formatter.exs
  2. +1
    -1
      apps/blog/.gitignore
  3. +4
    -4
      apps/blog/README.md
  4. +38
    -0
      apps/blog/lib/blog.ex
  5. +4
    -4
      apps/blog/lib/blog/post.ex
  6. +2
    -2
      apps/blog/mix.exs
  7. +0
    -0
      apps/blog/test/test_helper.exs
  8. +8
    -0
      apps/blog/test/wiki_test.exs
  9. +0
    -38
      apps/wiki/lib/wiki.ex
  10. +0
    -8
      apps/wiki/test/wiki_test.exs
  11. +2
    -2
      mix.exs

apps/wiki/.formatter.exs → apps/blog/.formatter.exs View File


apps/wiki/.gitignore → apps/blog/.gitignore View File

@@ -20,5 +20,5 @@ erl_crash.dump
*.ez

# Ignore package tarball (built via "mix hex.build").
wiki-*.tar
blog-*.tar


apps/wiki/README.md → apps/blog/README.md View File

@@ -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
- 0
apps/blog/lib/blog.ex View File

@@ -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

apps/wiki/lib/wiki/page.ex → apps/blog/lib/blog/post.ex View File

@@ -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,

apps/wiki/mix.exs → apps/blog/mix.exs View File

@@ -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",

apps/wiki/test/test_helper.exs → apps/blog/test/test_helper.exs View File


+ 8
- 0
apps/blog/test/wiki_test.exs View File

@@ -0,0 +1,8 @@
defmodule BlogTest do
use ExUnit.Case
doctest Blog

test "greets the world" do
assert Blog.hello() == :world
end
end

+ 0
- 38
apps/wiki/lib/wiki.ex View File

@@ -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

+ 0
- 8
apps/wiki/test/wiki_test.exs View File

@@ -1,8 +0,0 @@
defmodule WikiTest do
use ExUnit.Case
doctest Wiki

test "greets the world" do
assert Wiki.hello() == :world
end
end

+ 2
- 2
mix.exs View File

@@ -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