Disable 'cabal' cradle when executable isn't found

This commit is contained in:
Daniel Gröber 2016-05-11 15:10:00 +02:00
parent ab3dccc77c
commit 3ae9204b95

View File

@ -69,12 +69,16 @@ fillTempDir crdl = do
tmpDir <- liftIO $ newTempDir (cradleRootDir crdl)
return crdl { cradleTempDir = tmpDir }
cabalCradle :: IOish m => FilePath -> MaybeT m Cradle
cabalCradle :: (IOish m, GmLog m, GmOut m) => FilePath -> MaybeT m Cradle
cabalCradle wdir = do
cabalFile <- MaybeT $ liftIO $ findCabalFile wdir
let cabalDir = takeDirectory cabalFile
-- If cabal doesn't exist the user probably wants to use something else
whenM (isJust <$> liftIO (findExecutable "cabal")) $ do
gmLog GmWarning "" $ text "'dist/setup-config' exists but 'cabal' executable wasn't found."
mzero
return Cradle {
cradleProject = CabalProject
, cradleCurrentDir = wdir