packages feed

hakyll 3.2.7.2 → 3.2.8.0

raw patch · 12 files changed

+102/−39 lines, 12 filesdep +blaze-markupdep ~blaze-htmldep ~hamletdep ~pandocPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: blaze-markup

Dependency ranges changed: blaze-html, hamlet, pandoc, text

API changes (from Hackage documentation)

- Hakyll.Core.UnixFilter: unixFilter :: String -> [String] -> Compiler String String
- Hakyll.Core.UnixFilter: unixFilterLBS :: String -> [String] -> Compiler ByteString ByteString
+ Hakyll: unixFilter :: String -> [String] -> Compiler String String
+ Hakyll: unixFilterLBS :: String -> [String] -> Compiler ByteString ByteString
+ Hakyll.Core.Configuration: inMemoryCache :: HakyllConfiguration -> Bool
+ Hakyll.Core.Resource.Provider.Dummy: dummyResourceProvider :: Map String ByteString -> IO ResourceProvider
- Hakyll.Core.Configuration: HakyllConfiguration :: FilePath -> FilePath -> (FilePath -> Bool) -> String -> HakyllConfiguration
+ Hakyll.Core.Configuration: HakyllConfiguration :: FilePath -> FilePath -> (FilePath -> Bool) -> String -> Bool -> HakyllConfiguration
- Hakyll.Core.Store: makeStore :: FilePath -> IO Store
+ Hakyll.Core.Store: makeStore :: Bool -> FilePath -> IO Store

Files

hakyll.cabal view
@@ -1,5 +1,5 @@ Name:    hakyll-Version: 3.2.7.2+Version: 3.2.8.0  Synopsis: A static website compiler library Description:@@ -52,8 +52,12 @@  Flag previewServer   Description: Include the preview server-  default:     True+  Default:     True +Flag unixFilter+  Description: Include the UnixFilter module+  Default:     True+ Library   Ghc-Options:    -Wall   Hs-Source-Dirs: src@@ -61,25 +65,26 @@   Build-Depends:     base        >= 4      && < 5,     binary      >= 0.5    && < 0.6,-    blaze-html  >= 0.4    && < 0.6,+    blaze-html  >= 0.5    && < 0.6,+    blaze-markup >= 0.5.1  && < 0.6,     bytestring  >= 0.9    && < 0.10,     citeproc-hs >= 0.3.2  && < 0.4,     containers  >= 0.3    && < 0.5,     cryptohash  >= 0.7    && < 0.8,     directory   >= 1.0    && < 1.2,     filepath    >= 1.0    && < 1.4,-    hamlet      >= 0.10.3 && < 1.1,+    hamlet      >= 1.0    && < 1.1,     mtl         >= 1      && < 2.2,     old-locale  >= 1.0    && < 1.1,     old-time    >= 1.0    && < 1.2,-    pandoc      >= 1.9    && < 1.10,+    pandoc      >= 1.9.3  && < 1.10,     parsec      >= 3.0    && < 3.2,     process     >= 1.0    && < 1.2,     regex-base  >= 0.93   && < 0.94,     regex-tdfa  >= 1.1    && < 1.2,     tagsoup     >= 0.12.6 && < 0.13,-    time        >= 1.1    && < 1.5,-    unix        >= 2.4    && < 2.6+    text        >= 0.11   && < 1.12,+    time        >= 1.1    && < 1.5    Exposed-Modules:     Hakyll@@ -94,12 +99,12 @@     Hakyll.Core.Logger     Hakyll.Core.Resource     Hakyll.Core.Resource.Provider+    Hakyll.Core.Resource.Provider.Dummy     Hakyll.Core.Resource.Provider.File     Hakyll.Core.Routes     Hakyll.Core.Rules     Hakyll.Core.Run     Hakyll.Core.Store-    Hakyll.Core.UnixFilter     Hakyll.Core.Util.Arrow     Hakyll.Core.Util.File     Hakyll.Core.Util.String@@ -138,12 +143,20 @@     Build-depends:       snap-core   >= 0.6 && < 0.9,       snap-server >= 0.6 && < 0.9-    Cpp-Options:+    Cpp-options:       -DPREVIEW_SERVER-    Other-Modules:+    Other-modules:       Hakyll.Web.Preview.Poll       Hakyll.Web.Preview.Server +  If flag(unixFilter)+    Build-depends:+      unix >= 2.4 && < 2.6+    Cpp-options:+      -DUNIX_FILTER+    Other-modules:+      Hakyll.Core.UnixFilter+ Test-suite hakyll-tests   Type:           exitcode-stdio-1.0   Hs-source-dirs: src tests@@ -170,7 +183,7 @@     mtl         >= 1      && < 2.2,     old-locale  >= 1.0    && < 1.1,     old-time    >= 1.0    && < 1.2,-    pandoc      >= 1.9    && < 1.10,+    pandoc      >= 1.9.3  && < 1.10,     parsec      >= 3.0    && < 3.2,     process     >= 1.0    && < 1.2,     regex-base  >= 0.93   && < 0.94,
src/Hakyll.hs view
@@ -1,5 +1,6 @@ -- | Top-level module exporting all modules that are interesting for the user --+{-# LANGUAGE CPP #-} module Hakyll     ( module Hakyll.Core.Compiler     , module Hakyll.Core.Configuration@@ -9,7 +10,9 @@     , module Hakyll.Core.Resource.Provider     , module Hakyll.Core.Routes     , module Hakyll.Core.Rules+#ifdef UNIX_FILTER     , module Hakyll.Core.UnixFilter+#endif     , module Hakyll.Core.Util.Arrow     , module Hakyll.Core.Util.File     , module Hakyll.Core.Util.String@@ -43,7 +46,9 @@ import Hakyll.Core.Resource.Provider import Hakyll.Core.Routes import Hakyll.Core.Rules+#ifdef UNIX_FILTER import Hakyll.Core.UnixFilter+#endif import Hakyll.Core.Util.Arrow import Hakyll.Core.Util.File import Hakyll.Core.Util.String
src/Hakyll/Core/Configuration.hs view
@@ -40,6 +40,9 @@       -- > ./hakyll deploy       --       deployCommand :: String+    , -- | Use an in-memory cache for items. This is faster but uses more+      -- memory.+      inMemoryCache :: Bool     }  -- | Default configuration for a hakyll application@@ -50,6 +53,7 @@     , storeDirectory       = "_cache"     , ignoreFile           = ignoreFile'     , deployCommand        = "echo 'No deploy command specified'"+    , inMemoryCache        = True     }   where     ignoreFile' path
+ src/Hakyll/Core/Resource/Provider/Dummy.hs view
@@ -0,0 +1,25 @@+-- | Dummy resource provider for testing purposes+--+module Hakyll.Core.Resource.Provider.Dummy+    ( dummyResourceProvider+    ) where++import Data.Map (Map)+import qualified Data.Map as M++import Data.Time (getCurrentTime)+import Data.ByteString.Lazy (ByteString)+import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TL++import Hakyll.Core.Resource+import Hakyll.Core.Resource.Provider++-- | Create a dummy 'ResourceProvider'+--+dummyResourceProvider :: Map String ByteString -> IO ResourceProvider+dummyResourceProvider vfs = makeResourceProvider+    (map Resource (M.keys vfs))+    (return . TL.unpack . TL.decodeUtf8 . (vfs M.!) . unResource)+    (return . (vfs M.!) . unResource)+    (const getCurrentTime)
src/Hakyll/Core/Run.hs view
@@ -42,7 +42,7 @@      section logger "Initialising"     store <- timed logger "Creating store" $-        makeStore $ storeDirectory configuration+        makeStore (inMemoryCache configuration) $ storeDirectory configuration     provider <- timed logger "Creating provider" $         fileResourceProvider configuration 
src/Hakyll/Core/Store.hs view
@@ -9,6 +9,7 @@     , storeGet     ) where +import Control.Applicative ((<$>)) import Control.Concurrent.MVar (MVar, newMVar, readMVar, modifyMVar_) import System.FilePath ((</>)) import System.Directory (doesFileExist)@@ -39,14 +40,16 @@     { -- | All items are stored on the filesystem       storeDirectory :: FilePath     , -- | And some items are also kept in-memory-      storeMap :: MVar (Map FilePath Storable)+      storeMap       :: Maybe (MVar (Map FilePath Storable))     }  -- | Initialize the store ---makeStore :: FilePath -> IO Store-makeStore directory = do-    mvar <- newMVar M.empty+makeStore :: Bool      -- ^ Use in-memory caching+          -> FilePath  -- ^ Directory to use for hard disk storage+          -> IO Store  -- ^ Store+makeStore inMemory directory = do+    mvar <- if inMemory then Just <$> newMVar M.empty else return Nothing     return Store         { storeDirectory = directory         , storeMap       = mvar@@ -54,10 +57,24 @@  -- | Auxiliary: add an item to the map ---addToMap :: (Binary a, Typeable a) => Store -> FilePath -> a -> IO ()-addToMap store path value =-    modifyMVar_ (storeMap store) $ return . M.insert path (Storable value)+cacheInsert :: (Binary a, Typeable a) => Store -> FilePath -> a -> IO ()+cacheInsert (Store _ Nothing)   _    _     = return ()+cacheInsert (Store _ (Just mv)) path value =+    modifyMVar_ mv $ return . M.insert path (Storable value) +-- | Auxiliary: get an item from the cache+--+cacheLookup :: forall a. (Binary a, Typeable a)+            => Store -> FilePath -> IO (StoreGet a)+cacheLookup (Store _ Nothing) _      = return NotFound+cacheLookup (Store _ (Just mv)) path = do+    map' <- readMVar mv+    case M.lookup path map' of+        Nothing           -> return NotFound+        Just (Storable s) -> return $ case cast s of+            Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a)+            Just s' -> Found s'+ -- | Create a path -- makePath :: Store -> String -> Identifier a -> FilePath@@ -73,31 +90,29 @@ storeSet store name identifier value = do     makeDirectories path     encodeFile path value-    addToMap store path value+    cacheInsert store path value   where     path = makePath store name identifier  -- | Load an item ---storeGet :: forall a. (Binary a, Typeable a)+storeGet :: (Binary a, Typeable a)          => Store -> String -> Identifier a -> IO (StoreGet a) storeGet store name identifier = do     -- First check the in-memory map-    map' <- readMVar $ storeMap store-    case M.lookup path map' of-        -- Found in the in-memory map-        Just (Storable s) -> return $ case cast s of-            Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a)-            Just s' -> Found s'+    mv <- cacheLookup store path+    case mv of         -- Not found in the map, try the filesystem-        Nothing -> do+        NotFound -> do             exists <- doesFileExist path             if not exists                 -- Not found in the filesystem either                 then return NotFound                 -- Found in the filesystem                 else do v <- decodeFile path-                        addToMap store path v+                        cacheInsert store path v                         return $ Found v+        -- Found in the in-memory map, just return+        s -> return s   where     path = makePath store name identifier
src/Hakyll/Core/Writable.hs view
@@ -9,8 +9,8 @@  import qualified Data.ByteString as SB import qualified Data.ByteString.Lazy as LB-import Text.Blaze (Html)-import Text.Blaze.Renderer.String (renderHtml)+import Text.Blaze.Html (Html)+import Text.Blaze.Html.Renderer.String (renderHtml)  import Hakyll.Core.Identifier 
src/Hakyll/Web/Blaze.hs view
@@ -7,7 +7,8 @@     , getBodyHtml'     ) where -import Text.Blaze (Html, toHtml, preEscapedString)+import Text.Blaze.Html (Html, toHtml)+import Text.Blaze.Internal (preEscapedString)  import Hakyll.Web.Page import Hakyll.Web.Page.Metadata
src/Hakyll/Web/Tags.hs view
@@ -52,8 +52,8 @@  import Data.Typeable (Typeable) import Data.Binary (Binary, get, put)-import Text.Blaze.Renderer.String (renderHtml)-import Text.Blaze ((!), toHtml, toValue)+import Text.Blaze.Html.Renderer.String (renderHtml)+import Text.Blaze.Html ((!), toHtml, toValue) import qualified Text.Blaze.Html5 as H import qualified Text.Blaze.Html5.Attributes as A 
src/Hakyll/Web/Util/Html.hs view
@@ -5,8 +5,8 @@     , escapeHtml     ) where -import Text.Blaze (toHtml)-import Text.Blaze.Renderer.String (renderHtml)+import Text.Blaze.Html (toHtml)+import Text.Blaze.Html.Renderer.String (renderHtml)  -- | Strip all HTML tags from a string --
tests/Hakyll/Web/Template/Tests.hs view
@@ -28,9 +28,9 @@     -- Hamlet templates     , applyTemplateAssertion readHamletTemplate applyTemplate         "<head><title>notice</title></head><body>A paragraph</body>"-        "<head\n\+        "<head>\n\         \    <title>#{title}\n\-        \<body\n\+        \<body>\n\         \    A paragraph\n"         [("title", "notice")] 
tests/TestSuite/Util.hs view
@@ -28,7 +28,7 @@ -- | Create a store for testing -- makeStoreTest :: IO Store-makeStoreTest = makeStore "_store"+makeStoreTest = makeStore True "_store"  -- | Testing for 'runCompilerJob' --