aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-08-13 19:19:22 +0200
committerJasper Van der Jeugt2020-08-13 19:19:22 +0200
commit8d5c0405565ad4afd976efd1262b3224efd6ee2f (patch)
tree8d24ecb97212d54943d104ed95f1fda4dea7c1fd
parenta39fe7ff759a552c64a060f0d98a0d4e8a577b01 (diff)
cafp -> uplcg
-rw-r--r--Dockerfile10
-rw-r--r--Makefile18
-rw-r--r--black.txt2
-rw-r--r--client/index.html12
-rw-r--r--client/src/Client.elm8
-rw-r--r--config.mk8
-rw-r--r--server/lib/Uplcg/CookieSocket.hs (renamed from server/lib/Cafp/CookieSocket.hs)2
-rw-r--r--server/lib/Uplcg/Game.hs (renamed from server/lib/Cafp/Game.hs)4
-rw-r--r--server/lib/Uplcg/Main/GenerateElmTypes.hs (renamed from server/lib/Cafp/Main/GenerateElmTypes.hs)4
-rw-r--r--server/lib/Uplcg/Main/Server.hs (renamed from server/lib/Cafp/Main/Server.hs)16
-rw-r--r--server/lib/Uplcg/Messages.hs (renamed from server/lib/Cafp/Messages.hs)2
-rw-r--r--server/src/GenerateElmTypes.hs4
-rw-r--r--server/src/Server.hs4
-rw-r--r--server/uplcg.cabal (renamed from server/cafp.cabal)22
14 files changed, 58 insertions, 58 deletions
diff --git a/Dockerfile b/Dockerfile
index 17b087b..593505e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,9 +1,9 @@
FROM haskell:8.8
-WORKDIR /opt/cafp
-COPY server/cafp.cabal server/stack.yaml* /opt/cafp/
+WORKDIR /opt/uplcg
+COPY server/uplcg.cabal server/stack.yaml* /opt/uplcg/
RUN stack build --only-dependencies
-COPY server /opt/cafp
+COPY server /opt/uplcg
RUN stack build
-ENV CAFP_HOSTNAME=0.0.0.0 CAFP_PORT=8002 CAFP_BASE=/cafp
+ENV UPLCG_HOSTNAME=0.0.0.0 UPLCG_PORT=8002 UPLCG_BASE=/uplcg
EXPOSE 8002
-CMD stack exec cafp-server
+CMD stack exec uplcg-server
diff --git a/Makefile b/Makefile
index 38caaef..e3e7947 100644
--- a/Makefile
+++ b/Makefile
@@ -14,23 +14,23 @@ build: server/assets/client.js \
.PHONY: docker
docker:
- docker build -t jaspervdj/cafp .
- docker push jaspervdj/cafp
+ docker build -t jaspervdj/uplcg .
+ docker push jaspervdj/uplcg
.PHONY: server
server: build
(cd server && \
- CAFP_HOSTNAME=$(CAFP_HOSTNAME) \
- CAFP_PORT=$(CAFP_PORT) \
- CAFP_BASE=$(CAFP_BASE) \
- stack exec cafp-server)
+ UPLCG_HOSTNAME=$(UPLCG_HOSTNAME) \
+ UPLCG_PORT=$(UPLCG_PORT) \
+ UPLCG_BASE=$(UPLCG_BASE) \
+ stack exec uplcg-server)
.PHONY: stack_build
stack_build: $(HS_SOURCES)
(cd server && stack build)
$(ELM_MESSAGES_SOURCE): stack_build
- (cd server && stack exec cafp-generate-elm-types) >$(ELM_MESSAGES_SOURCE)
+ (cd server && stack exec uplcg-generate-elm-types) >$(ELM_MESSAGES_SOURCE)
server/assets/client.js: $(ELM_MESSAGES_SOURCE) $(ELM_SOURCES)
mkdir -p server/assets
@@ -38,8 +38,8 @@ server/assets/client.js: $(ELM_MESSAGES_SOURCE) $(ELM_SOURCES)
.PHONY: server/assets/client.html # Depends on git hash.
server/assets/client.html: client/index.html config.mk
- sed "s@\$$CAFP_BASE@$(CAFP_BASE)@" $< | \
- sed "s@\$$CAFP_VERSION@$(CAFP_VERSION)@" >$@
+ sed "s@\$$UPLCG_BASE@$(UPLCG_BASE)@" $< | \
+ sed "s@\$$UPLCG_VERSION@$(UPLCG_VERSION)@" >$@
server/assets/style.css: client/style.css
cp $< $@
diff --git a/black.txt b/black.txt
index 7c91439..0797970 100644
--- a/black.txt
+++ b/black.txt
@@ -4,7 +4,7 @@
# Some cards taken from:
# https://github.com/CardsAgainstCryptography/CAC/blob/master/src/white.txt
# Slightly modified to take out most sexist / racist / ... stuff and comply
-# with the cafp format. Added more \BLANKs to a few because we can.
+# with the uplcg format. Added more \BLANKs to a few because we can.
A PL conference is never complete without \BLANK.
Both Microsoft and Apple have concerns with \BLANK.
Did you hear that \BLANK is the new hot topic?
diff --git a/client/index.html b/client/index.html
index 274f533..a03d777 100644
--- a/client/index.html
+++ b/client/index.html
@@ -3,12 +3,12 @@
<head>
<meta charset="UTF-8">
<title>Client</title>
- <link rel="stylesheet" type="text/css" href="$CAFP_BASE/assets/style.css">
+ <link rel="stylesheet" type="text/css" href="$UPLCG_BASE/assets/style.css">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div id="main"></div>
- <script type="text/JavaScript" src="$CAFP_BASE/assets/client.js"></script>
+ <script type="text/JavaScript" src="$UPLCG_BASE/assets/client.js"></script>
<script>
var app = Elm.Client.init({node: document.querySelector("main")});
@@ -18,12 +18,12 @@
protocol = "wss:"
}
var path = document.location.pathname;
- if(path.startsWith("$CAFP_BASE")) {
- path = path.substr("$CAFP_BASE".length);
+ if(path.startsWith("$UPLCG_BASE")) {
+ path = path.substr("$UPLCG_BASE".length);
}
var roomId = path.split("/")[2];
var url = protocol + "//" + document.location.host +
- "$CAFP_BASE/rooms/" + roomId + "/events";
+ "$UPLCG_BASE/rooms/" + roomId + "/events";
var socket = new WebSocket(url);
var socketSend = function(message) {
@@ -46,6 +46,6 @@
connect();
</script>
- <footer>CaFP version $CAFP_VERSION</footer>
+ <footer>Untitled PL Card Game version $UPLCG_VERSION</footer>
</body>
</html>
diff --git a/client/src/Client.elm b/client/src/Client.elm
index 840e9b6..6e987e7 100644
--- a/client/src/Client.elm
+++ b/client/src/Client.elm
@@ -74,14 +74,14 @@ viewPlayers players = Html.table [] <|
view : Model -> Browser.Document Msg
view model = case model of
Error str ->
- { title = "CaFP: Error"
+ { title = "Untitled PL Card Game: Error"
, body =
[ Html.h1 [] [Html.text "Error"]
, Html.p [] [Html.text str]
]
}
Connecting roomId ->
- { title = "CaFP: Connecting"
+ { title = "Untitled PL Card Game: Connecting"
, body =
[ Html.h1 []
[ Html.text <|
@@ -91,8 +91,8 @@ view model = case model of
}
Game game ->
{ title = case game.room of
- Nothing -> "CaFP"
- Just room -> "CaFP | " ++ room
+ Nothing -> "Untitled PL Card Game"
+ Just room -> room ++ " | Untitled PL Card Game"
, body =
[ Html.div [Html.Attributes.class "main"] <|
[ Html.div [Html.Attributes.class "table"]
diff --git a/config.mk b/config.mk
index c31f939..5fd098d 100644
--- a/config.mk
+++ b/config.mk
@@ -1,4 +1,4 @@
-CAFP_HOSTNAME=0.0.0.0
-CAFP_PORT=8002
-CAFP_BASE=/cafp
-CAFP_VERSION=$(shell git rev-parse HEAD | head -c8)
+UPLCG_HOSTNAME=0.0.0.0
+UPLCG_PORT=8002
+UPLCG_BASE=/uplcg
+UPLCG_VERSION=$(shell git rev-parse HEAD | head -c8)
diff --git a/server/lib/Cafp/CookieSocket.hs b/server/lib/Uplcg/CookieSocket.hs
index 5770a3b..7efb8b2 100644
--- a/server/lib/Cafp/CookieSocket.hs
+++ b/server/lib/Uplcg/CookieSocket.hs
@@ -2,7 +2,7 @@
-- side.
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
-module Cafp.CookieSocket
+module Uplcg.CookieSocket
( Handle
, withHandle
, CookieName
diff --git a/server/lib/Cafp/Game.hs b/server/lib/Uplcg/Game.hs
index 9ed3cc1..02e40cb 100644
--- a/server/lib/Cafp/Game.hs
+++ b/server/lib/Uplcg/Game.hs
@@ -3,7 +3,7 @@
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
-module Cafp.Game
+module Uplcg.Game
( PlayerId
, Table (..)
, Player (..)
@@ -19,7 +19,7 @@ module Cafp.Game
, gameViewForPlayer
) where
-import Cafp.Messages
+import Uplcg.Messages
import Control.Lens (Lens', at, iall, ifor_, imap, ix,
orOf, to, (%%=), (%=), (%~), (&),
(+=), (.=), (.~), (^.), (^..),
diff --git a/server/lib/Cafp/Main/GenerateElmTypes.hs b/server/lib/Uplcg/Main/GenerateElmTypes.hs
index ccf19e8..bc2481c 100644
--- a/server/lib/Cafp/Main/GenerateElmTypes.hs
+++ b/server/lib/Uplcg/Main/GenerateElmTypes.hs
@@ -1,10 +1,10 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE TemplateHaskell #-}
-module Cafp.Main.GenerateElmTypes
+module Uplcg.Main.GenerateElmTypes
( main
) where
-import Cafp.Messages
+import Uplcg.Messages
import Data.Proxy
import Elm.Module
diff --git a/server/lib/Cafp/Main/Server.hs b/server/lib/Uplcg/Main/Server.hs
index ba2425d..a2914ab 100644
--- a/server/lib/Cafp/Main/Server.hs
+++ b/server/lib/Uplcg/Main/Server.hs
@@ -1,17 +1,14 @@
{-# LANGUAGE OverloadedStrings #-}
-module Cafp.Main.Server
+module Uplcg.Main.Server
( main
) where
-import qualified Cafp.CookieSocket as CookieSocket
-import Cafp.Game
-import Cafp.Messages
import Control.Concurrent.MVar (MVar)
import qualified Control.Concurrent.MVar as MVar
import Control.Concurrent.STM (STM, TVar, atomically)
import qualified Control.Concurrent.STM as STM
import Control.Exception (bracket)
-import Control.Lens ((^.), (&), (.~))
+import Control.Lens ((&), (.~), (^.))
import Control.Monad (forever, when)
import qualified Data.Aeson as Aeson
import qualified Data.ByteString as B
@@ -33,6 +30,9 @@ import qualified Network.WebSockets as WS
import System.Environment (getEnv)
import qualified System.Log.FastLogger as FL
import System.Random (StdGen, newStdGen)
+import qualified Uplcg.CookieSocket as CookieSocket
+import Uplcg.Game
+import Uplcg.Messages
import qualified Web.Scotty as Scotty
type RoomId = T.Text
@@ -200,9 +200,9 @@ baseUrl prefix application = \req ->
main :: IO ()
main = do
- host <- fromString <$> getEnv "CAFP_HOSTNAME"
- port <- read <$> getEnv "CAFP_PORT"
- base <- splitPath . T.pack <$> getEnv "CAFP_BASE"
+ host <- fromString <$> getEnv "UPLCG_HOSTNAME"
+ port <- read <$> getEnv "UPLCG_PORT"
+ base <- splitPath . T.pack <$> getEnv "UPLCG_BASE"
let settings = Warp.setPort port . Warp.setHost host $ Warp.defaultSettings
timeCache <- FL.newTimeCache FL.simpleTimeFormat
FL.withTimedFastLogger timeCache
diff --git a/server/lib/Cafp/Messages.hs b/server/lib/Uplcg/Messages.hs
index 5066447..b1627e9 100644
--- a/server/lib/Cafp/Messages.hs
+++ b/server/lib/Uplcg/Messages.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
-module Cafp.Messages
+module Uplcg.Messages
( BlackCard (..)
, WhiteCard (..)
, Cards (..)
diff --git a/server/src/GenerateElmTypes.hs b/server/src/GenerateElmTypes.hs
index c85aaf3..7fbca10 100644
--- a/server/src/GenerateElmTypes.hs
+++ b/server/src/GenerateElmTypes.hs
@@ -1,4 +1,4 @@
-import qualified Cafp.Main.GenerateElmTypes
+import qualified Uplcg.Main.GenerateElmTypes
main :: IO ()
-main = Cafp.Main.GenerateElmTypes.main
+main = Uplcg.Main.GenerateElmTypes.main
diff --git a/server/src/Server.hs b/server/src/Server.hs
index fba65ef..95ef75c 100644
--- a/server/src/Server.hs
+++ b/server/src/Server.hs
@@ -1,4 +1,4 @@
-import qualified Cafp.Main.Server
+import qualified Uplcg.Main.Server
main :: IO ()
-main = Cafp.Main.Server.main
+main = Uplcg.Main.Server.main
diff --git a/server/cafp.cabal b/server/uplcg.cabal
index a0eded7..830c01a 100644
--- a/server/cafp.cabal
+++ b/server/uplcg.cabal
@@ -1,6 +1,6 @@
-Name: cafp
+Name: uplcg
Version: 0.1.0
-Synopsis: Cards Against Functional Programming
+Synopsis: Untitled PL Card Game
License: BSD3
License-file: LICENSE
Author: Jasper Van der Jeugt <m@jaspervdj.be>
@@ -16,11 +16,11 @@ Library
Hs-source-dirs: lib
Exposed-modules:
- Cafp.CookieSocket
- Cafp.Game
- Cafp.Messages
- Cafp.Main.GenerateElmTypes
- Cafp.Main.Server
+ Uplcg.CookieSocket
+ Uplcg.Game
+ Uplcg.Messages
+ Uplcg.Main.GenerateElmTypes
+ Uplcg.Main.Server
Build-depends:
aeson >= 1.4 && < 1.5,
@@ -48,16 +48,16 @@ Library
warp >= 3.3 && < 3.4,
websockets >= 0.12 && < 0.13
-Executable cafp-generate-elm-types
+Executable uplcg-generate-elm-types
Hs-source-dirs: src
Main-is: GenerateElmTypes.hs
Default-language: Haskell2010
Ghc-options: -Wall
- Build-depends: base, cafp
+ Build-depends: base, uplcg
-Executable cafp-server
+Executable uplcg-server
Hs-source-dirs: src
Main-is: Server.hs
Default-language: Haskell2010
Ghc-options: -Wall -O2 -threaded -rtsopts "-with-rtsopts=-N"
- Build-depends: base, cafp
+ Build-depends: base, uplcg