packages feed

hdevtools 0.1.4.0 → 0.1.4.1

raw patch · 3 files changed

+17/−19 lines, 3 files

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog +## 0.1.4.1 - 2016-09-04++ * Do not try to execute `stack` commands if not available.+ ## 0.1.4.0 - 2016-08-08   * Determine GHC libdir and binaries using stack.
hdevtools.cabal view
@@ -1,5 +1,5 @@ name:                hdevtools-version:             0.1.4.0+version:             0.1.4.1 synopsis:            Persistent GHC powered background server for FAST haskell development tools license:             MIT license-file:        LICENSE
src/Stack.hs view
@@ -31,7 +31,7 @@  -- | Search for a @stack.yaml@ upwards in given file path tree. findStackYaml :: FilePath -> IO (Maybe FilePath)-findStackYaml = fmap (fmap trim) . execInPath "stack path --config-location"+findStackYaml = fmap (fmap trim) . execStackInPath "path --config-location"  -- | Run @stack path@ to compute @StackConfig@ getStackConfig :: CommandExtra -> IO (Maybe StackConfig)@@ -49,29 +49,18 @@     root = takeDirectory p  getStackGhcBinDir :: FilePath -> IO (Maybe FilePath)-getStackGhcBinDir = fmap (fmap trim) . execInPath "stack path --compiler-bin"+getStackGhcBinDir = fmap (fmap trim) . execStackInPath "path --compiler-bin"  getStackGhcLibDir :: FilePath -> IO (Maybe FilePath)-getStackGhcLibDir = fmap (fmap takeDirectory) . execInPath "stack path --global-pkg-db"+getStackGhcLibDir = fmap (fmap takeDirectory) . execStackInPath "path --global-pkg-db" --------------------------------------------------------------------------------- getStackDist :: FilePath -> IO (Maybe FilePath)----------------------------------------------------------------------------------getStackDist p = (trim <$>) <$> execInPath cmd p-  where-    cmd        = "stack path --dist-dir"-    -- dir        = takeDirectory p-    -- splice     = (dir </>) . trim+getStackDist p = (trim <$>) <$> execStackInPath "path --dist-dir" p --------------------------------------------------------------------------------- getStackDbs :: FilePath -> IO (Maybe [FilePath])----------------------------------------------------------------------------------getStackDbs p = do mpp <- execInPath cmd p-                   case mpp of-                       Just pp -> Just <$> extractDbs pp-                       Nothing -> return Nothing-  where-    cmd       = "stack path --ghc-package-path"+getStackDbs p =+  execStackInPath "path --ghc-package-path" p >>=+  maybe (return Nothing) (\pp -> return <$> extractDbs pp)  extractDbs :: String -> IO [FilePath] extractDbs = filterM doesDirectoryExist . stringPaths@@ -94,6 +83,11 @@ trim = f . f    where      f = reverse . dropWhile isSpace++-- Execute stack command in path (if stack is available)+execStackInPath :: String -> FilePath -> IO (Maybe String)+execStackInPath a p =+  findExecutable "stack" >>= maybe (return Nothing) (const $ execInPath ("stack " ++ a) p)  #if __GLASGOW_HASKELL__ < 709 execInPath :: String -> FilePath -> IO (Maybe String)