diff --git a/haddock b/haddock index 82a65c4..672decf 100644 --- a/haddock +++ b/haddock @@ -1,3 +1,4 @@ cabal install --enable-documentation -cabal haddock --hyperlink-source --hoogle +cabal haddock --hyperlink-source cabal install +runhaskell versioncheck.hs \ No newline at end of file diff --git a/versioncheck.hs b/versioncheck.hs new file mode 100644 index 0000000..6f1e2ed --- /dev/null +++ b/versioncheck.hs @@ -0,0 +1,53 @@ +import Text.Parsec.Prim +import Text.Parsec.Char +import Text.Parsec.String +import Text.Parsec.Combinator + +import System.FilePath (()) +import System.Posix.Files + +--import System.Directory +--import System.Process + +cabalName :: Parser String +cabalName = do + manyTill anyChar (try (string "Name:")) + spaces + many1 (noneOf " \n") + +cabalVersion :: Parser String +cabalVersion = do + manyTill anyChar (try (string "Version:")) + spaces + many1 (oneOf "0123456789.") + +nameVersion :: Parser (String,String) +nameVersion = do + n <- cabalName + v <- cabalVersion + return (n,v) + +main = do + putStrLn "version check" + str <- readFile "MSSMType.cabal" + let Right (name,version) = parse nameVersion "" str + filename = name ++ "-" ++ version + linkbase = "/home/wavewave/nfs/doc/prog" + docbase = "/home/wavewave/nfs/haddock" + linkpath = linkbase name + origpath = docbase filename + + putStrLn $ "ln -s " ++ origpath ++ " " ++ linkpath + + + b <- fileExist linkpath + if b + then do + putStrLn $ "removing link" + removeLink linkpath + else return () + {- readProcess "ln" ["-s", origpath, linkpath] "" -} + createSymbolicLink origpath linkpath + + return () +