yesod-bin 1.4.10 → 1.4.11
raw patch · 4 files changed
+34/−5 lines, 4 files
Files
- ChangeLog.md +5/−0
- Devel.hs +8/−2
- main.hs +20/−2
- yesod-bin.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,8 @@+## 1.4.11++* Add support to `yesod devel` to detect and use `GHC_PACKAGE_PATH`. This makes+ `yesod devel` compatible with `stack`, just run: `stack exec -- yesod devel`.+ ## 1.4.10 * Scaffolding update
Devel.hs view
@@ -115,6 +115,10 @@ , proxyTimeout :: Int , useReverseProxy :: Bool , terminateWith :: DevelTermOpt++ -- Support for GHC_PACKAGE_PATH wrapping+ , develConfigOpts :: [String]+ , develEnv :: Maybe [(String, String)] } deriving (Show, Eq) getBuildDir :: DevelOpts -> String@@ -353,8 +357,8 @@ , "--with-ghc=yesod-ghc-wrapper" , "--with-ar=yesod-ar-wrapper" , "--with-hc-pkg=ghc-pkg"- ] ++ extraArgs- )+ ] ++ develConfigOpts opts ++ extraArgs+ ) { env = develEnv opts } removeFileIfExists :: FilePath -> IO () removeFileIfExists file = removeFile file `Ex.catch` handler@@ -388,6 +392,8 @@ rebuildCabal opts = do putStrLn $ "Rebuilding application... (using " ++ cabalProgram opts ++ ")" checkExit =<< createProcess (proc (cabalProgram opts) args)+ { env = develEnv opts+ } where args | verbose opts = [ "build" ] | otherwise = [ "build", "-v0" ]
main.hs view
@@ -5,7 +5,9 @@ import Data.Monoid import Data.Version (showVersion) import Options.Applicative+import System.Environment (getEnvironment) import System.Exit (ExitCode (ExitSuccess), exitWith)+import System.FilePath (splitSearchPath) import System.Process (rawSystem) import AddHandler (addHandler)@@ -108,7 +110,9 @@ Version -> putStrLn ("yesod-bin version: " ++ showVersion Paths_yesod_bin.version) AddHandler{..} -> addHandler addHandlerRoute addHandlerPattern addHandlerMethods Test -> cabalTest cabal- Devel{..} -> let develOpts = DevelOpts+ Devel{..} ->do+ (configOpts, menv) <- handleGhcPackagePath+ let develOpts = DevelOpts { isCabalDev = optCabalPgm o == CabalDev , forceCabal = _develDisableApi , verbose = optVerbose o@@ -121,13 +125,27 @@ , proxyTimeout = _proxyTimeout , useReverseProxy = not _noReverseProxy , terminateWith = if _interruptOnly then TerminateOnlyInterrupt else TerminateOnEnter+ , develConfigOpts = configOpts+ , develEnv = menv }- in devel develOpts develExtraArgs+ devel develOpts develExtraArgs where cabalTest cabal = do touch' _ <- cabal ["configure", "--enable-tests", "-flibrary-only"] _ <- cabal ["build"] cabal ["test"]++handleGhcPackagePath :: IO ([String], Maybe [(String, String)])+handleGhcPackagePath = do+ env <- getEnvironment+ case lookup "GHC_PACKAGE_PATH" env of+ Nothing -> return ([], Nothing)+ Just gpp -> do+ let opts = "--package-db=clear"+ : "--package-db=global"+ : map ("--package-db=" ++)+ (drop 1 $ reverse $ splitSearchPath gpp)+ return (opts, Just $ filter (\(x, _) -> x /= "GHC_PACKAGE_PATH") env) optParser' :: ParserInfo Options optParser' = info (helper <*> optParser) ( fullDesc <> header "Yesod Web Framework command line utility" )
yesod-bin.cabal view
@@ -1,5 +1,5 @@ name: yesod-bin-version: 1.4.10+version: 1.4.11 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>