;shake commandtxts,manuals,changelogs,cabalfiles,update: --commit

This commit is contained in:
Simon Michael 2020-09-07 11:05:00 -07:00
parent d6b1a18178
commit 845f344eba

View File

@ -69,13 +69,17 @@ usage =
,"./Shake [help] show this help" ,"./Shake [help] show this help"
,"./Shake setversion [VER] [PKGS] [--commit]" ,"./Shake setversion [VER] [PKGS] [--commit]"
," update version strings from */.version (or VER)" ," update version strings from */.version (or VER)"
,"./Shake commandtxts update hledger CLI commands' usage texts" ,"./Shake commandtxts [--commit]"
,"./Shake manuals update txt/man/info/web manuals for all packages" ," update usage texts for hledger CLI commands"
,"./Shake webmanuals update just the web manuals" ,"./Shake manuals [--commit]"
,"./Shake changelogs [--dry-run]" ," update txt/man/info/web manuals for all packages"
," add new commits & headings to */CHANGES.md" -- ,"./Shake webmanuals update just the web manuals"
,"./Shake cabalfiles update */*.cabal from */package.yaml" ,"./Shake changelogs [--commit] [--dry-run]"
,"./Shake update update all that needs updating, eg after setversion" ," update */CHANGES.md, adding new commits & headings"
,"./Shake cabalfiles [--commit]"
," update */*.cabal from */package.yaml"
,"./Shake update [--commit]"
," update all the above, eg after setversion"
,"./Shake build [PKGS] build hledger packages and their embedded docs" ,"./Shake build [PKGS] build hledger packages and their embedded docs"
,"./Shake clean remove generated texts, manuals" ,"./Shake clean remove generated texts, manuals"
,"./Shake Clean also remove object files, Shake's cache" ,"./Shake Clean also remove object files, Shake's cache"
@ -87,6 +91,7 @@ usage =
-- groff = "groff -c" ++ " -Wall" -- see "groff" below -- groff = "groff -c" ++ " -Wall" -- see "groff" below
makeinfo = "makeinfo" ++ " --no-warn" -- silence makeinfo warnings - comment out to see them makeinfo = "makeinfo" ++ " --no-warn" -- silence makeinfo warnings - comment out to see them
pandoc = "pandoc --strip-comments" pandoc = "pandoc --strip-comments"
gitcommit = "git commit --allow-empty"
-- Must support both BSD sed and GNU sed. Tips: -- Must support both BSD sed and GNU sed. Tips:
-- BSD: -- BSD:
@ -161,7 +166,7 @@ main = do
] ]
pkgdirs = packages pkgdirs = packages
pkgandprojdirs = "" : pkgdirs pkgandprojdirs = "" : pkgdirs
cabalfiles = [p <.> "cabal" | p <- packages] cabalfiles = [p </> p <.> "cabal" | p <- packages]
changelogs = map (</> "CHANGES.md") pkgandprojdirs changelogs = map (</> "CHANGES.md") pkgandprojdirs
-- doc files (or related targets) that should be generated -- doc files (or related targets) that should be generated
@ -268,7 +273,7 @@ main = do
Nothing -> "" Nothing -> ""
Just v -> "to " ++ v Just v -> "to " ++ v
] ]
cmd Shell ("git commit -m '"++msg++"' --") specifiedversionfiles dependents cmd Shell gitcommit ("-m '"++msg++"' --") specifiedversionfiles dependents
-- PKG/defs.m4 <- PKG/.version -- PKG/defs.m4 <- PKG/.version
"hledger*/defs.m4" %> \out -> do "hledger*/defs.m4" %> \out -> do
@ -351,13 +356,16 @@ main = do
-- MANUALS -- MANUALS
-- Generate the manuals in plain text, nroff, info, and markdown formats. -- Generate the manuals in plain text, nroff, info, and markdown formats.
phony "manuals" $ need $ phony "manuals" $ do
concat [ need $ concat [
nroffmanuals nroffmanuals
,infomanuals ,infomanuals
,txtmanuals ,txtmanuals
,webmanuals ,webmanuals
] ]
when commit $ do
let msg = ";update manuals"
cmd Shell gitcommit ("-m '"++msg++"' --") nroffmanuals infomanuals txtmanuals
-- Generate nroff man pages suitable for man output, from the .m4.md source. -- Generate nroff man pages suitable for man output, from the .m4.md source.
phony "nroffmanuals" $ need nroffmanuals phony "nroffmanuals" $ need nroffmanuals
@ -495,9 +503,16 @@ main = do
-- regenerate .cabal files from package.yaml's, using stack (also installs deps) -- regenerate .cabal files from package.yaml's, using stack (also installs deps)
phony "cabalfiles" $ do phony "cabalfiles" $ do
cmd Shell "stack build --dry-run --silent" :: Action () cmd Shell "stack build --dry-run --silent" :: Action ()
when commit $ do
let msg = ";update cabal files"
cmd Shell gitcommit ("-m '"++msg++"' --") cabalfiles
-- regenerate Hledger/Cli/Commands/*.txt from the .md source files for CLI help -- regenerate Hledger/Cli/Commands/*.txt from the .md source files for CLI help
phony "commandtxts" $ need commandtxts phony "commandtxts" $ do
need commandtxts
when commit $ do
let msg = ";update CLI usage texts"
cmd Shell gitcommit ("-m '"++msg++"' --") commandtxts
commandtxts |%> \out -> do commandtxts |%> \out -> do
let src = out -<.> "md" let src = out -<.> "md"
@ -539,7 +554,11 @@ main = do
] ]
-- update all changelogs with latest commits -- update all changelogs with latest commits
phony "changelogs" $ need changelogs phony "changelogs" $ do
need changelogs
when commit $ do
let msg = ";update changelogs"
cmd Shell gitcommit ("-m '"++msg++"' --") changelogs
-- [PKG/]CHANGES.md -- [PKG/]CHANGES.md
-- Add any new non-boring commits to the specified changelog, in -- Add any new non-boring commits to the specified changelog, in