diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-28 12:41:37 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-28 12:41:37 +0200 |
commit | 6ab59438123d00b02b5a04235102df7af2926cd4 (patch) | |
tree | 9e453864d8dfd01bbfe915b33bee0289bba04d7f | |
parent | b80ba8fe83220d373e639be363143cbbfd907081 (diff) | |
download | hakyll-6ab59438123d00b02b5a04235102df7af2926cd4.tar.gz |
Remove inotify bindings for now
-rw-r--r-- | examples/hakyll/tutorial.markdown | 10 | ||||
-rw-r--r-- | hakyll.cabal | 14 | ||||
-rw-r--r-- | src-inotify/Hakyll/Web/Preview/Poll.hs | 50 | ||||
-rw-r--r-- | src/Hakyll/Web/Preview/Poll.hs (renamed from src-interval/Hakyll/Web/Preview/Poll.hs) | 3 |
4 files changed, 1 insertions, 76 deletions
diff --git a/examples/hakyll/tutorial.markdown b/examples/hakyll/tutorial.markdown index 150e881..838edf5 100644 --- a/examples/hakyll/tutorial.markdown +++ b/examples/hakyll/tutorial.markdown @@ -262,16 +262,6 @@ this can generate more traffic than necessary, since it is possible that some files were not actually modified. If you use `rsync`, you can counter this using the `--checksum` option. -### Using inotify for the preview server - -Hakyll is able to use [inotify] to power the preview server. This is generally -faster and uses less resources than the default. However, [inotify] is only -supported on linux systems. You can enable the bindings using: - - [jasper@phoenix] cabal install -finotify hakyll - -[inotify]: http://inotify.aiken.cz/ - Problems -------- diff --git a/hakyll.cabal b/hakyll.cabal index 7120646..b8ff57c 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -26,24 +26,10 @@ source-repository head type: git location: git://github.com/jaspervdj/hakyll.git --- Disabled while inotify is broken with GHC 7. If you're interested in fixing, --- contact me! --- --- flag inotify --- description: Use the inotify bindings for the preview server. Better, --- but only works on Linux. --- default: False - library ghc-options: -Wall hs-source-dirs: src --- if flag(inotify) --- hs-source-dirs: src-inotify --- build-depends: hinotify >= 0.3 --- else --- hs-source-dirs: src-interval - build-depends: base >= 4 && < 5, filepath == 1.*, directory == 1.*, diff --git a/src-inotify/Hakyll/Web/Preview/Poll.hs b/src-inotify/Hakyll/Web/Preview/Poll.hs deleted file mode 100644 index 0c27f32..0000000 --- a/src-inotify/Hakyll/Web/Preview/Poll.hs +++ /dev/null @@ -1,50 +0,0 @@ --- | Filesystem polling with an inotify backend. Works only on linux. --- -module Hakyll.Web.Preview.Poll - ( previewPoll - ) where - -import Control.Monad (forM_, when) -import Data.Set (Set) -import qualified Data.Set as S -import System.FilePath (takeDirectory, (</>)) -import Data.List (isPrefixOf) - -import System.INotify - -import Hakyll.Core.Configuration -import Hakyll.Core.Resource - --- | Calls the given callback when the directory tree changes --- -previewPoll :: HakyllConfiguration -- ^ Configuration - -> Set Resource -- ^ Resources to watch - -> IO () -- ^ Action called when something changes - -> IO () -- ^ Can block forever -previewPoll _ resources callback = do - -- Initialize inotify - inotify <- initINotify - - let -- A set of file paths - paths = S.map unResource resources - - -- A list of directories. Run it through a set so we have every - -- directory only once. - directories = S.toList $ S.map (notEmpty . takeDirectory) paths - - -- Problem: we can't add a watcher for "". So we make sure a directory - -- name is not empty - notEmpty "" = "." - notEmpty x = x - - -- Execute the callback when path is known - ifResource path = - let path' = if "./" `isPrefixOf` path then drop 2 path else path - in when (path' `S.member` paths) callback - - -- Add a watcher for every directory - forM_ directories $ \directory -> do - _ <- addWatch inotify [Modify] directory $ \e -> case e of - (Modified _ (Just p)) -> ifResource $ directory </> p - _ -> return () - return () diff --git a/src-interval/Hakyll/Web/Preview/Poll.hs b/src/Hakyll/Web/Preview/Poll.hs index 68ea8d4..83ec54a 100644 --- a/src-interval/Hakyll/Web/Preview/Poll.hs +++ b/src/Hakyll/Web/Preview/Poll.hs @@ -1,5 +1,4 @@ --- | Interval-based implementation of preview polling, for the platforms which --- are not supported by inotify. +-- | Interval-based implementation of preview polling -- module Hakyll.Web.Preview.Poll ( previewPoll |