Commit 4d6175cc authored by Toshio Ito's avatar Toshio Ito

Client.Init: add writeChangeLog function.

parent f6e735fd
......@@ -107,6 +107,7 @@ initCabal verbosity packageDBs comp conf initFlags = do
writeLicense initFlags'
writeSetupFile initFlags'
writeChangeLog initFlags'
createSourceDirectories initFlags'
success <- writeCabalFile initFlags'
......@@ -243,6 +244,9 @@ getExtraSourceFiles flags = do
return $ flags { extraSrc = extraSrcFiles }
defaultChangeLog :: FilePath
defaultChangeLog = "ChangeLog.md"
-- | Try to guess things to include in the extra-source-files field.
-- For now, we just look for things in the root directory named
-- 'readme', 'changes', or 'changelog', with any sort of
......@@ -627,6 +631,23 @@ writeSetupFile flags = do
, "main = defaultMain"
]
writeChangeLog :: InitFlags -> IO ()
writeChangeLog flags = do
message flags ("Generating "++ defaultChangeLog ++"...")
writeFileSafe flags defaultChangeLog changeLog
where
changeLog = unlines
[ "# Revision history for " ++ pname
, ""
, "## " ++ pver ++ " -- YYYY-mm-dd"
, ""
, "* First version. Released on an unsuspecting world."
]
pname = maybe "" display $ flagToMaybe $ packageName flags
pver = maybe "" display $ flagToMaybe $ version flags
writeCabalFile :: InitFlags -> IO Bool
writeCabalFile flags@(InitFlags{packageName = NoFlag}) = do
message flags "Error: no package name provided."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment