1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-23 04:42:24 +03:00

Bump all versions

This commit is contained in:
Artyom Kazak 2018-08-20 00:25:38 +02:00
parent 881832f227
commit 227112e84e
12 changed files with 52 additions and 56 deletions

View File

@ -11,7 +11,7 @@ author: Artyom
maintainer: yom@artyom.me maintainer: yom@artyom.me
-- copyright: -- copyright:
category: Web category: Web
tested-with: GHC == 8.0.1 tested-with: GHC == 8.2.2
build-type: Custom build-type: Custom
extra-source-files: extra-source-files:
CHANGELOG.md CHANGELOG.md
@ -85,11 +85,11 @@ library
Imports Imports
build-depends: Spock build-depends: Spock
, Spock-digestive , Spock-digestive
, Spock-lucid == 0.3.* , Spock-lucid == 0.4.*
, acid-state == 0.14.* , acid-state == 0.14.*
, aeson == 1.0.* , aeson == 1.2.*
, aeson-pretty , aeson-pretty
, base >=4.9 && <4.10 , base == 4.10.*
, base-prelude , base-prelude
, bytestring , bytestring
, cereal , cereal
@ -105,7 +105,7 @@ library
, ekg-core , ekg-core
, exceptions , exceptions
, extra , extra
, feed >= 0.3.11 && < 0.4 , feed == 1.0.*
, filemanip == 0.3.6.* , filemanip == 0.3.6.*
, filepath , filepath
, fmt == 0.4.* , fmt == 0.4.*
@ -122,7 +122,7 @@ library
, ilist , ilist
, iproute == 1.7.* , iproute == 1.7.*
, lucid >= 2.9.5 && < 3 , lucid >= 2.9.5 && < 3
, megaparsec == 5.* , megaparsec == 6.*
, microlens-platform >= 0.3.2 , microlens-platform >= 0.3.2
, mmorph == 1.* , mmorph == 1.*
, mtl >= 2.1.1 , mtl >= 2.1.1
@ -134,7 +134,7 @@ library
, reroute , reroute
, safe , safe
, safecopy , safecopy
, safecopy-migrate , safecopy-migrate == 0.2.*
, say , say
, scrypt , scrypt
, servant-generic , servant-generic
@ -159,7 +159,8 @@ library
, wai-middleware-static , wai-middleware-static
, wai-cors , wai-cors
, warp , warp
, xml , xml-conduit
, xml-types
, xss-sanitize , xss-sanitize
ghc-options: -Wall -fno-warn-unused-do-bind ghc-options: -Wall -fno-warn-unused-do-bind
hs-source-dirs: src hs-source-dirs: src
@ -185,7 +186,7 @@ test-suite tests
MergeSpec MergeSpec
Selenium Selenium
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
build-depends: QuickCheck < 2.10 build-depends: QuickCheck < 3
, base < 5 , base < 5
, base-prelude , base-prelude
, cmark , cmark

View File

@ -26,7 +26,6 @@ import qualified Text.Feed.Util as Feed
import qualified Text.Atom.Feed as Atom import qualified Text.Atom.Feed as Atom
-- Text -- Text
import qualified Data.Text.All as T import qualified Data.Text.All as T
import qualified Data.Text.Lazy.All as TL
-- Web -- Web
import Web.Spock hiding (head, get, renderRoute, text) import Web.Spock hiding (head, get, renderRoute, text)
import qualified Web.Spock as Spock import qualified Web.Spock as Spock
@ -360,16 +359,15 @@ otherMethods = do
where cmp = comparing (^.created) <> comparing (^.uid) where cmp = comparing (^.created) <> comparing (^.uid)
let route = "feed" <//> categoryVar let route = "feed" <//> categoryVar
let feedUrl = baseUrl // Spock.renderRoute route (category^.uid) let feedUrl = baseUrl // Spock.renderRoute route (category^.uid)
feedTitle = Atom.TextString (T.unpack (category^.title) ++ feedTitle = Atom.TextString (category^.title <> " Haskell Aelve Guide")
" Haskell Aelve Guide")
feedLastUpdate = case sortedItems of feedLastUpdate = case sortedItems of
(item:_) -> Feed.toFeedDateStringUTC Feed.AtomKind (item^.created) item:_ -> Feed.toFeedDateStringUTC Feed.AtomKind (item^.created)
_ -> "" _ -> ""
let feedBase = Atom.nullFeed (T.unpack feedUrl) feedTitle feedLastUpdate let feedBase = Atom.nullFeed feedUrl feedTitle (T.toStrict feedLastUpdate)
entries <- liftIO $ mapM (itemToFeedEntry baseUrl category) sortedItems entries <- liftIO $ mapM (itemToFeedEntry baseUrl category) sortedItems
atomFeed $ feedBase { atomFeed $ feedBase {
Atom.feedEntries = entries, Atom.feedEntries = entries,
Atom.feedLinks = [Atom.nullLink (T.unpack feedUrl)] } Atom.feedLinks = [Atom.nullLink feedUrl] }
adminMethods :: AdminM ctx () adminMethods :: AdminM ctx ()
adminMethods = do adminMethods = do
@ -426,12 +424,12 @@ itemToFeedEntry
itemToFeedEntry baseUrl category item = do itemToFeedEntry baseUrl category item = do
entryContent <- Lucid.renderTextT (renderItemForFeed category item) entryContent <- Lucid.renderTextT (renderItemForFeed category item)
return entryBase { return entryBase {
Atom.entryLinks = [Atom.nullLink (T.unpack entryLink)], Atom.entryLinks = [Atom.nullLink entryLink],
Atom.entryContent = Just (Atom.HTMLContent (TL.unpack entryContent)) } Atom.entryContent = Just (Atom.HTMLContent (T.toStrict entryContent)) }
where where
entryLink = baseUrl // entryLink = baseUrl //
format "{}#item-{}" (categorySlug category) (item^.uid) format "{}#item-{}" (categorySlug category) (item^.uid)
entryBase = Atom.nullEntry entryBase = Atom.nullEntry
(T.unpack (uidToText (item^.uid))) (uidToText (item^.uid))
(Atom.TextString (T.unpack (item^.name))) (Atom.TextString (item^.name))
(Feed.toFeedDateStringUTC Feed.AtomKind (item^.created)) (T.toStrict (Feed.toFeedDateStringUTC Feed.AtomKind (item^.created)))

View File

@ -38,7 +38,7 @@ module Guide.Markdown
where where
import Imports import Imports hiding (some)
-- Text -- Text
import qualified Data.Text.All as T import qualified Data.Text.All as T
@ -47,7 +47,7 @@ import qualified Data.ByteString.Lazy as BSL
import qualified Data.ByteString as BS import qualified Data.ByteString as BS
-- Parsing -- Parsing
import Text.Megaparsec hiding (State) import Text.Megaparsec hiding (State)
import Text.Megaparsec.Text import Text.Megaparsec.Char
-- JSON -- JSON
import qualified Data.Aeson as A import qualified Data.Aeson as A
-- HTML -- HTML
@ -230,7 +230,7 @@ parseLink = either (Left . show) Right . parse p ""
shortcut = some (alphaNumChar <|> char '-') shortcut = some (alphaNumChar <|> char '-')
opt = char '(' *> some (noneOf [')']) <* char ')' opt = char '(' *> some (noneOf [')']) <* char ')'
text = char ':' *> some anyChar text = char ':' *> some anyChar
p :: Parser (Text, Maybe Text, Maybe Text) p :: Parsec Void Text (Text, Maybe Text, Maybe Text)
p = do p = do
char '@' char '@'
(,,) <$> T.pack <$> shortcut (,,) <$> T.pack <$> shortcut

View File

@ -65,7 +65,6 @@ import qualified Data.Text.All as T
import qualified Data.Set as S import qualified Data.Set as S
-- JSON -- JSON
import qualified Data.Aeson as A import qualified Data.Aeson as A
import qualified Data.Aeson.Types as A
-- acid-state -- acid-state
import Data.SafeCopy hiding (kind) import Data.SafeCopy hiding (kind)
import Data.SafeCopy.Migrate import Data.SafeCopy.Migrate

View File

@ -71,9 +71,9 @@ unwrapSession (GuideSession {..}) = Spock.Session {
} }
wrapSession :: SpockSession conn st -> GuideSession wrapSession :: SpockSession conn st -> GuideSession
wrapSession (Spock.Session {..}) = GuideSession { wrapSession s = GuideSession {
_sess_id = sess_id, _sess_id = Spock.sess_id s,
_sess_csrfToken = sess_csrfToken, _sess_csrfToken = Spock.sess_csrfToken s,
_sess_validUntil = sess_validUntil, _sess_validUntil = Spock.sess_validUntil s,
_sess_data = sess_data _sess_data = Spock.sess_data s
} }

View File

@ -102,7 +102,8 @@ import qualified Network.Wai as Wai
-- Feeds -- Feeds
import qualified Text.Atom.Feed as Atom import qualified Text.Atom.Feed as Atom
import qualified Text.Atom.Feed.Export as Atom import qualified Text.Atom.Feed.Export as Atom
import qualified Text.XML.Light.Output as XML import qualified Text.XML as XMLC
import qualified Data.XML.Types as XML
-- acid-state -- acid-state
import Data.SafeCopy import Data.SafeCopy
-- Template Haskell -- Template Haskell
@ -445,7 +446,8 @@ includeCSS url = link_ [rel_ "stylesheet", type_ "text/css", href_ url]
atomFeed :: MonadIO m => Atom.Feed -> ActionCtxT ctx m () atomFeed :: MonadIO m => Atom.Feed -> ActionCtxT ctx m ()
atomFeed feed = do atomFeed feed = do
setHeader "Content-Type" "application/atom+xml; charset=utf-8" setHeader "Content-Type" "application/atom+xml; charset=utf-8"
bytes $ T.toByteString (XML.ppElement (Atom.xmlFeed feed)) lazyBytes $ either (const "") (XMLC.renderLBS XMLC.def) $ XMLC.fromXMLDocument $
XML.Document (XML.Prologue [] Nothing []) (Atom.xmlFeed feed) []
-- | Get details of the request: -- | Get details of the request:
-- --

View File

@ -58,7 +58,7 @@ module Guide.Views.Utils
where where
import Imports import Imports hiding (some)
-- Web -- Web
import Web.Spock import Web.Spock
@ -90,7 +90,7 @@ import qualified Data.ByteString.Lazy.Char8 as BS
import qualified Data.Semigroup as Semigroup import qualified Data.Semigroup as Semigroup
import qualified Data.List.NonEmpty as NonEmpty import qualified Data.List.NonEmpty as NonEmpty
import Text.Megaparsec import Text.Megaparsec
import Text.Megaparsec.Text import Text.Megaparsec.Char
import Guide.App import Guide.App
-- import Guide.Config -- import Guide.Config
@ -304,7 +304,7 @@ mustache f v = do
error "View.mustache: no HTML templates found in templates/" error "View.mustache: no HTML templates found in templates/"
parsed <- for templates $ \(tname, t) -> do parsed <- for templates $ \(tname, t) -> do
let pname = fromString (T.unpack tname) let pname = fromString (T.unpack tname)
case compileMustacheText pname (T.toLazy t) of case compileMustacheText pname t of
Left e -> error $ printf "View.mustache: when parsing %s: %s" Left e -> error $ printf "View.mustache: when parsing %s: %s"
tname (parseErrorPretty e) tname (parseErrorPretty e)
Right template -> return template Right template -> return template
@ -340,7 +340,7 @@ readWidget fp = liftIO $ do
go (x:y:xs) = (T.strip (last x), unlinesSection (init y)) : go (y : xs) go (x:y:xs) = (T.strip (last x), unlinesSection (init y)) : go (y : xs)
go _ = error $ "View.readWidget: couldn't read " ++ fp go _ = error $ "View.readWidget: couldn't read " ++ fp
let sections = go (splitWhen isDivide (T.lines s)) let sections = go (splitWhen isDivide (T.lines s))
let sectionTypeP :: Parser SectionType let sectionTypeP :: Parsec Void Text SectionType
sectionTypeP = choice [ sectionTypeP = choice [
do string "HTML" do string "HTML"
HTML_ <$> choice [ HTML_ <$> choice [

View File

@ -14,14 +14,13 @@ where
import BasePrelude as X import BasePrelude as X
hiding (Category, GeneralCategory, lazy, (&), Handler) hiding (Category, GeneralCategory, lazy, Handler, diff, option)
-- Lists -- Lists
import Data.List.Extra as X (dropEnd, takeEnd) import Data.List.Extra as X (dropEnd, takeEnd)
import Data.List.Index as X import Data.List.Index as X
-- Lenses -- Lenses
import Lens.Micro.Platform as X import Lens.Micro.Platform as X
-- Monads and monad transformers -- Monads and monad transformers
import Control.Monad.IO.Class as X
import Control.Monad.Reader as X import Control.Monad.Reader as X
import Control.Monad.State as X import Control.Monad.State as X
import Control.Monad.Except as X import Control.Monad.Except as X

View File

@ -1,24 +1,22 @@
resolver: lts-8.13 resolver: lts-11.13
packages: packages:
- location: . - location: .
- location:
git: https://github.com/aelve/stache-plus
commit: 789aeabbf8069dec80647160f127d047e8f5a330
extra-dep: true
- location:
git: https://github.com/aelve/safecopy-migrate
commit: 26e5f8c7f62ebce66ef19e5bd573af21c16fe2b1
extra-dep: true
nix: nix:
shell-file: shell.nix shell-file: shell.nix
extra-deps: extra-deps:
- text-all-0.4.1.0 - text-all-0.4.2
- cmark-sections-0.3.0 - cmark-sections-0.3.0.1
- patches-vector-0.1.5.4
- fmt-0.4.0.0 - fmt-0.4.0.0
- Spock-digestive-0.3.0.0 - Spock-digestive-0.3.0.0
- digestive-functors-0.8.2.0 - digestive-functors-0.8.4.0
- servant-generic-0.1.0.0 - servant-generic-0.1.0.3
- acid-state-0.14.3
- git: https://github.com/neongreen/patches-vector
commit: 9bb704cf7f14cff9ef76a5d177e4e56ceee24705
- git: https://github.com/aelve/stache-plus
commit: e2a8d986bd4014f889d3fa60a64e8db0ea199885
- git: https://github.com/aelve/safecopy-migrate
commit: c401315122f04624e5e848d77f9eaa948e38c21b

View File

@ -56,11 +56,10 @@ module Selenium
where where
import BasePrelude hiding (catch, bracket) import BasePrelude hiding (catch, bracket, (:|))
-- Lenses -- Lenses
import Lens.Micro.Platform import Lens.Micro.Platform
-- Monads -- Monads
import Control.Monad.IO.Class
import Control.Monad.Loops import Control.Monad.Loops
-- Containers -- Containers
import qualified Data.Set as Set import qualified Data.Set as Set

View File

@ -2,6 +2,7 @@
{-# LANGUAGE IncoherentInstances #-} {-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE MonoLocalBinds #-}
module WebSpec (tests) where module WebSpec (tests) where
@ -9,7 +10,6 @@ module WebSpec (tests) where
import BasePrelude hiding (catch, bracket) import BasePrelude hiding (catch, bracket)
-- Monads -- Monads
import Control.Monad.IO.Class
import Control.Monad.Loops import Control.Monad.Loops
-- Concurrency -- Concurrency
import qualified SlaveThread as Slave import qualified SlaveThread as Slave