scion-browser 0.2.8 → 0.2.9
raw patch · 4 files changed
+21/−15 lines, 4 filesdep ~tar
Dependency ranges changed: tar
Files
- scion-browser.cabal +3/−3
- src/Scion/PersistentHoogle.hs +11/−8
- src/Scion/PersistentHoogle/Types.hs +3/−0
- src/Server/PersistentCommands.hs +4/−4
scion-browser.cabal view
@@ -1,5 +1,5 @@ name: scion-browser -version: 0.2.8 +version: 0.2.9 cabal-version: >= 1.8 build-type: Simple license: BSD3 @@ -27,7 +27,7 @@ Cabal >= 0.10, haskell-src-exts >= 1.11 && < 2, process >= 1 && < 2, - tar == 0.3.*, + tar >= 0.3 && < 0.5, zlib == 0.5.*, HTTP >= 4000 && < 5000, deepseq >= 1.1 && < 2, @@ -106,7 +106,7 @@ Cabal >= 0.10, haskell-src-exts >= 1.11 && < 2, process >= 1 && < 2, - tar == 0.3.*, + tar >= 0.3 && < 0.5, zlib == 0.5.*, HTTP >= 4000 && < 5000, deepseq >= 1.1 && < 2,
src/Scion/PersistentHoogle.hs view
@@ -15,7 +15,6 @@ import Scion.PersistentHoogle.Instances.Json () import Scion.PersistentHoogle.Parser import Scion.PersistentHoogle.Util -import Scion.PersistentBrowser.Util import System.Exit (ExitCode(..)) import System.Process import Text.Parsec.Prim (runP) @@ -39,19 +38,23 @@ _ -> do liftIO $ logToStdout err -- I like to see the error in the log return [] -downloadData :: Maybe String -> IO Bool +downloadData :: Maybe String -> IO HoogleStatus downloadData p = do mpath <- findHoogleBinPath p case mpath of - Nothing -> return False + Nothing -> return Missing Just path -> do logToStdout "Downloading hoogle data..." (ec, _, err) <- readProcessWithExitCode path ["data"] "" when (ec/= ExitSuccess) (putStrLn err) - return (ec == ExitSuccess) + return $ case ec of + ExitSuccess->OK + _-> Error -checkDatabase :: Maybe String -> IO Bool +checkDatabase :: Maybe String -> IO HoogleStatus checkDatabase p = do mpath <- findHoogleBinPath p case mpath of - Nothing -> return False - Just path -> do (exitCode, _, _) <- readProcessWithExitCode path ["fmap"] "" - return (exitCode == ExitSuccess) + Nothing -> return Missing + Just path -> do (ec, _, _) <- readProcessWithExitCode path ["fmap"] "" + return $ case ec of + ExitSuccess->OK + _-> Error
src/Scion/PersistentHoogle/Types.hs view
@@ -12,3 +12,6 @@ data Query = Query String +-- | status of hoogle operation +data HoogleStatus = Missing | OK | Error + deriving (Show,Read,Eq,Ord,Enum,Bounded)
src/Server/PersistentCommands.hs view
@@ -127,11 +127,11 @@ results <- runDb cdb (\_ -> H.query extraH query) return (toJSON results, True) executeCommand HoogleDownloadData = do extraH <- fmap extraHooglePath get - _ <- lift $ H.downloadData extraH - return (String "ok", True) + ret <- lift $ H.downloadData extraH + return (String $ T.pack $ show ret, True) executeCommand HoogleCheckDatabase = do extraH <- fmap extraHooglePath get - present <- lift $ H.checkDatabase extraH - return (Bool present, True) + ret <- lift $ H.checkDatabase extraH + return (String $ T.pack $ show ret, True) executeCommand (SetExtraHooglePath p) = do modify (\s -> s { extraHooglePath = Just p }) return (String "ok", True) executeCommand (GetDeclarationModules cdb d) =