summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2018-05-29 21:54:16 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2018-05-29 21:56:39 +0200
commit8be1aa564a46974b5c4c3efd13cd8b9c83a1a0f3 (patch)
treeab8c1dd7a6917773dd7751fd7ff64bfd654cc194
parent8074252d0cfd3610d03908513eed8c4b0cd2f598 (diff)
downloadhakyll-8be1aa564a46974b5c4c3efd13cd8b9c83a1a0f3.tar.gz
Bump tasty to 1.1, fsnotify to 0.3
-rw-r--r--hakyll.cabal6
-rw-r--r--lib/Hakyll/Preview/Poll.hs26
-rw-r--r--stack.yaml4
3 files changed, 14 insertions, 22 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index d98fc0c..7e7e903 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -197,7 +197,7 @@ Library
warp >= 3.2 && < 3.3,
wai-app-static >= 3.1 && < 3.2,
http-types >= 0.9 && < 0.13,
- fsnotify >= 0.2 && < 0.3
+ fsnotify >= 0.2 && < 0.4
Cpp-options:
-DPREVIEW_SERVER
Other-modules:
@@ -206,7 +206,7 @@ Library
If flag(watchServer)
Build-depends:
- fsnotify >= 0.2 && < 0.3
+ fsnotify >= 0.2 && < 0.4
Cpp-options:
-DWATCH_SERVER
Other-modules:
@@ -260,7 +260,7 @@ Test-suite hakyll-tests
Build-Depends:
hakyll,
QuickCheck >= 2.8 && < 2.12,
- tasty >= 0.11 && < 1.1,
+ tasty >= 0.11 && < 1.2,
tasty-hunit >= 0.9 && < 0.11,
tasty-quickcheck >= 0.8 && < 0.11,
-- Copy pasted from hakyll dependencies:
diff --git a/lib/Hakyll/Preview/Poll.hs b/lib/Hakyll/Preview/Poll.hs
index e197d3f..8a95a3e 100644
--- a/lib/Hakyll/Preview/Poll.hs
+++ b/lib/Hakyll/Preview/Poll.hs
@@ -14,8 +14,7 @@ import Control.Exception (AsyncException, fromException,
import Control.Monad (forever, void, when)
import System.Directory (canonicalizePath)
import System.FilePath (pathSeparators)
-import System.FSNotify (Event (..), startManager,
- watchTree)
+import qualified System.FSNotify as FSNotify
#ifdef mingw32_HOST_OS
import Control.Concurrent (threadDelay)
@@ -44,12 +43,12 @@ watchUpdates conf update = do
shouldBuild <- newEmptyMVar
pattern <- update
fullProviderDir <- canonicalizePath $ providerDirectory conf
- manager <- startManager
+ manager <- FSNotify.startManager
let allowed event = do
-- Absolute path of the changed file. This must be inside provider
-- dir, since that's the only dir we're watching.
- let path = eventPath event
+ let path = FSNotify.eventPath event
relative = dropWhile (`elem` pathSeparators) $
drop (length fullProviderDir) path
identifier = fromFilePath relative
@@ -69,7 +68,7 @@ watchUpdates conf update = do
-- Send an event whenever something occurs so that the thread described
-- above will do a build.
- void $ watchTree manager providerDir (not . isRemove) $ \event -> do
+ void $ FSNotify.watchTree manager providerDir (not . isRemove) $ \event -> do
allowed' <- allowed event
when allowed' $ void $ tryPutMVar shouldBuild event
where
@@ -77,7 +76,7 @@ watchUpdates conf update = do
update' _ _ = void update
#else
update' event provider = do
- let path = provider </> eventPath event
+ let path = provider </> FSNotify.eventPath event
-- on windows, a 'Modified' event is also sent on file deletion
fileExists <- doesFileExist path
@@ -105,15 +104,6 @@ watchUpdates conf update = do
--------------------------------------------------------------------------------
-eventPath :: Event -> FilePath
-eventPath evt = evtPath evt
- where
- evtPath (Added p _) = p
- evtPath (Modified p _) = p
- evtPath (Removed p _) = p
-
-
---------------------------------------------------------------------------------
-isRemove :: Event -> Bool
-isRemove (Removed _ _) = True
-isRemove _ = False
+isRemove :: FSNotify.Event -> Bool
+isRemove (FSNotify.Removed {}) = True
+isRemove _ = False
diff --git a/stack.yaml b/stack.yaml
index 2a99e11..958aaf3 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,4 +1,4 @@
-resolver: lts-11.5
+resolver: lts-11.7
extra-package-dbs: []
flags:
@@ -26,3 +26,5 @@ extra-deps:
- 'pandoc-2.2'
- 'pandoc-types-1.17.4.2'
- 'pandoc-citeproc-0.14.3.1'
+- 'tasty-1.1.0.1'
+- 'fsnotify-0.3.0.0'