Whole repo builds with new yesod-routes

This commit is contained in:
Michael Snoyman 2012-01-05 15:27:16 +02:00
parent 0a9df1076e
commit 69a5d0e0ed
11 changed files with 35 additions and 37 deletions

View File

@ -9,8 +9,9 @@
module Yesod.Auth
( -- * Subsite
Auth
, AuthRoute
, Route (..)
, AuthPlugin (..)
, AuthRoute (..)
, getAuth
, YesodAuth (..)
-- * Plugin interface
@ -53,6 +54,8 @@ import Yesod.Form (FormMessage)
data Auth = Auth
type AuthRoute = Route Auth
type Method = Text
type Piece = Text

View File

@ -21,7 +21,7 @@ import Data.Maybe (fromMaybe)
pid :: Text
pid = "browserid"
complete :: AuthRoute
complete :: Route Auth
complete = PluginR pid []
authBrowserIdAudience :: YesodAuth m

View File

@ -16,6 +16,7 @@ module Yesod.Form.Jquery
) where
import Yesod.Handler
import Yesod.Core (Route)
import Yesod.Form
import Yesod.Widget
import Data.Time (UTCTime (..), Day, TimeOfDay (..), timeOfDayToTime,

View File

@ -11,6 +11,7 @@ module Yesod.Form.Nic
) where
import Yesod.Handler
import Yesod.Core (Route)
import Yesod.Form
import Yesod.Widget
import Text.HTML.SanitizeXSS (sanitizeBalance)

View File

@ -22,9 +22,7 @@ module Yesod.AtomFeed
, module Yesod.FeedTypes
) where
import Yesod.Content
import Yesod.Handler
import Yesod.Widget
import Yesod.Core
import Yesod.FeedTypes
import Text.Hamlet (HtmlUrl, xhamlet, hamlet)
import qualified Data.ByteString.Char8 as S8

View File

@ -25,7 +25,7 @@ import Yesod.FeedTypes
import Yesod.AtomFeed
import Yesod.RssFeed
import Yesod.Content (HasReps (chooseRep), typeAtom, typeRss)
import Yesod.Handler (Route, GHandler)
import Yesod.Core (Route, GHandler)
data RepAtomRss = RepAtomRss RepAtom RepRss
instance HasReps RepAtomRss where

View File

@ -18,9 +18,7 @@ module Yesod.RssFeed
, module Yesod.FeedTypes
) where
import Yesod.Handler
import Yesod.Content
import Yesod.Widget
import Yesod.Core
import Yesod.FeedTypes
import Text.Hamlet (HtmlUrl, xhamlet, hamlet)
import qualified Data.ByteString.Char8 as S8

View File

@ -5,6 +5,7 @@ license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
maintainer: Michael Snoyman <michael@snoyman.com>
synopsis: Efficient routing for Yesod.
description: Provides an efficient routing system, a parser and TH code generation.
category: Web, Yesod
stability: Stable
cabal-version: >= 1.8

View File

@ -26,7 +26,7 @@ module Yesod.Sitemap
) where
import Yesod.Content (RepXml (..), RepPlain (..), toContent, formatW3)
import Yesod.Handler (Route, GHandler, getUrlRender)
import Yesod.Core (Route, GHandler, getUrlRender)
import Yesod.Handler (hamletToContent)
import Text.Hamlet (HtmlUrl, xhamlet)
import Data.Time (UTCTime)

View File

@ -29,7 +29,7 @@
module Yesod.Static
( -- * Subsite
Static (..)
, StaticRoute (..)
, Route (..)
-- * Smart constructor
, static
, staticDevel
@ -120,36 +120,32 @@ embed fp =
{ ssFolder = embeddedLookup (toEmbedded $(embedDir fp))
})|]
-- | A route on the static subsite (see also 'staticFiles').
--
-- You may use this constructor directly to manually link to a
-- static file. The first argument is the sub-path to the file
-- being served whereas the second argument is the key-value
-- pairs in the query string. For example,
--
-- > StaticRoute $ StaticR [\"thumb001.jpg\"] [(\"foo\", \"5\"), (\"bar\", \"choc\")]
--
-- would generate a url such as
-- @http://www.example.com/static/thumb001.jpg?foo=5&bar=choc@
-- The StaticRoute constructor can be used when the URL cannot be
-- statically generated at compile-time (e.g. when generating
-- image galleries).
data StaticRoute = StaticRoute [Text] [(Text, Text)]
deriving (Eq, Show, Read)
type instance Route Static = StaticRoute
instance RenderRoute StaticRoute where
instance RenderRoute Static where
-- | A route on the static subsite (see also 'staticFiles').
--
-- You may use this constructor directly to manually link to a
-- static file. The first argument is the sub-path to the file
-- being served whereas the second argument is the key-value
-- pairs in the query string. For example,
--
-- > StaticRoute $ StaticR [\"thumb001.jpg\"] [(\"foo\", \"5\"), (\"bar\", \"choc\")]
--
-- would generate a url such as
-- @http://www.example.com/static/thumb001.jpg?foo=5&bar=choc@
-- The StaticRoute constructor can be used when the URL cannot be
-- statically generated at compile-time (e.g. when generating
-- image galleries).
data Route Static = StaticRoute [Text] [(Text, Text)]
deriving (Eq, Show, Read)
renderRoute (StaticRoute x y) = (x, y)
instance Yesod master => YesodDispatch Static master where
-- Need to append trailing slash to make relative links work
yesodDispatch _ _ [] _ _ = Just $
\req -> return $ responseLBS status301 [("Location", rawPathInfo req `S.append` "/")] ""
yesodDispatch _ _ _ _ _ _ [] _ req =
return $ responseLBS status301 [("Location", rawPathInfo req `S.append` "/")] ""
yesodDispatch (Static set) _ textPieces _ _ = Just $
\req -> staticApp set req { pathInfo = textPieces }
yesodDispatch _ (Static set) _ _ _ _ textPieces _ req =
staticApp set req { pathInfo = textPieces }
notHidden :: Prelude.FilePath -> Bool
notHidden "tmp" = False

View File

@ -13,7 +13,7 @@ homepage: http://www.yesodweb.com/
description: Static file serving subsite for Yesod Web Framework.
extra-source-files:
test/YesodStaticTest.hs
tests.hs
test/tests.hs
flag test
description: Build for use with running tests