diff --git a/yesod-auth/yesod-auth.cabal b/yesod-auth/yesod-auth.cabal index c99d4776..c43e5256 100644 --- a/yesod-auth/yesod-auth.cabal +++ b/yesod-auth/yesod-auth.cabal @@ -1,5 +1,5 @@ name: yesod-auth -version: 0.7.9 +version: 0.8.0 license: BSD3 license-file: LICENSE author: Michael Snoyman, Patrick Brisbin @@ -23,8 +23,8 @@ library build-depends: base >= 4 && < 4.3 build-depends: authenticate >= 0.10.4 && < 0.11 , bytestring >= 0.9.1.4 && < 0.10 - , yesod-core >= 0.9.3.4 && < 0.10 - , wai >= 0.4 && < 0.5 + , yesod-core >= 0.10 && < 0.11 + , wai >= 1.0 && < 1.1 , template-haskell , pureMD5 >= 2.0 && < 2.2 , random >= 1.0.0.2 && < 1.1 @@ -32,19 +32,19 @@ library , text >= 0.7 && < 0.12 , mime-mail >= 0.3 && < 0.5 , blaze-html >= 0.4.1.3 && < 0.5 - , yesod-persistent >= 0.2 && < 0.3 + , yesod-persistent >= 0.3 && < 0.4 , hamlet >= 0.10 && < 0.11 , shakespeare-css >= 0.10 && < 0.11 - , yesod-json >= 0.2 && < 0.3 + , yesod-json >= 0.3 && < 0.4 , containers , unordered-containers - , yesod-form >= 0.3 && < 0.4 + , yesod-form >= 0.4 && < 0.5 , transformers >= 0.2.2 && < 0.3 - , persistent >= 0.6 && < 0.7 - , persistent-template >= 0.6 && < 0.7 + , persistent >= 0.7 && < 0.8 + , persistent-template >= 0.7 && < 0.8 , SHA >= 1.4.1.3 && < 1.6 - , http-enumerator >= 0.6 && < 0.8 - , aeson >= 0.3 + , http-conduit >= 1.0 && < 1.1 + , aeson >= 0.5 , pwstore-fast >= 2.2 && < 3 exposed-modules: Yesod.Auth diff --git a/yesod-core/Yesod/Config.hs b/yesod-core/Yesod/Config.hs deleted file mode 100644 index e7bd4a11..00000000 --- a/yesod-core/Yesod/Config.hs +++ /dev/null @@ -1,113 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -module Yesod.Config - {-# DEPRECATED "This code has been moved to yesod-default. This module will be removed in the next major version bump." #-} - ( AppConfig(..) - , loadConfig - , withYamlEnvironment - ) where - -import Control.Monad (join) -import Data.Maybe (fromMaybe) -import Data.Object -import Data.Object.Yaml - -import Data.Text (Text) -import qualified Data.Text as T - --- | Dynamic per-environment configuration which can be loaded at --- run-time negating the need to recompile between environments. -data AppConfig e = AppConfig - { appEnv :: e - , appPort :: Int - , appRoot :: Text - } deriving (Show) - --- | Load an @'AppConfig'@ from @config\/settings.yml@. --- --- Some examples: --- --- > -- typical local development --- > Development: --- > host: localhost --- > port: 3000 --- > --- > -- ssl: will default false --- > -- approot: will default to "http://localhost:3000" --- --- > -- typical outward-facing production box --- > Production: --- > host: www.example.com --- > --- > -- ssl: will default false --- > -- port: will default 80 --- > -- approot: will default "http://www.example.com" --- --- > -- maybe you're reverse proxying connections to the running app --- > -- on some other port --- > Production: --- > port: 8080 --- > approot: "http://example.com" --- > --- > -- approot is specified so that the non-80 port is not appended --- > -- automatically. --- -loadConfig :: Show e => e -> IO (AppConfig e) -loadConfig env = withYamlEnvironment "config/settings.yml" env $ \e' -> do - e <- maybe (fail "Expected map") return $ fromMapping e' - let mssl = lookupScalar "ssl" e - let mhost = lookupScalar "host" e - let mport = lookupScalar "port" e - let mapproot = lookupScalar "approot" e - - -- set some default arguments - let ssl = maybe False toBool mssl - port <- safeRead "port" $ fromMaybe (if ssl then "443" else "80") mport - - approot <- case (mhost, mapproot) of - (_ , Just ar) -> return ar - (Just host, _ ) -> return $ T.concat - [ if ssl then "https://" else "http://" - , host - , addPort ssl port - ] - _ -> fail "You must supply either a host or approot" - - return $ AppConfig - { appEnv = env - , appPort = port - , appRoot = approot - } - - where - toBool :: Text -> Bool - toBool = (`elem` ["true", "TRUE", "yes", "YES", "Y", "1"]) - - addPort :: Bool -> Int -> Text - addPort True 443 = "" - addPort False 80 = "" - addPort _ p = T.pack $ ':' : show p - --- | Loads the configuration block in the passed file named by the --- passed environment, yeilds to the passed function as a mapping. --- --- Errors in the case of a bad load or if your function returns --- @Nothing@. -withYamlEnvironment :: Show e - => FilePath -- ^ the yaml file - -> e -- ^ the environment you want to load - -> (TextObject -> IO a) -- ^ what to do with the mapping - -> IO a -withYamlEnvironment fp env f = do - obj <- join $ decodeFile fp - envs <- fromMapping obj - conf <- maybe (fail $ "Could not find environment: " ++ show env) return - $ lookup (T.pack $ show env) envs - f conf - --- | Returns 'fail' if read fails -safeRead :: Monad m => String -> Text -> m Int -safeRead name t = case reads s of - (i, _):_ -> return i - [] -> fail $ concat ["Invalid value for ", name, ": ", s] - where - s = T.unpack t diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 4fa15091..c5df8b7f 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 0.9.4 +version: 0.10.0 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -46,12 +46,12 @@ library build-depends: wai-test build-depends: time >= 1.1.4 - , wai >= 0.4 && < 0.5 - , wai-extra >= 0.4.1 && < 0.5 + , wai >= 1.0 && < 1.1 + , wai-extra >= 1.0 && < 1.1 , bytestring >= 0.9.1.4 && < 0.10 , text >= 0.7 && < 0.12 , template-haskell - , path-pieces >= 0.0 && < 0.1 + , path-pieces >= 0.1 && < 0.2 , hamlet >= 0.10.6 && < 0.11 , shakespeare >= 0.10 && < 0.11 , shakespeare-js >= 0.10.4 && < 0.11 @@ -65,9 +65,8 @@ library , old-locale >= 1.0.0.2 && < 1.1 , failure >= 0.1 && < 0.2 , containers >= 0.2 && < 0.5 - , monad-control >= 0.2 && < 0.4 + , monad-control >= 0.3 && < 0.4 , transformers-base >= 0.4 - , enumerator >= 0.4.8 && < 0.5 , cookie >= 0.3 && < 0.4 , blaze-html >= 0.4.1.3 && < 0.5 , http-types >= 0.6.5 && < 0.7 @@ -77,7 +76,7 @@ library , data-object >= 0.3 && < 0.4 , data-object-yaml >= 0.3 && < 0.4 , vector >= 0.9 && < 0.10 - , aeson >= 0.3 + , aeson >= 0.5 , fast-logger >= 0.0.1 , wai-logger >= 0.0.1 @@ -89,7 +88,6 @@ library Yesod.Request Yesod.Widget Yesod.Message - Yesod.Config Yesod.Internal.TestApi other-modules: Yesod.Internal Yesod.Internal.Cache @@ -129,7 +127,6 @@ test-suite tests , random ,HUnit ,QuickCheck >= 2 && < 3 - , enumerator ghc-options: -Wall source-repository head diff --git a/yesod-default/yesod-default.cabal b/yesod-default/yesod-default.cabal index ca3cd30f..fcc6a109 100644 --- a/yesod-default/yesod-default.cabal +++ b/yesod-default/yesod-default.cabal @@ -1,5 +1,5 @@ name: yesod-default -version: 0.5.0 +version: 0.6.0 license: BSD3 license-file: LICENSE author: Patrick Brisbin @@ -18,11 +18,11 @@ library cpp-options: -DWINDOWS build-depends: base >= 4 && < 5 - , yesod-core >= 0.9.4 && < 0.10 + , yesod-core >= 0.10 && < 0.11 , cmdargs >= 0.8 - , warp >= 0.4 && < 0.5 - , wai >= 0.4 && < 0.5 - , wai-extra >= 0.4.4 && < 0.5 + , warp >= 1.0 && < 1.1 + , wai >= 1.0 && < 1.1 + , wai-extra >= 1.0 && < 1.1 , bytestring >= 0.9.1.4 , transformers >= 0.2.2 && < 0.3 , text >= 0.9 diff --git a/yesod-form/yesod-form.cabal b/yesod-form/yesod-form.cabal index 25f91d75..f9036550 100644 --- a/yesod-form/yesod-form.cabal +++ b/yesod-form/yesod-form.cabal @@ -1,5 +1,5 @@ name: yesod-form -version: 0.3.4.2 +version: 0.4.0 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -14,25 +14,24 @@ description: Form handling support for Yesod Web Framework library build-depends: base >= 4 && < 5 - , yesod-core >= 0.9 && < 0.10 - , yesod-persistent >= 0.2 && < 0.3 + , yesod-core >= 0.10 && < 0.11 + , yesod-persistent >= 0.3 && < 0.4 , time >= 1.1.4 , hamlet >= 0.10 && < 0.11 , shakespeare-css >= 0.10 && < 0.11 , shakespeare-js >= 0.10 && < 0.11 , persistent >= 0.6 && < 0.7 - , yesod-persistent >= 0.2 && < 0.3 , template-haskell , transformers >= 0.2.2 && < 0.3 , data-default >= 0.3 && < 0.4 , xss-sanitize >= 0.3.0.1 && < 0.4 - , blaze-builder >= 0.2.1.4 && < 0.4 + , blaze-builder >= 0.2.1.4 && < 0.4 , network >= 2.2 && < 2.4 , email-validate >= 0.2.6 && < 0.3 , blaze-html >= 0.4.1.3 && < 0.5 , bytestring >= 0.9.1.4 && < 0.10 - , text >= 0.9 && < 0.12 - , wai >= 0.4 && < 0.5 + , text >= 0.9 && < 1.0 + , wai >= 1.0 && < 1.1 , containers >= 0.2 && < 0.5 exposed-modules: Yesod.Form Yesod.Form.Class diff --git a/yesod-json/Yesod/Json.hs b/yesod-json/Yesod/Json.hs index 6b930394..a2a4faff 100644 --- a/yesod-json/Yesod/Json.hs +++ b/yesod-json/Yesod/Json.hs @@ -7,11 +7,10 @@ module Yesod.Json , jsonToRepJson -- * Convert to a JSON value , parseJsonBody - -- * Compatibility wrapper for old API - , Json - , jsonScalar - , jsonList - , jsonMap + -- * Produce JSON values + , J.Value (..) + , toObject + , toArray ) where import Yesod.Handler (GHandler) @@ -25,32 +24,22 @@ import qualified Data.Aeson as J import qualified Data.Aeson.Encode as JE import Data.Aeson.Encode (fromValue) import Data.Attoparsec.Enumerator (iterParser) -import Data.Text (pack) +import Data.Text (text, pack) import Control.Arrow (first) import Control.Monad.Trans.Class (lift) -#if MIN_VERSION_aeson(0, 4, 0) import Data.HashMap.Strict (fromList) -#else -import Data.Map (fromList) -#endif import qualified Data.Vector as V import Text.Julius (ToJavascript (..)) import Data.Text.Lazy.Builder (fromLazyText) import Data.Text.Lazy.Encoding (decodeUtf8) -#if MIN_VERSION_aeson(0, 5, 0) import Data.Text.Lazy.Builder (toLazyText) import qualified Blaze.ByteString.Builder.Char.Utf8 as Blaze -#endif instance ToContent J.Value where -#if MIN_VERSION_aeson(0, 5, 0) toContent = flip ContentBuilder Nothing . Blaze.fromLazyText . toLazyText . fromValue -#else - toContent = flip ContentBuilder Nothing . fromValue -#endif -- | Provide both an HTML and JSON representation for a piece of data, using -- the default layout for the HTML output ('defaultLayout'). @@ -73,16 +62,13 @@ parseJsonBody :: GHandler sub master J.Value parseJsonBody = lift $ iterParser J.json' -type Json = J.Value - -jsonScalar :: String -> Json -jsonScalar = J.String . pack - -jsonList :: [Json] -> Json -jsonList = J.Array . V.fromList - -jsonMap :: [(String, Json)] -> Json -jsonMap = J.Object . fromList . map (first pack) - instance ToJavascript J.Value where toJavascript = fromLazyText . decodeUtf8 . JE.encode + +-- | Convert a list of pairs to an 'J.Object'. +toObject :: [(Text, J.Value)] -> J.Value +toObject = J.Object . fromList + +-- | Convert a list of values to an 'J.Array'. +toArray :: [J.Value] -> J.Value +toArray = J.Array . V.fromList diff --git a/yesod-json/yesod-json.cabal b/yesod-json/yesod-json.cabal index 187868cc..d89e2576 100644 --- a/yesod-json/yesod-json.cabal +++ b/yesod-json/yesod-json.cabal @@ -1,5 +1,5 @@ name: yesod-json -version: 0.2.3 +version: 0.3.0 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -14,12 +14,12 @@ description: Generate content for Yesod using the aeson package. library build-depends: base >= 4 && < 5 - , yesod-core >= 0.9 && < 0.10 - , aeson >= 0.3 - , text >= 0.8 && < 0.12 + , yesod-core >= 0.10 && < 0.11 + , aeson >= 0.5 + , text >= 0.8 && < 1.0 , shakespeare-js >= 0.10 && < 0.11 , vector >= 0.9 - , containers >= 0.2 && < 0.5 + , containers >= 0.2 , unordered-containers , blaze-builder , attoparsec-enumerator >= 0.3 && < 0.4 diff --git a/yesod-newsfeed/yesod-newsfeed.cabal b/yesod-newsfeed/yesod-newsfeed.cabal index 780363ca..a5321d23 100644 --- a/yesod-newsfeed/yesod-newsfeed.cabal +++ b/yesod-newsfeed/yesod-newsfeed.cabal @@ -1,5 +1,5 @@ name: yesod-newsfeed -version: 0.3.2 +version: 0.4.0 license: BSD3 license-file: LICENSE author: Michael Snoyman, Patrick Brisbin @@ -14,7 +14,7 @@ description: Helper functions and data types for producing News feeds. library build-depends: base >= 4 && < 5 - , yesod-core >= 0.9 && < 0.10 + , yesod-core >= 0.10 && < 0.11 , time >= 1.1.4 , hamlet >= 0.10 && < 0.11 , bytestring >= 0.9.1.4 && < 0.10 diff --git a/yesod-persistent/yesod-persistent.cabal b/yesod-persistent/yesod-persistent.cabal index d74789c3..fc5e2d81 100644 --- a/yesod-persistent/yesod-persistent.cabal +++ b/yesod-persistent/yesod-persistent.cabal @@ -1,5 +1,5 @@ name: yesod-persistent -version: 0.2.2 +version: 0.3.0 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -14,9 +14,9 @@ description: Some helpers for using Persistent from Yesod. library build-depends: base >= 4 && < 5 - , yesod-core >= 0.8 && < 0.10 - , persistent >= 0.6 && < 0.7 - , persistent-template >= 0.6 && < 0.7 + , yesod-core >= 0.10 && < 0.11 + , persistent >= 0.7 && < 0.8 + , persistent-template >= 0.7 && < 0.8 , failure >= 0.1 && < 0.2 , transformers >= 0.2.2 && < 0.3 exposed-modules: Yesod.Persist diff --git a/yesod-sitemap/yesod-sitemap.cabal b/yesod-sitemap/yesod-sitemap.cabal index a500824d..df308231 100644 --- a/yesod-sitemap/yesod-sitemap.cabal +++ b/yesod-sitemap/yesod-sitemap.cabal @@ -1,5 +1,5 @@ name: yesod-sitemap -version: 0.2.2 +version: 0.3.0 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -14,7 +14,7 @@ description: Generate XML sitemaps. library build-depends: base >= 4 && < 5 - , yesod-core >= 0.9 && < 0.10 + , yesod-core >= 0.10 && < 0.11 , time >= 1.1.4 , hamlet >= 0.10 && < 0.11 exposed-modules: Yesod.Sitemap diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index 673974e5..8cf537f6 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -1,5 +1,5 @@ name: yesod-static -version: 0.3.2.1 +version: 0.10.0 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -26,7 +26,7 @@ library build-depends: base >= 4 && < 5 , containers >= 0.2 && < 0.5 , old-time >= 1.0 - , yesod-core >= 0.9 && < 0.10 + , yesod-core >= 0.10 && < 0.11 , base64-bytestring >= 0.1.0.1 && < 0.2 , pureMD5 >= 2.1.0.3 && < 2.2 , cereal >= 0.3 && < 0.4 @@ -34,43 +34,42 @@ library , template-haskell , directory >= 1.0 && < 1.2 , transformers >= 0.2.2 && < 0.3 - , wai-app-static >= 0.3.2.1 && < 0.4 - , wai >= 0.4 && < 0.5 - , text >= 0.9 && < 0.12 + , wai-app-static >= 1.0 && < 1.1 + , wai >= 1.0 && < 1.1 + , text >= 0.9 && < 1.0 , file-embed >= 0.0.4.1 && < 0.5 , http-types >= 0.6.5 && < 0.7 , unix-compat >= 0.2 - , enumerator >= 0.4.8 && < 0.5 exposed-modules: Yesod.Static ghc-options: -Wall test-suite tests - hs-source-dirs: ., test + hs-source-dirs: test main-is: tests.hs type: exitcode-stdio-1.0 cpp-options: -DTEST build-depends: hspec >= 0.8 && < 0.10 , HUnit + , yesod-static -- copy from above - , base >= 4 && < 5 - , containers >= 0.2 && < 0.5 - , old-time >= 1.0 - , yesod-core >= 0.9 && < 0.10 - , base64-bytestring >= 0.1.0.1 && < 0.2 - , pureMD5 >= 2.1.0.3 && < 2.2 - , cereal >= 0.3 && < 0.4 - , bytestring >= 0.9.1.4 && < 0.10 + , base + , containers + , old-time + , yesod-core + , base64-bytestring + , pureMD5 + , cereal + , bytestring , template-haskell - , directory >= 1.0 && < 1.2 - , transformers >= 0.2.2 && < 0.3 - , wai-app-static >= 0.3.2.1 && < 0.4 - , wai >= 0.4 && < 0.5 - , text >= 0.9 && < 0.12 - , file-embed >= 0.0.4.1 && < 0.5 - , http-types >= 0.6.5 && < 0.7 - , unix-compat >= 0.2 - , enumerator >= 0.4.8 && < 0.5 + , directory + , transformers + , wai-app-static + , wai + , text + , file-embed + , http-types + , unix-compat ghc-options: -Wall diff --git a/yesod/Yesod.hs b/yesod/Yesod.hs index 77fdb865..89f7666c 100644 --- a/yesod/Yesod.hs +++ b/yesod/Yesod.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE CPP #-} -- | This module simply re-exports from other modules for your convenience. module Yesod ( -- * Re-exports from yesod-core @@ -15,11 +14,7 @@ module Yesod , Application , lift , liftIO -#if MIN_VERSION_monad_control(0, 3, 0) , MonadBaseControl -#else - , MonadControlIO -#endif -- * Utilities , showIntegral , readIntegral @@ -54,11 +49,7 @@ import Network.Wai (Application) import Network.Wai.Middleware.RequestLogger import Control.Monad.Trans.Class (lift) import Control.Monad.IO.Class (liftIO) -#if MIN_VERSION_monad_control(0, 3, 0) import Control.Monad.Trans.Control (MonadBaseControl) -#else -import Control.Monad.IO.Control (MonadControlIO) -#endif import Network.Wai.Handler.Warp (run) import System.IO (stderr, hPutStrLn) diff --git a/yesod/yesod.cabal b/yesod/yesod.cabal index bdf3ec0d..32515448 100644 --- a/yesod/yesod.cabal +++ b/yesod/yesod.cabal @@ -1,5 +1,5 @@ name: yesod -version: 0.9.4.1 +version: 0.10.0 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -71,19 +71,19 @@ library cpp-options: -DGHC7 else build-depends: base >= 4 && < 4.3 - build-depends: yesod-core >= 0.9.3.4 && < 0.10 - , yesod-auth >= 0.7 && < 0.8 - , yesod-json >= 0.2.2 && < 0.3 - , yesod-persistent >= 0.2 && < 0.3 - , yesod-form >= 0.3 && < 0.4 - , monad-control >= 0.2 && < 0.4 + build-depends: yesod-core >= 0.10 && < 0.11 + , yesod-auth >= 0.8 && < 0.9 + , yesod-json >= 0.3 && < 0.4 + , yesod-persistent >= 0.3 && < 0.4 + , yesod-form >= 0.4 && < 0.5 + , monad-control >= 0.3 && < 0.4 , transformers >= 0.2.2 && < 0.3 - , wai >= 0.4 && < 0.5 - , wai-extra >= 0.4.6 && < 0.5 + , wai >= 1.0 && < 1.1 + , wai-extra >= 1.0 && < 1.1 , hamlet >= 0.10 && < 0.11 , shakespeare-js >= 0.10 && < 0.11 , shakespeare-css >= 0.10 && < 0.11 - , warp >= 0.4 && < 0.5 + , warp >= 1.0 && < 1.1 , blaze-html >= 0.4.1.3 && < 0.5 exposed-modules: Yesod ghc-options: -Wall