-
Notifications
You must be signed in to change notification settings - Fork 13
/
makedocs.hs
30 lines (27 loc) · 968 Bytes
/
makedocs.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-#LANGUAGE OverloadedStrings#-}
import Shelly
import Prelude hiding (FilePath)
import System.Environment
import Data.String
configure = command_ "cabal" ["configure"] . map fromString
haddock = command_ "cabal" ["haddock"] []
moveToTemp = command_ "mv" ["-f","dist/doc","/tmp"] []
cleanTmp = command_ "rm" ["-rf", "/tmp/doc"] []
moveFromTemp = command_ "cp" ["-rf","/tmp/doc","dist/"] []
checkout a = command_ "git" ["checkout",a] []
add = command_ "git" ["add","dist/doc/*"] []
commit = command_ "git" ["commit","-am 'documentation updated'"] []
main = do
as <- getArgs
shelly $ verbosely $ do
echo "Running haddock"
silently $ configure as
haddock
cleanTmp
moveToTemp
silently $ checkout "gh-pages"
moveFromTemp
add
commit
echo "documentation updated. You can now push `gh-pages` branch to github"
silently $ checkout "VT/development"