Skip to content
Snippets Groups Projects
Commit a0f1ef26 authored by Emily Pillmore's avatar Emily Pillmore :ocean:
Browse files

undo reversion

parent 0d208665
No related branches found
No related tags found
No related merge requests found
......@@ -56,10 +56,9 @@ initCmd v packageDBs repoCtxt comp progdb initFlags = do
-- If `--simple` is not set, default to interactive. When the flag
-- is explicitly set to `--non-interactive`, then we choose non-interactive.
--
createProject = case interactive initFlags of
NoFlag -> Interactive.createProject
Flag True
| fromFlagOrDefault False (simpleProject initFlags) ->
createProject
| fromFlagOrDefault False (simpleProject initFlags) =
Simple.createProject
| otherwise -> Interactive.createProject
Flag False -> NonInteractive.createProject comp
| otherwise = case interactive initFlags of
Flag False -> NonInteractive.createProject comp
_ -> Interactive.createProject
......@@ -26,6 +26,7 @@ module Distribution.Client.Init.FileCreators
import Prelude hiding (writeFile)
import Distribution.Client.Compat.Prelude hiding (head, empty, writeFile)
import qualified Data.Set as Set (member)
import Distribution.Client.Utils (getCurrentYear)
import Distribution.Client.Init.Defaults
import Distribution.Client.Init.Licenses
......@@ -56,6 +57,7 @@ writeProject (ProjectSettings opts pkgDesc libTarget exeTarget testTarget)
message opts
$ "\nUsing cabal specification: "
++ showCabalSpecVersion (_optCabalSpec opts)
++ "\n"
writeLicense opts pkgDesc
writeChangeLog opts pkgDesc
......@@ -204,9 +206,9 @@ writeLicense writeOpts pkgDesc = do
--
writeChangeLog :: WriteOpts -> PkgDescription -> IO ()
writeChangeLog opts pkgDesc
| defaultChangelog `elem` _pkgExtraSrcFiles pkgDesc = do
message opts ("Creating " ++ defaultChangelog ++"...")
writeFileSafe opts defaultChangelog changeLog
| Just docs <- _pkgExtraDocFiles pkgDesc
, defaultChangelog `Set.member` docs = go
| defaultChangelog `elem` _pkgExtraSrcFiles pkgDesc = go
| otherwise = return ()
where
changeLog = unlines
......@@ -217,6 +219,10 @@ writeChangeLog opts pkgDesc
, "* First version. Released on an unsuspecting world."
]
go = do
message opts ("Creating " ++ defaultChangelog ++"...")
writeFileSafe opts defaultChangelog changeLog
-- -------------------------------------------------------------------- --
-- Utilities
......@@ -265,9 +271,10 @@ writeDirectoriesSafe opts dirs = for_ dirs $ \dir -> do
exists <- doesDirectoryExist dir
moveExistingDir dir exists
let action = if doOverwrite
then "Overwriting"
else "Creating or using already existing"
let action
| doOverwrite = "Overwriting"
| exists = "Using pre-existing"
| otherwise = "Creating"
message opts $ action ++ " directory ./" ++ dir ++ "..."
unless exists $
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment