packages feed

yst 0.3 → 0.3.0.1

raw patch · 6 files changed

+49/−15 lines, 6 filesdep ~HStringTemplate

Dependency ranges changed: HStringTemplate

Files

Yst/Build.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} {- Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu> @@ -32,12 +33,14 @@ -- So we use System.IO.UTF8 only if we have an earlier version #if MIN_VERSION_base(4,2,0) import System.IO (hPutStrLn)+import Prelude hiding (catch) #else-import Prelude hiding (readFile, putStrLn, print, writeFile)+import Prelude hiding (readFile, putStrLn, print, writeFile, catch) import System.IO.UTF8 #endif import System.IO (stderr) import Control.Monad+import Control.Exception (catch, SomeException)  findSource :: Site -> FilePath -> IO FilePath findSource = searchPath . sourceDir@@ -79,7 +82,8 @@   let destpath = deployDir site </> file   srcpath <- searchPath (filesDir site) file   srcmod <- getModificationTime srcpath-  destmod <- catch (getModificationTime destpath) (\_ -> return $ TOD 0 0)+  destmod <- catch (getModificationTime destpath)+                   (\(_::SomeException) -> return $ TOD 0 0)   if srcmod > destmod      then do        createDirectoryIfMissing True $ takeDirectory destpath@@ -98,7 +102,8 @@       hPutStrLn stderr $ "Aborting!  Cannot build " ++ destpath       exitWith $ ExitFailure 3   depsmod <- mapM getModificationTime deps-  destmod <- catch (getModificationTime destpath) (\_ -> return $ TOD 0 0)+  destmod <- catch (getModificationTime destpath)+                   (\(_::SomeException) -> return $ TOD 0 0)   if maximum depsmod > destmod      then do        createDirectoryIfMissing True $ takeDirectory destpath
Yst/CSV.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} {- Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu> @@ -24,14 +25,19 @@ -- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv -- So we use System.IO.UTF8 only if we have an earlier version #if MIN_VERSION_base(4,2,0)+import Prelude hiding (catch) #else-import Prelude hiding (readFile)+import Prelude hiding (readFile, catch) import System.IO.UTF8 #endif+import Control.Exception (catch, SomeException)  readCSVFile :: FilePath -> IO Node-readCSVFile f = catch (readFile f >>= return . csvToNode . parseCSV' f . stripBlanks . filter (/='\r'))-                   (\e -> errorExit 11 ("Error parsing " ++ f ++ ": " ++ show e) >> return NNil)+readCSVFile f = catch (toNode `fmap` readFile f)+                      (\(e::SomeException) -> do+                         errorExit 11 ("Error parsing " ++ f ++ ": " ++ show e)+                         return NNil)+  where toNode = csvToNode . parseCSV' f . stripBlanks . filter (/='\r')  parseCSV' :: FilePath -> String -> CSV parseCSV' f s = case parseCSV f s of
Yst/Data.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ScopedTypeVariables, FlexibleContexts #-} {- Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu> @@ -30,6 +30,8 @@ import Data.List (sortBy, nub, isPrefixOf) import Text.ParserCombinators.Parsec import System.FilePath (takeExtension)+import Prelude hiding (catch)+import Control.Exception (catch, SomeException)  findData :: Site -> FilePath -> IO FilePath findData = searchPath . dataDir@@ -37,11 +39,17 @@ getData :: Site -> DataSpec -> IO Node getData site (DataFromFile file opts) = do   raw <- catch (findData site file >>= readDataFile)-          (\e -> errorExit 15 ("Error reading data from " ++ file ++ ": " ++ show e) >> return undefined)+               (\(e::SomeException) -> do+                  errorExit 15 ("Error reading data from " ++ file ++ ": "+                     ++ show e)+                  return undefined)   return $ foldl applyDataOption raw opts getData site (DataFromSqlite3 database query opts) = do   raw <- catch (findData site database >>= \d -> readSqlite3 d query)-          (\e -> errorExit 15 ("Error reading Sqlite3 database from " ++ database ++ ": " ++ show e) >> return undefined)+               (\(e::SomeException) -> do+                  errorExit 15 ("Error reading Sqlite3 database from " +++                    database ++ ": " ++ show e)+                  return undefined)   return $ foldl applyDataOption raw opts getData _ (DataConstant n) = return n 
Yst/Yaml.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} {- Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu> @@ -26,6 +27,8 @@ import System.Locale (defaultTimeLocale) import Codec.Binary.UTF8.String (encodeString, decodeString) import qualified Data.ByteString.Char8 as B (ByteString, readFile, filter)+import Prelude hiding (catch)+import Control.Exception (catch, SomeException)  -- Note: Syck isn't unicode aware, so we use parseYamlBytes and do our -- own encoding and decoding.@@ -39,8 +42,13 @@ packBuf = Data.Yaml.Syck.packBuf . encodeString  readYamlFile :: FilePath -> IO Node-readYamlFile f = catch (B.readFile f >>= parseYamlBytes . B.filter (/='\r') >>= return . yamlNodeToNode)-                   (\e -> errorExit 11 ("Error parsing " ++ f ++ ": " ++ show e) >> return NNil)+readYamlFile f = catch (B.readFile f+                        >>= parseYamlBytes . B.filter (/='\r')+                        >>= return . yamlNodeToNode)+                        (\(e::SomeException) -> do+                             errorExit 11 ("Error parsing " ++ f ++ ": " +++                                show e)+                             return NNil)  yamlNodeToNode :: YamlNode -> Node yamlNodeToNode n =
changelog view
@@ -1,3 +1,9 @@+yst 0.3.0.1 (released 23 Oct 2012)++  * Allow compilation with latest HStringTemplate.++  * Fixed deprecated uses of Prelude's `catch`.+ yst 0.3 (released 20 Oct 2012)    * Added support for loading data from Sqlite3 databases.
yst.cabal view
@@ -1,7 +1,7 @@ name:                yst-version:             0.3-Tested-With:         GHC == 6.10.4, GHC == 6.12.1-Cabal-version:       >= 1.6+version:             0.3.0.1+Tested-With:         GHC == 7.4.1+Cabal-version:       >= 1.8 build-type:          Simple synopsis:            Builds a static website from templates and data in YAML or                      CSV files.@@ -54,7 +54,8 @@   main-is:           yst.hs   other-modules:     Yst.Types, Yst.Yaml, Yst.Util, Yst.Data, Yst.Config,                      Yst.Render, Yst.Build, Yst.CSV, Yst.Sqlite3-  build-depends:     base >=3 && < 5, HStringTemplate >= 0.6.1 && < 0.6.9,+  build-depends:     base >=3 && < 5,+                     HStringTemplate >= 0.6.1 && < 0.6.9 || > 0.6.11 && < 0.7,                      HsSyck, csv,                      filepath, containers, directory, utf8-string, time,                      old-locale, old-time, parsec, xhtml, pandoc, bytestring,