Merge branch 'joeyconfig'
This commit is contained in:
commit
3d42f1fa19
|
@ -19,6 +19,8 @@ propellor (1.1.0) UNRELEASED; urgency=medium
|
||||||
commit.
|
commit.
|
||||||
* cron.runPropellor now runs propellor, rather than using its Makefile.
|
* cron.runPropellor now runs propellor, rather than using its Makefile.
|
||||||
This is more robust.
|
This is more robust.
|
||||||
|
* propellor.debug can be set in the git config to enable more persistent
|
||||||
|
debugging output.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sat, 22 Nov 2014 00:12:35 -0400
|
-- Joey Hess <joeyh@debian.org> Sat, 22 Nov 2014 00:12:35 -0400
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Set `PROPELLOR_DEBUG=1` to make propellor print out all the commands it runs
|
Set `PROPELLOR_DEBUG=1` in the environment, or `git config propellor.debug 1`
|
||||||
and any other debug messages that Properties choose to emit.
|
to make propellor print out all the commands it runs and any other debug
|
||||||
|
messages that Properties choose to emit.
|
||||||
|
|
||||||
Another handy debugging tip is to load up your config.hs in ghci, and look
|
Another handy debugging tip is to load up your config.hs in ghci, and look
|
||||||
at `hosts`. This will show the Properties of a Host, as well as the Info
|
at `hosts`. This will show the Properties of a Host, as well as the Info
|
||||||
|
|
|
@ -101,6 +101,18 @@ and configured in haskell.
|
||||||
Set `PROPELLOR_DEBUG=1` to make propellor output each command it runs and
|
Set `PROPELLOR_DEBUG=1` to make propellor output each command it runs and
|
||||||
other debugging information.
|
other debugging information.
|
||||||
|
|
||||||
|
# GIT CONFIGURATION
|
||||||
|
|
||||||
|
`git config propellor.debug 1` will configure propellor to output debugging
|
||||||
|
information.
|
||||||
|
|
||||||
|
The usual git configuration controls which centralized repository (if any)
|
||||||
|
propellor pushes and pulls from.
|
||||||
|
|
||||||
|
Additionally, the url of a remote named "deploy", if it exists
|
||||||
|
in your ~/.propellor/ repository, is used as the origin url for
|
||||||
|
the other repositories.
|
||||||
|
|
||||||
# SH AUTHOR
|
# SH AUTHOR
|
||||||
|
|
||||||
Joey Hess <id@joeyh.name>
|
Joey Hess <id@joeyh.name>
|
||||||
|
|
|
@ -11,10 +11,14 @@ import System.Log.Handler.Simple
|
||||||
import "mtl" Control.Monad.Reader
|
import "mtl" Control.Monad.Reader
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
import System.Directory
|
||||||
|
import Control.Monad.IfElse
|
||||||
|
|
||||||
import Propellor.Types
|
import Propellor.Types
|
||||||
import Utility.Monad
|
import Utility.Monad
|
||||||
import Utility.Env
|
import Utility.Env
|
||||||
|
import Utility.Process
|
||||||
|
import Utility.Exception
|
||||||
|
|
||||||
data MessageHandle
|
data MessageHandle
|
||||||
= ConsoleMessageHandle
|
= ConsoleMessageHandle
|
||||||
|
@ -99,17 +103,24 @@ colorLine h intensity color msg = do
|
||||||
putStrLn ""
|
putStrLn ""
|
||||||
hFlush stdout
|
hFlush stdout
|
||||||
|
|
||||||
-- | Causes a debug message to be displayed when PROPELLOR_DEBUG=1
|
|
||||||
debug :: [String] -> IO ()
|
debug :: [String] -> IO ()
|
||||||
debug = debugM "propellor" . unwords
|
debug = debugM "propellor" . unwords
|
||||||
|
|
||||||
checkDebugMode :: IO ()
|
checkDebugMode :: IO ()
|
||||||
checkDebugMode = go =<< getEnv "PROPELLOR_DEBUG"
|
checkDebugMode = go =<< getEnv "PROPELLOR_DEBUG"
|
||||||
where
|
where
|
||||||
go (Just "1") = do
|
go (Just "1") = enableDebugMode
|
||||||
|
go (Just _) = noop
|
||||||
|
go Nothing = whenM (doesDirectoryExist ".git") $
|
||||||
|
whenM (any (== "1") . lines <$> getgitconfig) $
|
||||||
|
enableDebugMode
|
||||||
|
getgitconfig = catchDefaultIO "" $
|
||||||
|
readProcess "git" ["config", "propellor.debug"]
|
||||||
|
|
||||||
|
enableDebugMode :: IO ()
|
||||||
|
enableDebugMode = do
|
||||||
f <- setFormatter
|
f <- setFormatter
|
||||||
<$> streamHandler stderr DEBUG
|
<$> streamHandler stderr DEBUG
|
||||||
<*> pure (simpleLogFormatter "[$time] $msg")
|
<*> pure (simpleLogFormatter "[$time] $msg")
|
||||||
updateGlobalLogger rootLoggerName $
|
updateGlobalLogger rootLoggerName $
|
||||||
setLevel DEBUG . setHandlers [f]
|
setLevel DEBUG . setHandlers [f]
|
||||||
go _ = noop
|
|
||||||
|
|
Loading…
Reference in New Issue