yesod-bin 1.4.17.1 → 1.4.18
raw patch · 4 files changed
+44/−16 lines, 4 files
Files
- ChangeLog.md +4/−0
- Keter.hs +25/−10
- main.hs +14/−5
- yesod-bin.cabal +1/−1
ChangeLog.md view
@@ -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
Keter.hs view
@@ -6,11 +6,12 @@ import Data.Yaml import qualified Data.HashMap.Strict as Map import qualified Data.Text as T+import System.Environment (getEnvironment) import System.Exit import System.Process import Control.Monad import System.Directory hiding (findFiles)-import Data.Maybe (mapMaybe)+import Data.Maybe (mapMaybe,isJust,maybeToList) import Data.Monoid import System.FilePath ((</>)) import qualified Codec.Archive.Tar as Tar@@ -48,6 +49,8 @@ _ -> return value Just _ -> error $ ketercfg ++ " is not an object" + env' <- getEnvironment+ cwd' <- getCurrentDirectory files <- getDirectoryContents "." project <- case mapMaybe (T.stripSuffix ".cabal" . T.pack) files of@@ -74,15 +77,27 @@ collapse' (x:xs) = x : collapse' xs collapse' [] = [] - unless noBuild $ if elem "stack.yaml" files- then do run "stack" ["clean"]- createDirectoryIfMissing True "./dist/bin"- run "stack"- ((words "--local-bin-path ./dist/bin build --copy-bins")- <> buildArgs)- else do run cabal ["clean"]- run cabal ["configure"]- run cabal ("build" : buildArgs)+ unless noBuild $ do+ stackQueryRunSuccess <- do+ (ec,_,_) <- readProcessWithExitCode "stack" ["query"] ""+ return (ec == ExitSuccess)++ let inStackExec = isJust $ lookup "STACK_EXE" env'+ mStackYaml = lookup "STACK_YAML" env'+ useStack = inStackExec || isJust mStackYaml || stackQueryRunSuccess++ if useStack+ then do let stackYaml = maybeToList $ fmap ("--stack-yaml="<>) mStackYaml+ localBinPath = cwd' </> "dist/bin"+ run "stack" $ stackYaml <> ["clean"]+ createDirectoryIfMissing True localBinPath+ run "stack"+ (stackYaml+ <> ["--local-bin-path",localBinPath,"build","--copy-bins"]+ <> buildArgs)+ else do run cabal ["clean"]+ run cabal ["configure"]+ run cabal ("build" : buildArgs) _ <- try' $ removeDirectoryRecursive "static/tmp"
main.hs view
@@ -6,7 +6,7 @@ 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 Keter (keter) import Options (injectDefaults) import qualified Paths_yesod_bin+import System.IO (hPutStrLn, stderr) import HsFile (mkHsFile) #ifndef WINDOWS@@ -130,10 +131,18 @@ } 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
yesod-bin.cabal view
@@ -1,5 +1,5 @@ name: yesod-bin-version: 1.4.17.1+version: 1.4.18 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>