Skip to content

Commit

Permalink
Merge pull request #86 from BuddyGG/development
Browse files Browse the repository at this point in the history
Version 1.1.4 rename project
  • Loading branch information
Hanspagh committed Mar 11, 2018
2 parents ecbfbc4 + cb9b4f7 commit 2122ea5
Show file tree
Hide file tree
Showing 53 changed files with 286 additions and 280 deletions.
6 changes: 3 additions & 3 deletions .deliver/config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP="lol_buddy"
APP="buddy_matching"

BUILD_HOST="buddy.gg"
BUILD_USER="worker"
Expand All @@ -13,11 +13,11 @@ DELIVER_TO="/home/worker/app_release"

pre_erlang_get_and_update_deps() {
# copy it on the build host to the build directory when building
local _secret_config_file_on_build_host="~/secret/lol_buddy.conf"
local _secret_config_file_on_build_host="~/secret/buddy_matching.conf"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
status "Copying '$_secret_config_file_on_build_host' file to build dir"
__sync_remote " # execute on build host
cp $_secret_config_file_on_build_host $BUILD_AT/config/lol_buddy.conf
cp $_secret_config_file_on_build_host $BUILD_AT/config/buddy_matching.conf
"
fi
}
19 changes: 19 additions & 0 deletions config/buddy_matching.prod.example.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.secret_key_base here.
buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.secret_key_base = ""

# Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.http.port here.
buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.http.port = 4000

# Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.url.host here.
buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.url.host = ""

# Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.check_origin here.
buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.check_origin = false

# Provide documentation for buddy_matching.riot_api_key here.
buddy_matching.riot_api_key = ""

# Provide documentation for logger.level here.
logger.level = info


34 changes: 19 additions & 15 deletions config/lol_buddy.schema.exs → config/buddy_matching.schema.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,46 @@ See the moduledoc for `Conform.Schema.Validator` for more details and examples.
extends: [],
import: [],
mappings: [
"lol_buddy.Elixir.LolBuddyWeb.Endpoint.secret_key_base": [
"buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.secret_key_base": [
commented: false,
datatype: :binary,
doc: "Provide documentation for lol_buddy.Elixir.LolBuddyWeb.Endpoint.secret_key_base here.",
doc:
"Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.secret_key_base here.",
hidden: false,
to: "lol_buddy.Elixir.LolBuddyWeb.Endpoint.secret_key_base"
to: "buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.secret_key_base"
],
"lol_buddy.Elixir.LolBuddyWeb.Endpoint.http.port": [
"buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.http.port": [
commented: false,
datatype: :integer,
default: 4000,
doc: "Provide documentation for lol_buddy.Elixir.LolBuddyWeb.Endpoint.http.port here.",
doc:
"Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.http.port here.",
hidden: false,
to: "lol_buddy.Elixir.LolBuddyWeb.Endpoint.http.port"
to: "buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.http.port"
],
"lol_buddy.Elixir.LolBuddyWeb.Endpoint.url.host": [
"buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.url.host": [
commented: false,
datatype: :binary,
doc: "Provide documentation for lol_buddy.Elixir.LolBuddyWeb.Endpoint.url.host here.",
doc:
"Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.url.host here.",
hidden: false,
to: "lol_buddy.Elixir.LolBuddyWeb.Endpoint.url.host"
to: "buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.url.host"
],
"lol_buddy.Elixir.LolBuddyWeb.Endpoint.check_origin": [
"buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.check_origin": [
commented: false,
datatype: :atom,
default: false,
doc: "Provide documentation for lol_buddy.Elixir.LolBuddyWeb.Endpoint.check_origin here.",
doc:
"Provide documentation for buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.check_origin here.",
hidden: false,
to: "lol_buddy.Elixir.LolBuddyWeb.Endpoint.check_origin"
to: "buddy_matching.Elixir.BuddyMatchingWeb.Endpoint.check_origin"
],
"lol_buddy.riot_api_key": [
"buddy_matching.riot_api_key": [
commented: false,
datatype: :binary,
doc: "Provide documentation for lol_buddy.riot_api_key here.",
doc: "Provide documentation for buddy_matching.riot_api_key here.",
hidden: false,
to: "lol_buddy.riot_api_key"
to: "buddy_matching.riot_api_key"
],
"logger.level": [
commented: false,
Expand Down
6 changes: 3 additions & 3 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use Mix.Config

# Configures the endpoint
config :lol_buddy, LolBuddyWeb.Endpoint,
config :buddy_matching, BuddyMatchingWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "NXkm0vlBsJMoq0c5tOwIE7PoxtCRx6C9cvpbgdPE8wZc7Wej2BELkzWIN0Kd6+tw",
render_errors: [view: LolBuddyWeb.ErrorView, accepts: ~w(json)],
pubsub: [name: LolBuddy.PubSub, adapter: Phoenix.PubSub.PG2]
render_errors: [view: BuddyMatchingWeb.ErrorView, accepts: ~w(json)],
pubsub: [name: BuddyMatching.PubSub, adapter: Phoenix.PubSub.PG2]

# Configures Elixir's Logger
config :logger, :console,
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Mix.Config
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :lol_buddy, LolBuddyWeb.Endpoint,
config :buddy_matching, BuddyMatchingWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
Expand Down
2 changes: 1 addition & 1 deletion config/dev.secret.example.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ use Mix.Config
# file or create a script for recreating it, since it's
# kept out of version control and might be hard to recover
# or recreate for your teammates (or yourself later on).
config :lol_buddy, riot_api_key: "****-****-*****-*****"
config :buddy_matching, riot_api_key: "****-****-*****-*****"
19 changes: 0 additions & 19 deletions config/lol_buddy.prod.example.conf

This file was deleted.

12 changes: 6 additions & 6 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Mix.Config
# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# LolBuddyWeb.Endpoint.init/2 when load_from_system_env is
# BuddyMatchingWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there.
#
# Don't forget to configure the url host to something meaningful,
Expand All @@ -13,7 +13,7 @@ use Mix.Config
# containing the digested version of static files. This
# manifest is generated by the mix phx.digest task
# which you typically run after static files are built.
config :lol_buddy, LolBuddyWeb.Endpoint,
config :buddy_matching, BuddyMatchingWeb.Endpoint,
http: [port: System.get_env("PORT")],
url: [scheme: "https", host: System.get_env("HOST"), port: 443],

Expand All @@ -23,7 +23,7 @@ config :lol_buddy, LolBuddyWeb.Endpoint,
code_reloader: false,
secret_key_base: System.get_env("SECRET_KEY_BASE")

config :lol_buddy, riot_api_key: System.get_env("RIOT_API_KEY")
config :buddy_matching, riot_api_key: System.get_env("RIOT_API_KEY")

config :logger, level: :debug
# Do not print debug messages in production
Expand All @@ -33,7 +33,7 @@ config :logger, level: :debug
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :lol_buddy, LolBuddyWeb.Endpoint,
# config :buddy_matching, BuddyMatchingWeb.Endpoint,
# ...
# url: [host: "example.com", port: 443],
# https: [:inet6,
Expand All @@ -48,7 +48,7 @@ config :logger, level: :debug
# We also recommend setting `force_ssl`, ensuring no data is
# ever sent via http, always redirecting to https:
#
# config :lol_buddy, LolBuddyWeb.Endpoint,
# config :buddy_matching, BuddyMatchingWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
Expand All @@ -63,7 +63,7 @@ config :phoenix, :serve_endpoints, true
# Alternatively, you can configure exactly which server to
# start per endpoint:
#
# config :lol_buddy, LolBuddyWeb.Endpoint, server: true
# config :buddy_matching, BuddyMatchingWeb.Endpoint, server: true
#

# Finally import the config/prod.secret.exs
Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use Mix.Config

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :lol_buddy, LolBuddyWeb.Endpoint,
config :buddy_matching, BuddyMatchingWeb.Endpoint,
http: [port: 4001],
server: false

Expand Down
4 changes: 2 additions & 2 deletions lib/lol_buddy.ex → lib/buddy_matching.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule LolBuddy do
defmodule BuddyMatching do
@moduledoc """
LolBuddy keeps the contexts that define your domain
BuddyMatching keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule LolBuddy.Application do
defmodule BuddyMatching.Application do
@moduledoc """
Application configuration. The PlayerServer.Supervisor is started from here.
"""

use Application
alias LolBuddyWeb.Endpoint
alias BuddyMatchingWeb.Endpoint

# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
Expand All @@ -14,23 +14,23 @@ defmodule LolBuddy.Application do
api_key = System.get_env("RIOT_API_KEY")

if api_key do
Application.put_env(:lol_buddy, :riot_api_key, api_key)
Application.put_env(:buddy_matching, :riot_api_key, api_key)
end

# Define workers and child supervisors to be supervised
children = [
# Start the endpoint when the application starts
supervisor(Endpoint, []),
supervisor(LolBuddy.PlayerServer.Supervisor, []),
supervisor(LolBuddyWeb.Presence, [])
supervisor(BuddyMatching.PlayerServer.Supervisor, []),
supervisor(BuddyMatchingWeb.Presence, [])
# Start your own worker by calling:
# LolBuddy.Worker.start_link(arg1, arg2, arg3)
# worker(LolBuddy.Worker, [arg1, arg2, arg3]),
# BuddyMatching.Worker.start_link(arg1, arg2, arg3)
# worker(BuddyMatching.Worker, [arg1, arg2, arg3]),
]

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

Expand Down
10 changes: 5 additions & 5 deletions lib/lol_buddy/auth/auth.ex → lib/buddy_matching/auth/auth.ex
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defmodule LolBuddy.Auth do
defmodule BuddyMatching.Auth do
@moduledoc """
Authenticate module using Phoenix tokens
Used to generate session ids, tokens and verifying these
"""
alias LolBuddyWeb.Endpoint
alias BuddyMatchingWeb.Endpoint
alias Phoenix.Token

@salt "session"
Expand All @@ -14,7 +14,7 @@ defmodule LolBuddy.Auth do
@doc """
Generate a valid uuid session id.
## Example:
iex> LolBuddy.Auth.generate_session_id
iex> BuddyMatching.Auth.generate_session_id
"fe8d2ecb-38d3-4b17-a745-b455ce78183b"
"""
def generate_session_id do
Expand All @@ -24,7 +24,7 @@ defmodule LolBuddy.Auth do
@doc """
Sign a session id to a create session token with a max_age of 30 days
## Example
iex> LolBuddy.Auth.generate_session_token("fe8d2ecb-38d3-4b17-a745-b455ce78183b")
iex> BuddyMatching.Auth.generate_session_token("fe8d2ecb-38d3-4b17-a745-b455ce78183b")
"SFMyNTY.g3QAAAACZAAEZGF0YW0AAAAkZmU4ZDJlY2ItMzhkMy00YjE3LWE3NDUtYjQ1NWNlNzgxODNiZAAGc2lnbmVkbgYAa_yf218B.a4U-ibqtnyFogL_LN9EmkDruXUuT4S_r--U6twFZSqo"
"""
def generate_session_token(session_id) do
Expand All @@ -34,7 +34,7 @@ defmodule LolBuddy.Auth do
@doc """
Verify a session id/token pair
## Example
iex> LolBuddy.Auth.verify_session("fe8d2ecb-38d3-4b17-a745-b455ce78183b",
iex> BuddyMatching.Auth.verify_session("fe8d2ecb-38d3-4b17-a745-b455ce78183b",
"SFMyNTY.g3QAAAACZAAEZGF0YW0AAAAkZmU4ZDJlY2ItMzhkMy00YjE3LWE3NDUtYjQ1NWNlNzgxODNiZAAGc2lnbmVkbgYAa_yf218B.a4U-ibqtnyFogL_LN9EmkDruXUuT4S_r--U6twFZSqo")
true
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LolBuddy.PlayerServer do
defmodule BuddyMatching.PlayerServer do
@moduledoc """
Simple GenServer for storing Players.
Map used for data structure with name as key. Since PlayerServers
Expand All @@ -7,16 +7,16 @@ defmodule LolBuddy.PlayerServer do
"""
use GenServer
require Logger
alias LolBuddy.Players
alias LolBuddy.Players.Player
alias LolBuddyWeb.Endpoint
alias LolBuddyWeb.PlayersChannel
alias BuddyMatching.Players
alias BuddyMatching.Players.Player
alias BuddyMatchingWeb.Endpoint
alias BuddyMatchingWeb.PlayersChannel
alias Phoenix.Socket.Broadcast

@doc """
Starts the PlayerServer.
## Examples
iex> {:ok, pid} = LolBuddy.PlayerServer.start_link
iex> {:ok, pid} = BuddyMatching.PlayerServer.start_link
{:ok, #PID<0.246.0>}
"""
def start_link do
Expand All @@ -30,7 +30,7 @@ defmodule LolBuddy.PlayerServer do
These are described here:
https://hexdocs.pm/elixir/GenServer.html#start_link/3
## Examples
iex> {:ok, pid} = LolBuddy.PlayerServer.start_link
iex> {:ok, pid} = BuddyMatching.PlayerServer.start_link
"""
def start_link(opts) do
GenServer.start_link(__MODULE__, :ok, opts)
Expand Down Expand Up @@ -123,7 +123,7 @@ defmodule LolBuddy.PlayerServer do
Since this method uses GenServer.call it will be handled synchronously.
#
## Examples
iex> LolBuddy.PlayerServer.read(:euw)
iex> BuddyMatching.PlayerServer.read(:euw)
[%{%Player{id: 1, name: "Lethly", region: :euw, voice: [false],
languages: ["danish"], age_group: 1, positions: [:marksman],
leagues: [diamond1], champions: ["Vayne", "Caitlyn", "Ezreal"],
Expand All @@ -141,9 +141,9 @@ defmodule LolBuddy.PlayerServer do
## Examples
iex> p1 = %Player{}
iex> LolBuddy.PlayerServer.add(p1)
iex> BuddyMatching.PlayerServer.add(p1)
:ok
iex> LolBuddy.PlayerServer.add(p1)
iex> BuddyMatching.PlayerServer.add(p1)
:error
"""
def add(pid, player) do
Expand All @@ -156,7 +156,7 @@ defmodule LolBuddy.PlayerServer do
Method will run asynchronously.
## Examples
iex> LolBuddy.PlayerServer.remove(%Player{})
iex> BuddyMatching.PlayerServer.remove(%Player{})
:ok
"""
def remove(pid, %Player{} = player) do
Expand All @@ -171,7 +171,7 @@ defmodule LolBuddy.PlayerServer do
Method will run asynchronously.
## Examples
iex> LolBuddy.PlayerServer.update(%Player{name = "Lethly"})
iex> BuddyMatching.PlayerServer.update(%Player{name = "Lethly"})
:ok
"""
def update(pid, %Player{} = player) do
Expand Down
Loading

0 comments on commit 2122ea5

Please sign in to comment.