From 7fc1f82d2ad9d511bb7d200bf5ad60ff814aea44 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Mon, 21 Dec 2015 21:25:57 -0700 Subject: [PATCH] give an error when a template doesn't include a .cabal file fixes #1535 --- src/Stack/New.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Stack/New.hs b/src/Stack/New.hs index 71c7f346fc..41ece17176 100644 --- a/src/Stack/New.hs +++ b/src/Stack/New.hs @@ -197,6 +197,10 @@ applyTemplate project template nonceParams dir templateText = do throwM (InvalidTemplate template (show e))) when (M.null files) $ throwM (InvalidTemplate template "Template did not specify any files.") + unless (any (".cabal" `isSuffixOf`) . M.keys $ files) $ + throwM (InvalidTemplate template "Template does not contain a .cabal\ + \ file, and the result could not be\ + \ made into a stack project.") liftM M.fromList (mapM