From 814ad379b616fde7e85c8917c0ae85aead0f05ef Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 28 Mar 2016 20:26:42 +0300 Subject: [PATCH] Disable yesod test for Stack (fixes #1198) --- yesod-bin/ChangeLog.md | 4 ++++ yesod-bin/main.hs | 19 ++++++++++++++----- yesod-bin/yesod-bin.cabal | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/yesod-bin/ChangeLog.md b/yesod-bin/ChangeLog.md index d7837a79..71df0ba6 100644 --- a/yesod-bin/ChangeLog.md +++ b/yesod-bin/ChangeLog.md @@ -1,3 +1,7 @@ +## 1.4.18 + +* Disable `yesod test` when using Stack [#1198](https://github.com/yesodweb/yesod/issues/1198) + ## 1.4.17 * Fully remove the `yesod init` command diff --git a/yesod-bin/main.hs b/yesod-bin/main.hs index 94b0cd80..07cca4e1 100755 --- a/yesod-bin/main.hs +++ b/yesod-bin/main.hs @@ -6,7 +6,7 @@ import Data.Monoid import Data.Version (showVersion) import Options.Applicative import System.Environment (getEnvironment) -import System.Exit (ExitCode (ExitSuccess), exitWith) +import System.Exit (ExitCode (ExitSuccess), exitWith, exitFailure) import System.FilePath (splitSearchPath) import System.Process (rawSystem) @@ -15,6 +15,7 @@ import Devel (DevelOpts (..), devel, DevelTermOpt(..) import Keter (keter) import Options (injectDefaults) import qualified Paths_yesod_bin +import System.IO (hPutStrLn, stderr) import HsFile (mkHsFile) #ifndef WINDOWS @@ -130,10 +131,18 @@ main = do } devel develOpts develExtraArgs where - cabalTest cabal = do touch' - _ <- cabal ["configure", "--enable-tests", "-flibrary-only"] - _ <- cabal ["build"] - cabal ["test"] + cabalTest cabal = do + env <- getEnvironment + case lookup "STACK_EXE" env of + Nothing -> do + touch' + _ <- cabal ["configure", "--enable-tests", "-flibrary-only"] + _ <- cabal ["build"] + cabal ["test"] + Just _ -> do + hPutStrLn stderr "'yesod test' is no longer needed with Stack" + hPutStrLn stderr "Instead, please just run 'stack test'" + exitFailure handleGhcPackagePath :: IO ([String], Maybe [(String, String)]) handleGhcPackagePath = do diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index b9357197..e1f8d8fe 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -1,5 +1,5 @@ name: yesod-bin -version: 1.4.17.1 +version: 1.4.18 license: MIT license-file: LICENSE author: Michael Snoyman