gitit 0.10.0.1 → 0.10.0.2
raw patch · 7 files changed
+66/−25 lines, 7 filesdep ~base64-bytestringdep ~happstack-serverdep ~hslogger
Dependency ranges changed: base64-bytestring, happstack-server, hslogger, json, network
Files
- CHANGES +14/−0
- Network/Gitit/Config.hs +4/−3
- Network/Gitit/Util.hs +8/−3
- README.markdown +22/−1
- data/post-update +8/−8
- gitit.cabal +7/−7
- gitit.hs +3/−3
CHANGES view
@@ -1,3 +1,17 @@+Version 0.10.0.2 released 1 Nov 2012++* Raised version bounds for dependencies.++* Updated post-update script to use new forms of git commands.+ Closes #317.++* Fixed withTempDir so it returns to old directory.+ Closes #303. This is a slightly different solution than the one+ proposed by tstgruby, but it has the advantage that only withTempDir+ itself needs to be changed.++* Added nginx example for proxy setup (README) (Andre Kelpe).+ Version 0.10.0.1 released 07 Jun 2012 * Fixed double-encoding bug for unicode page names
Network/Gitit/Config.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, FlexibleContexts #-}+{-# LANGUAGE CPP, FlexibleContexts, ScopedTypeVariables #-} {- Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu> @@ -39,6 +39,7 @@ import Paths_gitit (getDataFileName) import System.FilePath ((</>)) import Text.Pandoc hiding (MathML, WebTeX, MathJax)+import qualified Control.Exception as E forceEither :: Show e => Either e a -> a forceEither = either (error . show) id@@ -249,12 +250,12 @@ -- mime type, followed by space, followed by a list of zero or more -- extensions, separated by spaces. Example: text/plain txt text readMimeTypesFile :: FilePath -> IO (M.Map String String)-readMimeTypesFile f = catch+readMimeTypesFile f = E.catch (liftM (foldr go M.empty . map words . lines) $ readFileUTF8 f) handleMimeTypesFileNotFound where go [] m = m -- skip blank lines go (x:xs) m = foldr (\ext -> M.insert ext x) m xs- handleMimeTypesFileNotFound e = do+ handleMimeTypesFileNotFound (e :: E.SomeException) = do logM "gitit" WARNING $ "Could not read mime types file: " ++ f ++ "\n" ++ show e ++ "\n" ++ "Using defaults instead." return mimeTypes
Network/Gitit/Util.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, ScopedTypeVariables #-} {- Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify@@ -36,6 +36,7 @@ import Data.ByteString.Lazy.UTF8 (toString) import qualified Data.ByteString.Lazy as B import Network.Gitit.Types+import qualified Control.Exception as E import Control.Monad (liftM) #if MIN_VERSION_base(4,5,0) #else@@ -61,14 +62,18 @@ -- | Perform a function in a temporary directory and clean up. withTempDir :: FilePath -> (FilePath -> IO a) -> IO a-withTempDir baseName = bracket (createTempDir 0 baseName) removeDirectoryRecursive+withTempDir baseName f = do+ oldDir <- getCurrentDirectory+ bracket (createTempDir 0 baseName)+ (\tmp -> setCurrentDirectory oldDir >> removeDirectoryRecursive tmp)+ f -- | Create a temporary directory with a unique name. createTempDir :: Integer -> FilePath -> IO FilePath createTempDir num baseName = do sysTempDir <- getTemporaryDirectory let dirName = sysTempDir </> baseName <.> show num- liftIO $ catch (createDirectory dirName >> return dirName) $+ liftIO $ E.catch (createDirectory dirName >> return dirName) $ \e -> if isAlreadyExistsError e then createTempDir (num + 1) baseName else ioError e
README.markdown view
@@ -55,7 +55,7 @@ [GHC]: http://www.haskell.org/ghc/ [here]: http://www.haskell.org/ghc/ [cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall-[quick install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall#Quick Installation on Unix+[quick install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall#Quick+Installation+on+Unix Once you've got cabal-install, installing gitit is trivial: @@ -330,6 +330,7 @@ 3. `raw`: Math will be rendered as raw LaTeX codes. +[jsMath]: http://www.math.union.edu/~dpvc/jsmath/ [jsMath download page]: http://sourceforge.net/project/showfiles.php?group_id=172663 Restricting access@@ -477,6 +478,26 @@ </VirtualHost> Reload your apache configuration and you should be all set.++Using nginx to achieve the same+-------------------------------++Drop a file called `wiki.example.com.conf` into `/etc/nginx/conf.d`+(or where ever your distribution puts it).++ server {+ listen 80;+ server_name wiki.example.com+ location / {+ proxy_pass http://127.0.0.1:5001/;+ proxy_set_header X-Real-IP $remote_addr;+ proxy_redirect off;+ }+ access_log /var/log/nginx/wiki.example.com.log main;+ }++Reload your nginx config and you should be all set.+ Proxying to `http://mysite.com/wiki` ------------------------------------
data/post-update view
@@ -11,9 +11,9 @@ # # To enable this hook, make this file executable by "chmod +x post-update". -git-update-server-info+git update-server-info -is_bare=$(git-config --get --bool core.bare)+is_bare=$(git config --get --bool core.bare) if [ -z "$is_bare" ] then@@ -30,7 +30,7 @@ echo "E:push to non-bare repository requires a HEAD reflog" >&2 exit 1 fi- if (cd $GIT_WORK_TREE; git-diff-files -q --exit-code >/dev/null)+ if (cd $GIT_WORK_TREE; git diff-files -q --exit-code >/dev/null) then wc_dirty=0 else@@ -56,23 +56,23 @@ new=$(git rev-parse HEAD) echo "W:stashing dirty $desc - see git-stash(1)" >&2 ( trap 'echo trapped $$; git symbolic-ref HEAD "'"$ref"'"' 2 3 13 15 ERR EXIT- git-update-ref --no-deref HEAD HEAD@{1}+ git update-ref --no-deref HEAD HEAD@{1} cd $GIT_WORK_TREE git stash save "dirty $desc before update to $new";- git-symbolic-ref HEAD "$ref"+ git symbolic-ref HEAD "$ref" ) fi # eye candy - show the WC updates :) echo "Updating working copy" >&2 (cd $GIT_WORK_TREE- git-diff-index -R --name-status HEAD >&2- git-reset --hard HEAD)+ git diff-index -R --name-status HEAD >&2+ git reset --hard HEAD) } if [ "$is_bare" = "false" ] then- active_branch=`git-symbolic-ref HEAD`+ active_branch=`git symbolic-ref HEAD` export GIT_DIR=$(cd $GIT_DIR; pwd) GIT_WORK_TREE=${GIT_WORK_TREE-..} for ref
gitit.cabal view
@@ -1,5 +1,5 @@ name: gitit-version: 0.10.0.1+version: 0.10.0.2 Cabal-version: >= 1.6 build-type: Simple synopsis: Wiki using happstack, git or darcs, and pandoc.@@ -146,7 +146,7 @@ bytestring, text, random,- network >= 2.1.0.0 && < 2.4,+ network >= 2.1.0.0 && < 2.5, utf8-string >= 0.3 && < 0.4, SHA > 1 && < 1.6, HTTP >= 4000.0 && < 4000.3,@@ -157,22 +157,22 @@ filestore >= 0.5 && < 0.6, zlib >= 0.5 && < 0.6, url >= 2.1 && < 2.2,- happstack-server >= 7.0 && < 7.1,- base64-bytestring >= 0.1 && < 0.2,+ happstack-server >= 7.0 && < 7.2,+ base64-bytestring >= 0.1 && < 1.1, xml >= 1.3.5,- hslogger >= 1 && < 1.2,+ hslogger >= 1 && < 1.3, ConfigFile >= 1 && < 1.2, feed >= 0.3.6 && < 0.4, xss-sanitize >= 0.3 && < 0.4, tagsoup >= 0.12 && < 0.13, blaze-html >= 0.4 && < 0.6,- json >= 0.4 && < 0.6+ json >= 0.4 && < 0.8 if impl(ghc >= 6.10) build-depends: base >= 4, syb if impl(ghc >= 7.0.3) -- without this, 'cabal install' tries to install an older -- version of network; I'm not sure why:- build-depends: network >= 2.3 && < 2.4+ build-depends: network >= 2.3 && < 2.5 if flag(plugins) build-depends: ghc, ghc-paths cpp-options: -D_PLUGINS
gitit.hs view
@@ -35,7 +35,7 @@ import Network.Socket hiding (Debug) import Network.URI import Data.Version (showVersion)-import qualified Data.ByteString as B+import qualified Data.ByteString.Char8 as B import Data.ByteString.UTF8 (fromString) import Paths_gitit (version, getDataFileName)@@ -76,8 +76,8 @@ -- initialize state initializeGititState conf' - let serverConf = Conf { validator = Nothing, port = portNumber conf',- timeout = 20, logAccess = Nothing }+ let serverConf = nullConf { validator = Nothing, port = portNumber conf',+ timeout = 20, logAccess = Nothing } -- open the requested interface sock <- socket AF_INET Stream defaultProtocol