packages feed

dyre 0.6.2 → 0.7

raw patch · 3 files changed

+36/−26 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Config.Dyre: configCheck :: Params cfgType -> Bool
+ Config.Dyre.Params: configCheck :: Params cfgType -> Bool
- Config.Dyre: Params :: String -> Maybe (IO FilePath) -> Maybe (IO FilePath) -> (cfgType -> IO ()) -> (cfgType -> String -> cfgType) -> [String] -> [String] -> (String -> IO ()) -> Params cfgType
+ Config.Dyre: Params :: String -> Bool -> Maybe (IO FilePath) -> Maybe (IO FilePath) -> (cfgType -> IO ()) -> (cfgType -> String -> cfgType) -> [String] -> [String] -> (String -> IO ()) -> Params cfgType
- Config.Dyre.Params: Params :: String -> Maybe (IO FilePath) -> Maybe (IO FilePath) -> (cfgType -> IO ()) -> (cfgType -> String -> cfgType) -> [String] -> [String] -> (String -> IO ()) -> Params cfgType
+ Config.Dyre.Params: Params :: String -> Bool -> Maybe (IO FilePath) -> Maybe (IO FilePath) -> (cfgType -> IO ()) -> (cfgType -> String -> cfgType) -> [String] -> [String] -> (String -> IO ()) -> Params cfgType

Files

Config/Dyre.hs view
@@ -104,6 +104,7 @@ defaultParams :: Params cfgType defaultParams = Params     { projectName  = undefined+    , configCheck  = True     , configDir    = Nothing     , cacheDir     = Nothing     , realMain     = undefined@@ -119,31 +120,36 @@ --   as by any custom configurations. wrapMain :: Params cfgType -> cfgType -> IO () wrapMain params@Params{projectName = pName} cfg = withDyreOptions $ do-    -- Get the important paths-    (thisBinary, tempBinary, configFile, cacheDir) <- getPaths params+    -- Allow the 'configCheck' parameter to disable all of Dyre's recompilation+    -- checks, in favor of simply proceeding ahead to the 'realMain' function.+    if not $ configCheck params+       then realMain params cfg+       else do+        -- Get the important paths+        (thisBinary, tempBinary, configFile, cacheDir) <- getPaths params -    -- Check their modification times-    thisTime <- maybeModTime thisBinary-    tempTime <- maybeModTime tempBinary-    confTime <- maybeModTime configFile+        -- Check their modification times+        thisTime <- maybeModTime thisBinary+        tempTime <- maybeModTime tempBinary+        confTime <- maybeModTime configFile -    -- If there's a config file, and the temp binary is older than something-    -- else, or we were specially told to recompile, then we should recompile.-    let confExists = confTime /= Nothing-    forceReconf <- getReconf-    errors <- if confExists &&-                 (tempTime < confTime || tempTime < thisTime || forceReconf)-                 then customCompile params-                 else return Nothing+        -- If there's a config file, and the temp binary is older than something+        -- else, or we were specially told to recompile, then we should recompile.+        let confExists = confTime /= Nothing+        forceReconf <- getReconf+        errors <- if confExists &&+                     (tempTime < confTime || tempTime < thisTime || forceReconf)+                     then customCompile params+                     else return Nothing -    -- If there's a custom binary and we're not it, run it. Otherwise-    -- just launch the main function, reporting errors if appropriate.-    -- Also we don't want to use a custom binary if the conf file is-    -- gone.-    customExists <- doesFileExist tempBinary-    if confExists && customExists && (thisBinary /= tempBinary)-       then do statusOut params $ "Launching custom binary '" ++ tempBinary ++ "'\n"-               customExec tempBinary Nothing-       else realMain params $ case errors of-                                   Nothing -> cfg-                                   Just er -> (showError params) cfg er+        -- If there's a custom binary and we're not it, run it. Otherwise+        -- just launch the main function, reporting errors if appropriate.+        -- Also we don't want to use a custom binary if the conf file is+        -- gone.+        customExists <- doesFileExist tempBinary+        if confExists && customExists && (thisBinary /= tempBinary)+           then do statusOut params $ "Launching custom binary '" ++ tempBinary ++ "'\n"+                   customExec tempBinary Nothing+           else realMain params $ case errors of+                                       Nothing -> cfg+                                       Just er -> (showError params) cfg er
Config/Dyre/Params.hs view
@@ -15,6 +15,10 @@     { projectName  :: String     -- ^ The name of the project. This needs to also be the name of     --   the executable, and the name of the configuration file.+    , configCheck  :: Bool+    -- ^ Should Dyre look for and attempt to compile custom configurations?+    --   Useful for creating program entry points that bypass Dyre's+    --   recompilation, for testing purposes.     , configDir    :: Maybe (IO FilePath)     -- ^ The directory to look for a configuration file in.     , cacheDir     :: Maybe (IO FilePath)
dyre.cabal view
@@ -1,5 +1,5 @@ name:          dyre-version:       0.6.2+version:       0.7 category:      Development, Configuration synopsis:      Dynamic reconfiguration in Haskell