packages feed

haskdogs 0.1 → 0.2

raw patch · 3 files changed

+39/−11 lines, 3 files

Files

README view
@@ -10,8 +10,9 @@ example) to jump directly to definition of any standard or foreign function he/she uses. -Note, that haskdogs calls some Unix shell commands like 'test' or 'mkdir'-so this tool will run, but probably fail to work on pure Windows platforms.+Note, that haskdogs calls some Unix shell commands like 'test' or 'mkdir' via+SHS so this tool will probably work on Linuxes and maybe Macs. Pure Windows+will fail to run it.  INSTALL =======
haskdogs.cabal view
@@ -3,7 +3,7 @@ -- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr. -- The name of the package. Name:                haskdogs-Version:             0.1+Version:             0.2 Synopsis:            Generate ctags file for haskell project directory and it's deps Homepage:            http://github.com/ierton/haskdogs License:             BSD3@@ -24,15 +24,15 @@     example) to jump directly to definition of any standard or foreign function     he/she uses. -    Note, that haskdogs calls some Unix shell commands like 'test' or 'mkdir'-    so this tool will likely fail to work on pure Windows platforms.+    Note, that haskdogs calls some Unix shell commands like 'test' or 'mkdir' via+    SHS so this tool will probably work on Linuxes and maybe Macs. Pure Windows+    will fail to run it.  Executable haskdogs   Hs-source-dirs:       src   Main-is:              haskdogs.hs   Build-depends:        base >= 3 && < 5, Cabal >= 1.6, HSH >= 2.0.3, filepath >= 1.1.0.3   Ghc-options:          -fwarn-tabs -Wall-  Build-tools:          hasktags    Source-repository head   Type:     git
src/haskdogs.hs view
@@ -35,24 +35,51 @@ inames2modules :: [String] -> IO [String] inames2modules is = forM is (iname2module) >>= return . nub . sort . filter (/=[]) +testdir dir fyes fno = do+    ret <- run ("test",["-d", dir])+    case ret of+        ExitSuccess -> fyes+        _ -> fno+ unpackModule p = do-    srcdir <- glob "~" >>= return . (</> ".cabal/var/haskdogs/") . head+    srcdir <- sourcedir     let fullpath = srcdir </> p-    ret <- run ("test",["-d", fullpath])-    case ret of-        ExitSuccess -> do+    testdir fullpath +        (do              putStrLn $ "Already unpacked " ++ p             return fullpath-        _ -> do+        ) +        (do              cd srcdir             ec <- tryEC (runIO (cabal_unpack p))             case ec of                 Left _ -> return []                 Right _ -> return fullpath+        )  unpackModules ms = mapM unpackModule ms >>= return . filter (/=[]) +which :: String -> IO (String, IO (String,ExitCode))+which n = run ("which", [n])++checkapp appname = do+    (_,ec) <- which appname >>= return . snd >>= id+    case ec of+        ExitSuccess -> return ()+        _ -> do+            putStrLn $ "Please Install \"" ++ appname ++ "\" application"+            exitWith ec++-- Directory to unpack sources into+sourcedir = glob "~" >>= return . (</> ".haskdogs") . head++main :: IO () main = do+    checkapp "cabal"+    checkapp "ghc-pkg"+    checkapp "hasktags"+    d <- sourcedir+    testdir d (return ()) (run ("mkdir",["-p",d]))     cwd <- run "pwd" >>= return . head     ss_local <- findSources ["."]     ss_l1deps <- findImports ss_local >>= inames2modules >>= unpackModules >>= findSources