Merge pull request #118 from creichert/master

Add filesystem-path compatibility for older fsnotify versions.
This commit is contained in:
Christopher Reichert 2015-07-29 01:56:09 -05:00
commit e8effc9f70
3 changed files with 40 additions and 10 deletions

View File

@ -1,3 +1,7 @@
## 1.4.3.1
* Add cabal flag `system-filepath` for compatibility with older versions of fsnotify.
## 1.4.3
* Update fsnotify dependency version and remove system-filepath.

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
@ -49,6 +50,10 @@ import qualified System.FSNotify as FSN
import System.Posix.User (getUserEntryForID,
getUserEntryForName, userGroupID,
userID, userName)
#ifdef SYSTEM_FILEPATH
import qualified Filesystem.Path as FP (FilePath)
import Filesystem.Path.CurrentOS (encodeString)
#endif
keter :: FilePath -- ^ root directory or config file
@ -155,14 +160,14 @@ startWatching kc@KeterConfig {..} appMan log = do
e' <-
case e of
FSN.Removed fp _ -> do
log $ WatchedFile "removed" fp
return $ Left fp
log $ WatchedFile "removed" (fromFilePath fp)
return $ Left $ fromFilePath fp
FSN.Added fp _ -> do
log $ WatchedFile "added" fp
return $ Right fp
log $ WatchedFile "added" (fromFilePath fp)
return $ Right $ fromFilePath fp
FSN.Modified fp _ -> do
log $ WatchedFile "modified" fp
return $ Right fp
log $ WatchedFile "modified" (fromFilePath fp)
return $ Right $ fromFilePath fp
case e' of
Left fp -> when (isKeter fp) $ AppMan.terminateApp appMan $ getAppname fp
Right fp -> when (isKeter fp) $ AppMan.addApp appMan $ incoming </> fp
@ -177,6 +182,17 @@ startWatching kc@KeterConfig {..} appMan log = do
where
incoming = getIncoming kc
-- compatibility with older versions of fsnotify which used
-- 'Filesystem.Path'
#if MIN_VERSION_fsnotify(0,2,0)
fromFilePath :: forall a. a -> a
fromFilePath = id
#else
fromFilePath :: FP.FilePath -> String
fromFilePath = encodeString
#endif
listDirectoryTree :: FilePath -> IO [FilePath]
listDirectoryTree fp = do
dir <- getDirectoryContents fp

View File

@ -1,5 +1,5 @@
Name: keter
Version: 1.4.3
Version: 1.4.3.1
Synopsis: Web application deployment manager, focusing on Haskell web frameworks
Description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/keter>.
Homepage: http://www.yesodweb.com/
@ -15,6 +15,10 @@ extra-source-files: ChangeLog.md
--Data-Files: incoming/foo/bundle.sh, incoming/foo/config/keter.yaml
flag system-filepath
description: Use system-filepath
default: False
Library
Build-depends: base >= 4 && < 5
, directory
@ -34,7 +38,6 @@ Library
, blaze-builder >= 0.3 && < 0.5
, yaml >= 0.8.4 && < 0.9
, unix-compat >= 0.3 && < 0.5
, fsnotify >= 0.2.0.2
, conduit >= 1.1
, conduit-extra >= 1.1
, http-reverse-proxy >= 0.4.2 && < 0.5
@ -58,9 +61,16 @@ Library
, stm >= 2.4
, async
, lifted-base
if impl(ghc < 7.6)
build-depends:
ghc-prim
build-depends: ghc-prim
if flag(system-filepath)
build-depends: fsnotify >= 0.1 && < 0.2
, system-filepath
cpp-options: -DSYSTEM_FILEPATH
else
build-depends: fsnotify >= 0.2.0.2
Exposed-Modules: Keter.Plugin.Postgres
Keter.Types
Keter.Types.V04