packages feed

yesod-static 1.5.1.1 → 1.5.2

raw patch · 8 files changed

+37/−30 lines, 8 files

Files

ChangeLog.md view
@@ -1,3 +1,8 @@+## 1.5.2++* Fix test case for CRLF line endings+* Fix warnings+ ## 1.5.1.1  * Fix test suite compilation
Yesod/EmbeddedStatic.hs view
@@ -49,7 +49,7 @@   , module Yesod.EmbeddedStatic.Generators ) where -import Control.Applicative ((<$>))+import Control.Applicative as A ((<$>)) import Data.IORef import Data.Maybe (catMaybes) import Language.Haskell.TH@@ -59,7 +59,6 @@ import System.IO.Unsafe (unsafePerformIO) import Yesod.Core           ( HandlerT-          , Yesod(..)           , YesodSubDispatch(..)           ) import Yesod.Core.Types@@ -82,7 +81,7 @@ embeddedResourceR :: [T.Text] -> [(T.Text, T.Text)] -> Route EmbeddedStatic embeddedResourceR = EmbeddedResourceR -instance Yesod master => YesodSubDispatch EmbeddedStatic (HandlerT master IO) where+instance YesodSubDispatch EmbeddedStatic (HandlerT master IO) where     yesodSubDispatch YesodSubRunnerEnv {..} req = resp         where             master = yreSite ysreParentEnv@@ -136,7 +135,7 @@                  -> [Generator] -- ^ the generators (see "Yesod.EmbeddedStatic.Generators")                  -> Q [Dec] mkEmbeddedStatic dev esName gen = do-    entries <- concat <$> sequence gen+    entries <- concat A.<$> sequence gen     computed <- runIO $ mapM (if dev then devEmbed else prodEmbed) entries      let settings = Static.mkSettings $ return $ map cStEntry computed@@ -176,8 +175,7 @@ -- >     addStaticContent = embedStaticContent getStatic StaticR mini -- >         where mini = if development then Right else minifym -- >     ...-embedStaticContent :: Yesod site-                   => (site -> EmbeddedStatic)   -- ^ How to retrieve the embedded static subsite from your site+embedStaticContent :: (site -> EmbeddedStatic)   -- ^ How to retrieve the embedded static subsite from your site                    -> (Route EmbeddedStatic -> Route site) -- ^ how to convert an embedded static route                    -> (BL.ByteString -> Either a BL.ByteString) -- ^ javascript minifier                    -> AddStaticContent site
Yesod/EmbeddedStatic/Generators.hs view
@@ -30,10 +30,9 @@   -- $example ) where -import Control.Applicative ((<$>), (<*>))+import Control.Applicative as A ((<$>), (<*>)) import Control.Exception (try, SomeException) import Control.Monad (forM, when)-import Control.Monad.Trans.Resource (runResourceT) import Data.Char (isDigit, isLower) import Data.Conduit (($$)) import Data.Default (def)@@ -209,9 +208,9 @@                 }     (Just hin, Just hout, _, ph) <- Proc.createProcess p     (compressed, (), code) <- runConcurrently $ (,,)-        <$> Concurrently (sourceHandle hout $$ C.consume)-        <*> Concurrently (BL.hPut hin ct >> hClose hin)-        <*> Concurrently (Proc.waitForProcess ph)+        A.<$> Concurrently (sourceHandle hout $$ C.consume)+        A.<*> Concurrently (BL.hPut hin ct >> hClose hin)+        A.<*> Concurrently (Proc.waitForProcess ph)     if code == ExitSuccess         then do             putStrLn $ "Compressed successfully with " ++ f
Yesod/EmbeddedStatic/Internal.hs view
@@ -16,7 +16,7 @@     , widgetSettings ) where -import Control.Applicative ((<$>))+import Control.Applicative as A ((<$>)) import Data.IORef import Language.Haskell.TH import Network.HTTP.Types (Status(..), status404, status200, status304)@@ -28,7 +28,6 @@           ( HandlerT           , ParseRoute(..)           , RenderRoute(..)-          , Yesod(..)           , getYesod           , liftIO           )@@ -140,13 +139,12 @@                           -> HandlerT site IO (Maybe (Either T.Text (Route site, [(T.Text, T.Text)])))  -- | Helper for embedStaticContent and embedLicensedStaticContent.-staticContentHelper :: Yesod site-                    => (site -> EmbeddedStatic)+staticContentHelper :: (site -> EmbeddedStatic)                     -> (Route EmbeddedStatic -> Route site)                     -> (BL.ByteString -> Either a BL.ByteString)                     -> AddStaticContent site staticContentHelper getStatic staticR minify ext _ ct = do-    wIORef <- widgetFiles . getStatic <$> getYesod+    wIORef <- widgetFiles . getStatic A.<$> getYesod     let hash = T.pack $ base64md5 ct         hash' = Just $ T.encodeUtf8 hash         filename = T.concat [hash, ".", ext]
Yesod/Static.hs view
@@ -96,9 +96,8 @@ import Data.Conduit.Binary (sourceFile) import qualified Data.Conduit.Text as CT import Data.Functor.Identity (runIdentity)-import System.FilePath ((</>), (<.>), FilePath, takeDirectory)+import System.FilePath ((</>), (<.>), takeDirectory) import qualified System.FilePath as F-import System.Directory (createDirectoryIfMissing) import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TLE import Data.Default@@ -349,7 +348,6 @@                         | isLower (head name') -> name'                         | otherwise -> '_' : name'         f' <- [|map pack $(TH.lift f)|]-        pack' <- [|pack|]         qs <- if makeHash                     then do hash <- qRunIO $ base64md5File $ pathFromRawPieces fp f                             [|[(pack "etag", pack $(TH.lift hash))]|]@@ -504,9 +502,6 @@         , csJsPreProcess = return         , csCombinedFolder = "combined"         }--errorIntro :: [FilePath] -> [Char] -> [Char]-errorIntro fps s = "Error minifying " ++ show fps ++ ": " ++ s  liftRoutes :: [Route Static] -> Q Exp liftRoutes =
test/FileGeneratorTests.hs view
@@ -78,7 +78,8 @@     describe "Compress" $ do         it "compress tool function" $ do             out <- compressTool "runhaskell" [] "main = putStrLn \"Hello World\""-            assertEqual "" "Hello World\n" out+            -- 13 == CR, to make this test work on Windows+            BL.filter (/= 13) out `shouldBe` "Hello World\n"          it "tryCompressTools" $ do             out <- flip tryCompressTools "abcdef" 
test/GeneratorTestUtil.hs view
@@ -5,8 +5,8 @@ import Control.Monad (when) import Data.List (sortBy) import Language.Haskell.TH-import Test.HUnit hiding (Location)-import Yesod.EmbeddedStatic.Types+import Test.HUnit+import Yesod.EmbeddedStatic.Types as Y import qualified Data.ByteString.Lazy as BL  -- We test the generators by executing them at compile time@@ -20,8 +20,8 @@                    | GenSuccessWithDevel (IO BL.ByteString)  -- | Creates a GenTestResult at compile time by testing the entry.-testEntry :: Maybe String -> Location -> IO BL.ByteString -> Entry -> ExpQ-testEntry name _ _ e | ebHaskellName e /= (mkName <$> name) =+testEntry :: Maybe String -> Y.Location -> IO BL.ByteString -> Entry -> ExpQ+testEntry name _ _ e | ebHaskellName e /= (mkName Control.Applicative.<$> name) =     [| GenError ("haskell name " ++ $(litE $ stringL $ show $ ebHaskellName e)                                  ++ " /= "                                  ++ $(litE $ stringL $ show name)) |]@@ -34,12 +34,12 @@         then [| GenSuccessWithDevel $(ebDevelReload e) |]         else [| GenError "production content" |] -testOneEntry :: Maybe String -> Location -> IO BL.ByteString -> [Entry] -> ExpQ+testOneEntry :: Maybe String -> Y.Location -> IO BL.ByteString -> [Entry] -> ExpQ testOneEntry name loc ct [e] = testEntry name loc ct e testOneEntry _ _ _ _ = [| GenError "not exactly one entry" |]  -- | Tests a list of entries-testEntries :: [(Maybe String, Location, IO BL.ByteString)] -> [Entry] -> ExpQ+testEntries :: [(Maybe String, Y.Location, IO BL.ByteString)] -> [Entry] -> ExpQ testEntries a b | length a /= length b = [| [GenError "lengths differ"] |] testEntries a b = listE $ zipWith f a' b'     where
yesod-static.cabal view
@@ -1,5 +1,5 @@ name:            yesod-static-version:         1.5.1.1+version:         1.5.2 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -78,6 +78,17 @@     main-is: tests.hs     type: exitcode-stdio-1.0     cpp-options:   -DTEST_EXPORT+    other-modules:   EmbedDevelTest+                     EmbedProductionTest+                     EmbedTestGenerator+                     FileGeneratorTests+                     GeneratorTestUtil+                     Yesod.EmbeddedStatic+                     Yesod.EmbeddedStatic.Generators+                     Yesod.EmbeddedStatic.Internal+                     Yesod.EmbeddedStatic.Types+                     Yesod.Static+                     YesodStaticTest     build-depends:   base                    , hspec >= 1.3                    , yesod-test >= 1.4