-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mizunashi Mana
committed
Jun 8, 2017
1 parent
04fe42c
commit 183bd05
Showing
9 changed files
with
164 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Trace.Hpc.Coveralls.Stack | ||
( checkStackVersion | ||
, stackProjectName | ||
, stackPath | ||
, stackHpcRootPath | ||
, stackDistHpcRootPath | ||
) where | ||
|
||
import Control.Exception | ||
import System.FilePath | ||
import System.IO.Error | ||
import System.Process (callProcess, readProcess) | ||
import Trace.Hpc.Coveralls.Util | ||
|
||
checkStackVersion :: IO Bool | ||
checkStackVersion = handle (handleIOError False) $ do | ||
callProcess "stack" ["--version"] | ||
return True | ||
where | ||
handleIOError :: a -> IOError -> IO a | ||
handleIOError d e | ||
| isDoesNotExistError e = return d | ||
handleIOError _ e = throwIO e | ||
|
||
stackPath :: String -> IO FilePath | ||
stackPath key = stripString <$> readProcess "stack" ["path", "--" ++ key] "" | ||
|
||
stackProjectName :: IO String | ||
stackProjectName = takeFileName <$> stackPath "project-root" | ||
|
||
stackHpcRootPath :: IO FilePath | ||
stackHpcRootPath = stackPath "local-hpc-root" | ||
|
||
stackDistDirPath :: IO FilePath | ||
stackDistDirPath = stackPath "dist-dir" | ||
|
||
stackDistHpcRootPath :: IO FilePath | ||
stackDistHpcRootPath = (</> "hpc") <$> stackDistDirPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters