Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Rename blog
Browse files Browse the repository at this point in the history
  • Loading branch information
pepicrft committed Dec 22, 2022
1 parent 57e0a48 commit 2a0c73f
Show file tree
Hide file tree
Showing 60 changed files with 193 additions and 193 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ erl_crash.dump
*.ez

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

# Ignore assets that are produced by build tools.
/priv/static/assets/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ RUN chown nobody /app
ENV MIX_ENV="prod"

# Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/craftweg ./
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/pepicrft ./

USER nobody

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Craftweg
Copyright (c) 2022 Pepicrft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Website

[![website](https://github.com/craftweg/website/actions/workflows/website.yml/badge.svg)](https://github.com/craftweg/website/actions/workflows/website.yml)
[![website](https://github.com/pepicrft/website/actions/workflows/website.yml/badge.svg)](https://github.com/pepicrft/website/actions/workflows/website.yml)

This repository contains Craftweg' website powered by Phoenix.
This repository contains Pepicrft' website powered by Phoenix.

## Set up

1. Clone the repository: `git clone https://github.com/craftweg/website.git`.
1. Clone the repository: `git clone https://github.com/pepicrft/website.git`.
2. Install dependencies: `mix deps.get`
3. Create and migrate your database with `mix ecto.setup`
4. Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
Expand Down
22 changes: 11 additions & 11 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
# General application configuration
import Config

config :craftweg, :metadata, %{
title: "Craftweg",
config :pepicrft, :metadata, %{
title: "Pepicrft",
description: "Open and human tech craftsmanship from Berlin",
domain: "craftweg.com",
base_url: "https://craftweg.com" |> URI.parse(),
github_url: "https://github.com/craftweg",
domain: "pepicrft.com",
base_url: "https://pepicrft.com" |> URI.parse(),
github_url: "https://github.com/pepicrft",
language: "en-us",
twitter_handle: "@pepicrft",
author: "Pedro Piñera"
}

config :craftweg,
ecto_repos: [Craftweg.Repo]
config :pepicrft,
ecto_repos: [Pepicrft.Repo]

# Configures the endpoint
config :craftweg, CraftwegWeb.Endpoint,
config :pepicrft, PepicrftWeb.Endpoint,
url: [host: "localhost"],
render_errors: [view: CraftwegWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Craftweg.PubSub,
render_errors: [view: PepicrftWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Pepicrft.PubSub,
live_view: [signing_salt: "KU0gOAcJ"]

# Configures the mailer
Expand All @@ -35,7 +35,7 @@ config :craftweg, CraftwegWeb.Endpoint,
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :craftweg, Craftweg.Mailer, adapter: Swoosh.Adapters.Local
config :pepicrft, Pepicrft.Mailer, adapter: Swoosh.Adapters.Local

# Swoosh API client is needed for adapters other than SMTP.
config :swoosh, :api_client, false
Expand Down
12 changes: 6 additions & 6 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Config

# Configure your database
config :craftweg, Craftweg.Repo,
config :pepicrft, Pepicrft.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "craftweg_dev",
database: "pepicrft_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
Expand All @@ -16,7 +16,7 @@ config :craftweg, Craftweg.Repo,
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with esbuild to bundle .js and .css sources.
config :craftweg, CraftwegWeb.Endpoint,
config :pepicrft, PepicrftWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {127, 0, 0, 1}, port: 4000],
Expand Down Expand Up @@ -55,13 +55,13 @@ config :craftweg, CraftwegWeb.Endpoint,
# different ports.

# Watch static and templates for browser reloading.
config :craftweg, CraftwegWeb.Endpoint,
config :pepicrft, PepicrftWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/craftweg_web/(live|views)/.*(ex)$",
~r"lib/craftweg_web/templates/.*(eex)$",
~r"lib/pepicrft_web/(live|views)/.*(ex)$",
~r"lib/pepicrft_web/templates/.*(eex)$",
~r"priv/posts/.*(md)$",
~r"priv/pages/.*(md)$"
]
Expand Down
6 changes: 3 additions & 3 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Config
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
config :craftweg, CraftwegWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
config :pepicrft, PepicrftWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"

# Do not print debug messages in production
config :logger, level: :info
Expand All @@ -19,7 +19,7 @@ config :logger, level: :info
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :craftweg, CraftwegWeb.Endpoint,
# config :pepicrft, PepicrftWeb.Endpoint,
# ...,
# url: [host: "example.com", port: 443],
# https: [
Expand All @@ -43,7 +43,7 @@ config :logger, level: :info
# We also recommend setting `force_ssl` in your endpoint, ensuring
# no data is ever sent via http, always redirecting to https:
#
# config :craftweg, CraftwegWeb.Endpoint,
# config :pepicrft, PepicrftWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
10 changes: 5 additions & 5 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import Config
# If you use `mix release`, you need to explicitly enable the server
# by passing the PHX_SERVER=true when you start it:
#
# PHX_SERVER=true bin/craftweg start
# PHX_SERVER=true bin/pepicrft start
#
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
# script that automatically sets the env var above.
if System.get_env("PHX_SERVER") do
config :craftweg, CraftwegWeb.Endpoint, server: true
config :pepicrft, PepicrftWeb.Endpoint, server: true
end

if config_env() == :prod do
Expand All @@ -30,7 +30,7 @@ if config_env() == :prod do

maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: []

config :craftweg, Craftweg.Repo,
config :pepicrft, Pepicrft.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
Expand All @@ -51,7 +51,7 @@ if config_env() == :prod do
host = System.get_env("PHX_HOST") || "example.com"
port = String.to_integer(System.get_env("PORT") || "4000")

config :craftweg, CraftwegWeb.Endpoint,
config :pepicrft, PepicrftWeb.Endpoint,
url: [host: host, port: 443, scheme: "https"],
http: [
# Enable IPv6 and bind on all interfaces.
Expand All @@ -69,7 +69,7 @@ if config_env() == :prod do
# Also, you may need to configure the Swoosh API client of your choice if you
# are not using SMTP. Here is an example of the configuration:
#
# config :craftweg, Craftweg.Mailer,
# config :pepicrft, Pepicrft.Mailer,
# adapter: Swoosh.Adapters.Mailgun,
# api_key: System.get_env("MAILGUN_API_KEY"),
# domain: System.get_env("MAILGUN_DOMAIN")
Expand Down
8 changes: 4 additions & 4 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import Config
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
config :craftweg, Craftweg.Repo,
config :pepicrft, Pepicrft.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "craftweg_test#{System.get_env("MIX_TEST_PARTITION")}",
database: "pepicrft_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :craftweg, CraftwegWeb.Endpoint,
config :pepicrft, PepicrftWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 4002],
secret_key_base: "TCet+jGMS66SH7/YBnEzOnhPXyMOhH1Jip4zQu+fVEDqFOk4OYRe5N3lt3iPFgFC",
server: false

# In test we don't send emails.
config :craftweg, Craftweg.Mailer, adapter: Swoosh.Adapters.Test
config :pepicrft, Pepicrft.Mailer, adapter: Swoosh.Adapters.Test

# Print only warnings and errors during test
config :logger, level: :warn
Expand Down
7 changes: 0 additions & 7 deletions lib/craftweg.ex

This file was deleted.

3 changes: 0 additions & 3 deletions lib/craftweg/mailer.ex

This file was deleted.

7 changes: 7 additions & 0 deletions lib/pepicrft.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
defmodule Pepicrft do
@moduledoc """
This project is the [Pepicrft](https://pepicrft.com) website powered by [Phoenix](https://phoenixframework.org/).
Blog posts are part of the [repository](https://github.com/pepicrft/website) and compiled with Elixir using the
[NimblePublisher](https://github.com/dashbitco/nimble_publisher) package.
"""
end
18 changes: 9 additions & 9 deletions lib/craftweg/application.ex → lib/pepicrft/application.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Craftweg.Application do
defmodule Pepicrft.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
Expand All @@ -9,28 +9,28 @@ defmodule Craftweg.Application do
def start(_type, _args) do
children = [
# Start the Ecto repository
Craftweg.Repo,
Pepicrft.Repo,
# Start the Telemetry supervisor
CraftwegWeb.Telemetry,
PepicrftWeb.Telemetry,
# Start the PubSub system
{Phoenix.PubSub, name: Craftweg.PubSub},
{Phoenix.PubSub, name: Pepicrft.PubSub},
# Start the Endpoint (http/https)
CraftwegWeb.Endpoint
# Start a worker by calling: Craftweg.Worker.start_link(arg)
# {Craftweg.Worker, arg}
PepicrftWeb.Endpoint
# Start a worker by calling: Pepicrft.Worker.start_link(arg)
# {Pepicrft.Worker, arg}
]

# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Craftweg.Supervisor]
opts = [strategy: :one_for_one, name: Pepicrft.Supervisor]
Supervisor.start_link(children, opts)
end

# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
@impl true
def config_change(changed, _new, removed) do
CraftwegWeb.Endpoint.config_change(changed, removed)
PepicrftWeb.Endpoint.config_change(changed, removed)
:ok
end
end
12 changes: 6 additions & 6 deletions lib/craftweg/blog.ex → lib/pepicrft/blog.ex
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
defmodule Craftweg.Blog do
alias Craftweg.Blog.Post
alias Craftweg.Markdown.Parser
defmodule Pepicrft.Blog do
alias Pepicrft.Blog.Post
alias Pepicrft.Markdown.Parser

use NimblePublisher,
build: Post,
from: Application.app_dir(:craftweg, "priv/posts/**/*.md"),
from: Application.app_dir(:pepicrft, "priv/posts/**/*.md"),
as: :posts,
parser: Parser,
highlighters: []

@posts Enum.sort_by(@posts, & &1.date, {:desc, Date})
@categories @posts |> Enum.flat_map(& &1.categories) |> Enum.uniq() |> Enum.sort()
@feed @posts |> Craftweg.Feed.generate()
@feed @posts |> Pepicrft.Feed.generate()

@doc """
The function returns all the Craftweg.Blog.Post posts.
The function returns all the Pepicrft.Blog.Post posts.
"""
def all_posts, do: @posts

Expand Down
6 changes: 3 additions & 3 deletions lib/craftweg/blog/post.ex → lib/pepicrft/blog/post.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Craftweg.Blog.Post do
defmodule Pepicrft.Blog.Post do
@moduledoc """
This module is a struct that represents a blog post.
"""
Expand All @@ -8,10 +8,10 @@ defmodule Craftweg.Blog.Post do
@doc """
This method takes the absolute path to the file representing a blog post,
the contents of the file, and the attributes that have been generated by
the parser and returns an instance of the Craftweg.Blog.Post struct.
the parser and returns an instance of the Pepicrft.Blog.Post struct.
"""
@type attributes :: any
@spec build(String.t(), attributes, String.t()) :: %Craftweg.Blog.Post{}
@spec build(String.t(), attributes, String.t()) :: %Pepicrft.Blog.Post{}
def build(path, %{"title" => title, "categories" => categories} = frontmatter, body) do
filename_without_extension = path |> Path.rootname() |> Path.split() |> Enum.take(-1) |> hd
[year, month, day] = filename_without_extension |> String.split("-") |> Enum.take(3)
Expand Down
8 changes: 4 additions & 4 deletions lib/craftweg/feed.ex → lib/pepicrft/feed.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Craftweg.Feed do
defmodule Pepicrft.Feed do
@doc """
Given a list of posts, it returns the content of the RSS feed to be
returned by the controller function that handles the RSS feed request.
"""
@spec generate(list(%Craftweg.Blog.Post{})) :: any
@spec generate(list(%Pepicrft.Blog.Post{})) :: any
def generate(posts) do
Application.ensure_all_started(:timex)

%{title: title, description: description, language: language, base_url: base_url} =
Application.fetch_env!(:craftweg, :metadata)
Application.fetch_env!(:pepicrft, :metadata)

channel =
RSS.channel(
Expand All @@ -30,7 +30,7 @@ defmodule Craftweg.Feed do
<item>
<title>#{post.title}</title>
<description><![CDATA[#{post.description}]]></description>
<author>hola@craftweg.com</author>
<author>hola@pepicrft.com</author>
<pubDate>#{pub_date}</pubDate>
<link>#{post_url}</link>
<guid>#{guid}</guid>
Expand Down
3 changes: 3 additions & 0 deletions lib/pepicrft/mailer.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule Pepicrft.Mailer do
use Swoosh.Mailer, otp_app: :pepicrft
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Craftweg.Markdown.Parser do
defmodule Pepicrft.Markdown.Parser do
@moduledoc """
This module is a custom parser for NimblePublisher to extract the frontmatter delimited
by the "---" delimiters.
Expand Down
8 changes: 4 additions & 4 deletions lib/craftweg/pages.ex → lib/pepicrft/pages.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Craftweg.Pages do
defmodule Pepicrft.Pages do
@moduledoc """
This module embeds all the markdown pages in the priv/pages directory
at compile them and provides functions for accessing them.
"""
alias Craftweg.Pages.Page
alias Craftweg.Markdown.Parser
alias Pepicrft.Pages.Page
alias Pepicrft.Markdown.Parser

use NimblePublisher,
build: Page,
from: Application.app_dir(:craftweg, "priv/pages/**/*.md"),
from: Application.app_dir(:pepicrft, "priv/pages/**/*.md"),
as: :pages,
parser: Parser,
highlighters: []
Expand Down
Loading

0 comments on commit 2a0c73f

Please sign in to comment.