conduit 0.5

This commit is contained in:
Michael Snoyman 2012-06-22 15:28:14 +03:00
parent 0e0880dfe4
commit ebc737a5cb
21 changed files with 155 additions and 224 deletions

View File

@ -1,5 +1,5 @@
name: yesod-auth
version: 1.0.2.1
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin
@ -12,44 +12,34 @@ build-type: Simple
homepage: http://www.yesodweb.com/
description: Authentication for Yesod.
flag blaze_html_0_5
description: use blaze-html 0.5 and blaze-markup 0.5
default: True
library
build-depends: base >= 4 && < 5
, authenticate >= 1.2.1 && < 1.3
, authenticate >= 1.3 && < 1.4
, bytestring >= 0.9.1.4
, yesod-core >= 1.0 && < 1.1
, wai >= 1.2 && < 1.3
, yesod-core >= 1.1 && < 1.2
, wai >= 1.3 && < 1.4
, template-haskell
, pureMD5 >= 2.0 && < 2.2
, random >= 1.0.0.2 && < 1.1
, text >= 0.7 && < 0.12
, mime-mail >= 0.3 && < 0.5
, yesod-persistent >= 1.0 && < 1.1
, yesod-persistent >= 1.1 && < 1.2
, hamlet >= 1.0 && < 1.1
, shakespeare-css >= 1.0 && < 1.1
, yesod-json >= 1.0 && < 1.1
, yesod-json >= 1.1 && < 1.2
, containers
, unordered-containers
, yesod-form >= 1.0 && < 1.1
, yesod-form >= 1.1 && < 1.2
, transformers >= 0.2.2 && < 0.4
, persistent >= 0.9 && < 0.10
, persistent-template >= 0.9 && < 0.10
, persistent >= 1.0 && < 1.1
, persistent-template >= 1.0 && < 1.1
, SHA >= 1.4.1.3 && < 1.6
, http-conduit >= 1.4.1.1 && < 1.5
, http-conduit >= 1.5 && < 1.6
, aeson >= 0.5
, pwstore-fast >= 2.2 && < 3
, lifted-base >= 0.1 && < 0.2
if flag(blaze_html_0_5)
build-depends:
blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
else
build-depends:
blaze-html >= 0.4 && < 0.5
, blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
exposed-modules: Yesod.Auth
Yesod.Auth.BrowserId

View File

@ -60,7 +60,7 @@ type Texts = [Text]
-- is used for creating sites, /not/ subsites. See 'mkYesodSub' for the latter.
-- Use 'parseRoutes' to create the 'Resource's.
mkYesod :: String -- ^ name of the argument datatype
-> [Resource String]
-> [ResourceTree String]
-> Q [Dec]
mkYesod name = fmap (uncurry (++)) . mkYesodGeneral name [] [] False
@ -71,7 +71,7 @@ mkYesod name = fmap (uncurry (++)) . mkYesodGeneral name [] [] False
-- be embedded in other sites.
mkYesodSub :: String -- ^ name of the argument datatype
-> Cxt
-> [Resource String]
-> [ResourceTree String]
-> Q [Dec]
mkYesodSub name clazzes =
fmap (uncurry (++)) . mkYesodGeneral name' rest clazzes True
@ -82,28 +82,28 @@ mkYesodSub name clazzes =
-- your handlers elsewhere. For example, this is the only way to break up a
-- monolithic file into smaller parts. Use this function, paired with
-- 'mkYesodDispatch', to do just that.
mkYesodData :: String -> [Resource String] -> Q [Dec]
mkYesodData :: String -> [ResourceTree String] -> Q [Dec]
mkYesodData name res = mkYesodDataGeneral name [] False res
mkYesodSubData :: String -> Cxt -> [Resource String] -> Q [Dec]
mkYesodSubData :: String -> Cxt -> [ResourceTree String] -> Q [Dec]
mkYesodSubData name clazzes res = mkYesodDataGeneral name clazzes True res
mkYesodDataGeneral :: String -> Cxt -> Bool -> [Resource String] -> Q [Dec]
mkYesodDataGeneral :: String -> Cxt -> Bool -> [ResourceTree String] -> Q [Dec]
mkYesodDataGeneral name clazzes isSub res = do
let (name':rest) = words name
(x, _) <- mkYesodGeneral name' rest clazzes isSub res
let rname = mkName $ "resources" ++ name
eres <- lift res
let y = [ SigD rname $ ListT `AppT` (ConT ''Resource `AppT` ConT ''String)
let y = [ SigD rname $ ListT `AppT` (ConT ''ResourceTree `AppT` ConT ''String)
, FunD rname [Clause [] (NormalB eres) []]
]
return $ x ++ y
-- | See 'mkYesodData'.
mkYesodDispatch :: String -> [Resource String] -> Q [Dec]
mkYesodDispatch :: String -> [ResourceTree String] -> Q [Dec]
mkYesodDispatch name = fmap snd . mkYesodGeneral name [] [] False
mkYesodSubDispatch :: String -> Cxt -> [Resource String] -> Q [Dec]
mkYesodSubDispatch :: String -> Cxt -> [ResourceTree String] -> Q [Dec]
mkYesodSubDispatch name clazzes = fmap snd . mkYesodGeneral name' rest clazzes True
where (name':rest) = words name
@ -111,7 +111,7 @@ mkYesodGeneral :: String -- ^ foundation type
-> [String]
-> Cxt -- ^ classes
-> Bool -- ^ is subsite?
-> [Resource String]
-> [ResourceTree String]
-> Q ([Dec], [Dec])
mkYesodGeneral name args clazzes isSub resS = do
let args' = map mkName args
@ -130,7 +130,7 @@ mkYesodGeneral name args clazzes isSub resS = do
let yesodDispatch' =
InstanceD ctx ytyp [FunD (mkName "yesodDispatch") [disp]]
return (renderRouteDec : masterTypSyns, [yesodDispatch'])
return (renderRouteDec ++ masterTypSyns, [yesodDispatch'])
where
name' = mkName name
masterTypSyns

View File

@ -333,7 +333,7 @@ runRequestBody = do
rbHelper :: W.Request -> ResourceT IO RequestBodyContents
rbHelper req =
(map fix1 *** map fix2) <$> (NWP.parseRequestBody NWP.lbsBackEnd req)
(map fix1 *** map fix2) <$> (NWP.parseRequestBody NWP.lbsSink req) -- FIXME allow control over which backend to use
where
fix1 = go *** go
fix2 (x, NWP.FileInfo a b c) =

View File

@ -1,5 +1,5 @@
name: yesod-core
version: 1.0.1.2
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -40,10 +40,6 @@ flag test
description: Build the executable to run unit tests
default: False
flag blaze_html_0_5
description: use blaze-html 0.5 and blaze-markup 0.5
default: True
library
-- Work around a bug in cabal. Without this, wai-test doesn't get built and
-- we have a missing dependency during --enable-tests builds.
@ -52,9 +48,9 @@ library
build-depends: base >= 4.3 && < 5
, time >= 1.1.4
, yesod-routes >= 1.0 && < 1.1
, wai >= 1.2 && < 1.3
, wai-extra >= 1.2 && < 1.3
, yesod-routes >= 1.1 && < 1.2
, wai >= 1.3 && < 1.4
, wai-extra >= 1.3 && < 1.4
, bytestring >= 0.9.1.4
, text >= 0.7 && < 0.12
, template-haskell
@ -83,17 +79,11 @@ library
, aeson >= 0.5
, fast-logger >= 0.0.2
, wai-logger >= 0.0.1
, conduit >= 0.4 && < 0.5
, conduit >= 0.5 && < 0.6
, resourcet >= 0.3 && < 0.4
, lifted-base >= 0.1 && < 0.2
if flag(blaze_html_0_5)
build-depends:
blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
else
build-depends:
blaze-html >= 0.4 && < 0.5
, blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
exposed-modules: Yesod.Content
Yesod.Core

View File

@ -1,5 +1,5 @@
name: yesod-default
version: 1.0.1.1
version: 1.1.0
license: MIT
license-file: LICENSE
author: Patrick Brisbin
@ -18,10 +18,10 @@ library
cpp-options: -DWINDOWS
build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1
, warp >= 1.2 && < 1.3
, wai >= 1.2 && < 1.3
, wai-extra >= 1.2 && < 1.3
, yesod-core >= 1.1 && < 1.2
, warp >= 1.3 && < 1.4
, wai >= 1.3 && < 1.4
, wai-extra >= 1.3 && < 1.4
, bytestring >= 0.9.1.4
, transformers >= 0.2.2 && < 0.4
, text >= 0.9
@ -29,8 +29,8 @@ library
, shakespeare-css >= 1.0 && < 1.1
, shakespeare-js >= 1.0 && < 1.1
, template-haskell
, yaml >= 0.7 && < 0.8
, network-conduit >= 0.4 && < 0.5
, yaml >= 0.8 && < 0.9
, network-conduit >= 0.5 && < 0.6
, unordered-containers
if !os(windows)

View File

@ -1,5 +1,5 @@
name: yesod-form
version: 1.0.0.4
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -12,19 +12,15 @@ build-type: Simple
homepage: http://www.yesodweb.com/
description: Form handling support for Yesod Web Framework
flag blaze_html_0_5
description: use blaze-html 0.5 and blaze-markup 0.5
default: True
library
build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1
, yesod-persistent >= 1.0 && < 1.1
, yesod-core >= 1.1 && < 1.2
, yesod-persistent >= 1.1 && < 1.2
, time >= 1.1.4
, hamlet >= 1.0 && < 1.1
, shakespeare-css >= 1.0 && < 1.1
, shakespeare-js >= 1.0 && < 1.1
, persistent >= 0.9 && < 0.10
, persistent >= 1.0 && < 1.1
, template-haskell
, transformers >= 0.2.2 && < 0.4
, data-default >= 0.3 && < 0.5
@ -34,16 +30,10 @@ library
, email-validate >= 0.2.6 && < 0.3
, bytestring >= 0.9.1.4
, text >= 0.9 && < 1.0
, wai >= 1.2 && < 1.3
, wai >= 1.3 && < 1.4
, containers >= 0.2
if flag(blaze_html_0_5)
build-depends:
blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
else
build-depends:
blaze-html >= 0.4 && < 0.5
, blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
exposed-modules: Yesod.Form
Yesod.Form.Class

View File

@ -1,5 +1,5 @@
name: yesod-json
version: 1.0.0.1
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -14,19 +14,19 @@ description: Generate content for Yesod using the aeson package.
library
build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1
, yesod-routes >= 1.0 && < 1.1
, yesod-core >= 1.1 && < 1.2
, yesod-routes >= 1.1 && < 1.2
, aeson >= 0.5
, text >= 0.8 && < 1.0
, shakespeare-js >= 1.0 && < 1.1
, vector >= 0.9
, containers >= 0.2
, blaze-builder
, attoparsec-conduit >= 0.4 && < 0.5
, conduit >= 0.4 && < 0.5
, attoparsec-conduit >= 0.5 && < 0.6
, conduit >= 0.5 && < 0.6
, transformers >= 0.2.2 && < 0.4
, wai >= 1.2 && < 1.3
, wai-extra >= 1.2 && < 1.3
, wai >= 1.3 && < 1.4
, wai-extra >= 1.3 && < 1.4
, bytestring >= 0.9
, safe >= 0.2 && < 0.4
exposed-modules: Yesod.Json

View File

@ -31,11 +31,8 @@ import qualified Data.ByteString.Char8 as S8
import Data.Text (Text)
import Data.Text.Lazy (toStrict)
import Text.XML
#if MIN_VERSION_blaze_html(0, 5, 0)
import Text.Blaze.Html.Renderer.Text (renderHtml)
#else
import Text.Blaze.Renderer.Text (renderHtml)
#endif
import qualified Data.Map as Map
newtype RepAtom = RepAtom Content
instance HasReps RepAtom where
@ -55,21 +52,21 @@ template Feed {..} render =
addNS' n = n
namespace = "http://www.w3.org/2005/Atom"
root = Element "feed" [] $ map NodeElement
$ Element "title" [] [NodeContent feedTitle]
: Element "link" [("rel", "self"), ("href", render feedLinkSelf)] []
: Element "link" [("href", render feedLinkHome)] []
: Element "updated" [] [NodeContent $ formatW3 feedUpdated]
: Element "id" [] [NodeContent $ render feedLinkHome]
root = Element "feed" Map.empty $ map NodeElement
$ Element "title" Map.empty [NodeContent feedTitle]
: Element "link" (Map.fromList [("rel", "self"), ("href", render feedLinkSelf)]) []
: Element "link" (Map.singleton "href" $ render feedLinkHome) []
: Element "updated" Map.empty [NodeContent $ formatW3 feedUpdated]
: Element "id" Map.empty [NodeContent $ render feedLinkHome]
: map (flip entryTemplate render) feedEntries
entryTemplate :: FeedEntry url -> (url -> Text) -> Element
entryTemplate FeedEntry {..} render = Element "entry" [] $ map NodeElement
[ Element "id" [] [NodeContent $ render feedEntryLink]
, Element "link" [("href", render feedEntryLink)] []
, Element "updated" [] [NodeContent $ formatW3 feedEntryUpdated]
, Element "title" [] [NodeContent feedEntryTitle]
, Element "content" [("type", "html")] [NodeContent $ toStrict $ renderHtml feedEntryContent]
entryTemplate FeedEntry {..} render = Element "entry" Map.empty $ map NodeElement
[ Element "id" Map.empty [NodeContent $ render feedEntryLink]
, Element "link" (Map.singleton "href" $ render feedEntryLink) []
, Element "updated" Map.empty [NodeContent $ formatW3 feedEntryUpdated]
, Element "title" Map.empty [NodeContent feedEntryTitle]
, Element "content" (Map.singleton "type" "html") [NodeContent $ toStrict $ renderHtml feedEntryContent]
]
-- | Generates a link tag in the head of a widget.

View File

@ -27,11 +27,8 @@ import qualified Data.ByteString.Char8 as S8
import Data.Text (Text, pack)
import Data.Text.Lazy (toStrict)
import Text.XML
#if MIN_VERSION_blaze_html(0, 5, 0)
import Text.Blaze.Html.Renderer.Text (renderHtml)
#else
import Text.Blaze.Renderer.Text (renderHtml)
#endif
import qualified Data.Map as Map
newtype RepRss = RepRss Content
instance HasReps RepRss where
@ -47,26 +44,26 @@ template :: Feed url -> (url -> Text) -> Document
template Feed {..} render =
Document (Prologue [] Nothing []) root []
where
root = Element "rss" [("version", "2.0")] $ return $ NodeElement $ Element "channel" [] $ map NodeElement
$ Element "{http://www.w3.org/2005/Atom}link"
root = Element "rss" (Map.singleton "version" "2.0") $ return $ NodeElement $ Element "channel" Map.empty $ map NodeElement
$ Element "{http://www.w3.org/2005/Atom}link" (Map.fromList
[ ("href", render feedLinkSelf)
, ("rel", "self")
, ("type", pack $ S8.unpack typeRss)
] []
: Element "title" [] [NodeContent feedTitle]
: Element "link" [] [NodeContent $ render feedLinkHome]
: Element "description" [] [NodeContent $ toStrict $ renderHtml feedDescription]
: Element "lastBuildDate" [] [NodeContent $ formatRFC822 feedUpdated]
: Element "language" [] [NodeContent feedLanguage]
]) []
: Element "title" Map.empty [NodeContent feedTitle]
: Element "link" Map.empty [NodeContent $ render feedLinkHome]
: Element "description" Map.empty [NodeContent $ toStrict $ renderHtml feedDescription]
: Element "lastBuildDate" Map.empty [NodeContent $ formatRFC822 feedUpdated]
: Element "language" Map.empty [NodeContent feedLanguage]
: map (flip entryTemplate render) feedEntries
entryTemplate :: FeedEntry url -> (url -> Text) -> Element
entryTemplate FeedEntry {..} render = Element "item" [] $ map NodeElement
[ Element "title" [] [NodeContent feedEntryTitle]
, Element "link" [] [NodeContent $ render feedEntryLink]
, Element "guid" [] [NodeContent $ render feedEntryLink]
, Element "pubDate" [] [NodeContent $ formatRFC822 feedEntryUpdated]
, Element "description" [] [NodeContent $ toStrict $ renderHtml feedEntryContent]
entryTemplate FeedEntry {..} render = Element "item" Map.empty $ map NodeElement
[ Element "title" Map.empty [NodeContent feedEntryTitle]
, Element "link" Map.empty [NodeContent $ render feedEntryLink]
, Element "guid" Map.empty [NodeContent $ render feedEntryLink]
, Element "pubDate" Map.empty [NodeContent $ formatRFC822 feedEntryUpdated]
, Element "description" Map.empty [NodeContent $ toStrict $ renderHtml feedEntryContent]
]
-- | Generates a link tag in the head of a widget.

View File

@ -1,5 +1,5 @@
name: yesod-newsfeed
version: 1.0.0.2
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin
@ -12,26 +12,17 @@ build-type: Simple
homepage: http://www.yesodweb.com/
description: Helper functions and data types for producing News feeds.
flag blaze_html_0_5
description: use blaze-html 0.5 and blaze-markup 0.5
default: True
library
build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1
, yesod-core >= 1.1 && < 1.2
, time >= 1.1.4
, hamlet >= 1.0 && < 1.1
, bytestring >= 0.9.1.4
, text >= 0.9 && < 0.12
, xml-conduit >= 0.7 && < 0.8
if flag(blaze_html_0_5)
build-depends:
blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
else
build-depends:
blaze-html >= 0.4 && < 0.5
, xml-conduit >= 0.8 && < 0.9
, blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
, containers
exposed-modules: Yesod.AtomFeed
, Yesod.RssFeed

View File

@ -1,5 +1,5 @@
name: yesod-persistent
version: 1.0.0.1
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -14,9 +14,9 @@ description: Some helpers for using Persistent from Yesod.
library
build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1
, persistent >= 0.9 && < 0.10
, persistent-template >= 0.9 && < 0.10
, yesod-core >= 1.1 && < 1.2
, persistent >= 1.0 && < 1.1
, persistent-template >= 1.0 && < 1.1
, transformers >= 0.2.2 && < 0.4
exposed-modules: Yesod.Persist
ghc-options: -Wall

View File

@ -77,9 +77,9 @@ mkRenderRouteClauses =
colon <- [|(:)|]
let cons y ys = InfixE (Just y) colon (Just ys)
let pieces = foldr cons (VarE a) piecesSingle
let pieces' = foldr cons (VarE a) piecesSingle
let body = LamE [TupP [VarP a, VarP b]] (TupE [pieces, VarE b]) `AppE` (rr `AppE` VarE child)
let body = LamE [TupP [VarP a, VarP b]] (TupE [pieces', VarE b]) `AppE` (rr `AppE` VarE child)
return $ Clause [pat] (NormalB body) [FunD childRender childClauses]

View File

@ -1,5 +1,5 @@
name: yesod-routes
version: 1.0.1.2
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>

View File

@ -30,6 +30,7 @@ import Data.Time (UTCTime)
import Data.Monoid (mappend)
import Text.XML
import Data.Text (Text, pack)
import qualified Data.Map as Map
data SitemapChangeFreq = Always
| Hourly
@ -66,13 +67,13 @@ template urls render =
addNS' n = n
namespace = "http://www.sitemaps.org/schemas/sitemap/0.9"
root = Element "urlset" [] $ map go urls
root = Element "urlset" Map.empty $ map go urls
go SitemapUrl {..} = NodeElement $ Element "url" [] $ map NodeElement
[ Element "loc" [] [NodeContent $ render sitemapLoc]
, Element "lastmod" [] [NodeContent $ formatW3 sitemapLastMod]
, Element "changefreq" [] [NodeContent $ showFreq sitemapChangeFreq]
, Element "priority" [] [NodeContent $ pack $ show sitemapPriority]
go SitemapUrl {..} = NodeElement $ Element "url" Map.empty $ map NodeElement
[ Element "loc" Map.empty [NodeContent $ render sitemapLoc]
, Element "lastmod" Map.empty [NodeContent $ formatW3 sitemapLastMod]
, Element "changefreq" Map.empty [NodeContent $ showFreq sitemapChangeFreq]
, Element "priority" Map.empty [NodeContent $ pack $ show sitemapPriority]
]
sitemap :: [SitemapUrl (Route master)] -> GHandler sub master RepXml

View File

@ -1,5 +1,5 @@
name: yesod-sitemap
version: 1.0.0.1
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -14,10 +14,11 @@ description: Generate XML sitemaps.
library
build-depends: base >= 4 && < 5
, yesod-core >= 1.0 && < 1.1
, yesod-core >= 1.1 && < 1.2
, time >= 1.1.4
, xml-conduit >= 0.7 && < 0.8
, xml-conduit >= 0.8 && < 0.9
, text
, containers
exposed-modules: Yesod.Sitemap
ghc-options: -Wall

View File

@ -78,19 +78,15 @@ import System.Posix.Types (EpochTime)
import Data.Conduit (($$))
import Data.Conduit.List (sourceList)
import Data.Functor.Identity (runIdentity)
import qualified Filesystem.Path.CurrentOS as F
import Network.Wai.Application.Static
( StaticSettings (..)
, defaultWebAppSettings
, staticApp
, embeddedLookup
, toEmbedded
, toFilePath
, fromFilePath
, FilePath
, ETagLookup
, webAppSettingsWithLookup
, embeddedSettings
)
import WaiAppStatic.Storage.Filesystem (ETagLookup)
-- | Type used for the subsite with static contents.
newtype Static = Static StaticSettings
@ -106,7 +102,7 @@ type StaticRoute = Route Static
static :: Prelude.FilePath -> IO Static
static dir = do
hashLookup <- cachedETagLookup dir
return $ Static $ webAppSettingsWithLookup (toFilePath dir) hashLookup
return $ Static $ webAppSettingsWithLookup (F.decodeString dir) hashLookup
-- | Same as 'static', but does not assumes that the files do not
-- change and checks their modification time whenever a request
@ -114,15 +110,12 @@ static dir = do
staticDevel :: Prelude.FilePath -> IO Static
staticDevel dir = do
hashLookup <- cachedETagLookupDevel dir
return $ Static $ webAppSettingsWithLookup (toFilePath dir) hashLookup
return $ Static $ webAppSettingsWithLookup (F.decodeString dir) hashLookup
-- | Produce a 'Static' based on embedding all of the static
-- files' contents in the executable at compile time.
embed :: Prelude.FilePath -> Q Exp
embed fp =
[|Static (defaultWebAppSettings
{ ssFolder = embeddedLookup (toEmbedded $(embedDir fp))
})|]
embed fp = [|Static (embeddedSettings $(embedDir fp))|]
instance RenderRoute Static where
-- | A route on the static subsite (see also 'staticFiles').
@ -226,18 +219,18 @@ publicFiles :: Prelude.FilePath -> Q [Dec]
publicFiles dir = mkStaticFiles' dir "StaticRoute" False
mkHashMap :: Prelude.FilePath -> IO (M.Map FilePath S8.ByteString)
mkHashMap :: Prelude.FilePath -> IO (M.Map F.FilePath S8.ByteString)
mkHashMap dir = do
fs <- getFileListPieces dir
hashAlist fs >>= return . M.fromList
where
hashAlist :: [[String]] -> IO [(FilePath, S8.ByteString)]
hashAlist :: [[String]] -> IO [(F.FilePath, S8.ByteString)]
hashAlist fs = mapM hashPair fs
where
hashPair :: [String] -> IO (FilePath, S8.ByteString)
hashPair :: [String] -> IO (F.FilePath, S8.ByteString)
hashPair pieces = do let file = pathFromRawPieces dir pieces
h <- base64md5File file
return (toFilePath file, S8.pack h)
return (F.decodeString file, S8.pack h)
pathFromRawPieces :: Prelude.FilePath -> [String] -> Prelude.FilePath
pathFromRawPieces =
@ -248,12 +241,12 @@ pathFromRawPieces =
cachedETagLookupDevel :: Prelude.FilePath -> IO ETagLookup
cachedETagLookupDevel dir = do
etags <- mkHashMap dir
mtimeVar <- newIORef (M.empty :: M.Map FilePath EpochTime)
mtimeVar <- newIORef (M.empty :: M.Map F.FilePath EpochTime)
return $ \f ->
case M.lookup f etags of
Nothing -> return Nothing
Just checksum -> do
fs <- getFileStatus $ fromFilePath f
fs <- getFileStatus $ F.encodeString f
let newt = modificationTime fs
mtimes <- readIORef mtimeVar
oldt <- case M.lookup f mtimes of

View File

@ -1,5 +1,5 @@
name: yesod-static
version: 1.0.0.3
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -19,22 +19,23 @@ library
build-depends: base >= 4 && < 5
, containers >= 0.2
, old-time >= 1.0
, yesod-core >= 1.0 && < 1.1
, yesod-core >= 1.1 && < 1.2
, base64-bytestring >= 0.1.0.1 && < 0.2
, cereal >= 0.3 && < 0.4
, bytestring >= 0.9.1.4
, template-haskell
, directory >= 1.0 && < 1.2
, transformers >= 0.2.2 && < 0.4
, wai-app-static >= 1.2 && < 1.3
, wai >= 1.2 && < 1.3
, wai-app-static >= 1.3 && < 1.4
, wai >= 1.3 && < 1.4
, text >= 0.9 && < 1.0
, file-embed >= 0.0.4.1 && < 0.5
, http-types >= 0.6.5 && < 0.7
, unix-compat >= 0.2
, conduit >= 0.4 && < 0.5
, crypto-conduit >= 0.3 && < 0.4
, conduit >= 0.5 && < 0.6
, crypto-conduit >= 0.4 && < 0.5
, cryptohash >= 0.6.1
, system-filepath >= 0.4.6 && < 0.5
exposed-modules: Yesod.Static
ghc-options: -Wall
@ -65,6 +66,7 @@ test-suite tests
, conduit
, crypto-conduit
, cryptohash >= 0.6.1
, system-filepath
ghc-options: -Wall

View File

@ -53,7 +53,6 @@ import Text.Blaze.Html.Renderer.String (renderHtml)
import Text.Blaze (toHtml)
import Text.Blaze.Renderer.String (renderHtml)
#endif
import Text.XML.Xml2Html ()
type Query = T.Text
type Html = L.ByteString

View File

@ -9,6 +9,7 @@ import Yesod.Test.HtmlParse
import Text.XML
import Data.ByteString.Lazy.Char8 ()
import qualified Data.Map as Map
parseQuery_ = either error id . parseQuery
findBySelector_ x = either error id . findBySelector x
@ -33,13 +34,13 @@ main = hspecX $ do
it "XHTML" $
let html = "<html><head><title>foo</title></head><body><p>Hello World</p></body></html>"
doc = Document (Prologue [] Nothing []) root []
root = Element "html" []
[ NodeElement $ Element "head" []
[ NodeElement $ Element "title" []
root = Element "html" Map.empty
[ NodeElement $ Element "head" Map.empty
[ NodeElement $ Element "title" Map.empty
[NodeContent "foo"]
]
, NodeElement $ Element "body" []
[ NodeElement $ Element "p" []
, NodeElement $ Element "body" Map.empty
[ NodeElement $ Element "p" Map.empty
[NodeContent "Hello World"]
]
]
@ -47,14 +48,14 @@ main = hspecX $ do
it "HTML" $
let html = "<html><head><title>foo</title></head><body><br><p>Hello World</p></body></html>"
doc = Document (Prologue [] Nothing []) root []
root = Element "html" []
[ NodeElement $ Element "head" []
[ NodeElement $ Element "title" []
root = Element "html" Map.empty
[ NodeElement $ Element "head" Map.empty
[ NodeElement $ Element "title" Map.empty
[NodeContent "foo"]
]
, NodeElement $ Element "body" []
[ NodeElement $ Element "br" [] []
, NodeElement $ Element "p" []
, NodeElement $ Element "body" Map.empty
[ NodeElement $ Element "br" Map.empty []
, NodeElement $ Element "p" Map.empty
[NodeContent "Hello World"]
]
]

View File

@ -1,5 +1,5 @@
name: yesod-test
version: 0.2.0.6
version: 0.3.0
license: MIT
license-file: LICENSE
author: Nubis <nubis@woobiz.com.ar>
@ -13,19 +13,14 @@ homepage: http://www.yesodweb.com
description: Behaviour Oriented integration Testing for Yesod Applications
extra-source-files: README.md, LICENSE, test/main.hs
flag blaze_html_0_5
description: use blaze-html 0.5 and blaze-markup 0.5
default: True
library
build-depends: base >= 4.3 && < 5
, hxt >= 9.1.6
, attoparsec >= 0.10 && < 0.11
, persistent >= 0.9 && < 0.10
, persistent >= 1.0 && < 1.1
, transformers >= 0.2.2 && < 0.4
, wai >= 1.2 && < 1.3
, wai-test >= 1.2 && < 1.3
, wai >= 1.3 && < 1.4
, wai-test >= 1.3 && < 1.4
, network >= 2.2 && < 2.4
, http-types >= 0.6 && < 0.7
, HUnit >= 1.2 && < 1.3
@ -33,19 +28,12 @@ library
, bytestring >= 0.9
, case-insensitive >= 0.2
, text
, xml-conduit >= 0.7 && < 0.8
, xml-conduit >= 0.8 && < 0.9
, xml-types >= 0.3 && < 0.4
, containers
, xml2html >= 0.1.2.3 && < 0.2
, html-conduit >= 0.0.1 && < 0.1
if flag(blaze_html_0_5)
build-depends:
blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
else
build-depends:
blaze-html >= 0.4 && < 0.5
, html-conduit >= 0.1 && < 0.2
, blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
exposed-modules: Yesod.Test
Yesod.Test.CssQuery
@ -63,6 +51,7 @@ test-suite test
, HUnit
, xml-conduit
, bytestring
, containers
source-repository head
type: git

View File

@ -1,5 +1,5 @@
name: yesod
version: 1.0.1.6
version: 1.1.0
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -62,34 +62,24 @@ extra-source-files:
scaffold/config/mongoDB.yml.cg
scaffold/devel.hs.cg
flag blaze_html_0_5
description: use blaze-html 0.5 and blaze-markup 0.5
default: True
library
build-depends: base >= 4.3 && < 5
, yesod-core >= 1.0 && < 1.1
, yesod-auth >= 1.0 && < 1.1
, yesod-json >= 1.0 && < 1.1
, yesod-persistent >= 1.0 && < 1.1
, yesod-form >= 1.0 && < 1.1
, yesod-core >= 1.1 && < 1.2
, yesod-auth >= 1.1 && < 1.2
, yesod-json >= 1.1 && < 1.2
, yesod-persistent >= 1.1 && < 1.2
, yesod-form >= 1.1 && < 1.2
, monad-control >= 0.3 && < 0.4
, transformers >= 0.2.2 && < 0.4
, wai >= 1.2 && < 1.3
, wai-extra >= 1.2 && < 1.3
, wai >= 1.3 && < 1.4
, wai-extra >= 1.3 && < 1.4
, wai-logger >= 0.1.2
, hamlet >= 1.0 && < 1.1
, shakespeare-js >= 1.0 && < 1.1
, shakespeare-css >= 1.0 && < 1.1
, warp >= 1.2 && < 1.3
if flag(blaze_html_0_5)
build-depends:
blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
else
build-depends:
blaze-html >= 0.4 && < 0.5
, warp >= 1.3 && < 1.4
, blaze-html >= 0.5 && < 0.6
, blaze-markup >= 0.5.1 && < 0.6
exposed-modules: Yesod
ghc-options: -Wall