Fix add-handler (fixes #1273)

This commit is contained in:
Michael Snoyman 2016-09-04 08:55:10 +03:00
parent a04d2b25ba
commit d1495bad85
3 changed files with 18 additions and 3 deletions

View File

@ -120,9 +120,20 @@ fixApp name =
| otherwise = x : go xs
fixCabal :: String -> String -> String
fixCabal name =
unlines . reverse . go . reverse . lines
fixCabal name orig =
unlines $ (reverse $ go $ reverse libraryLines) ++ restLines
where
origLines = lines orig
(libraryLines, restLines) = break isExeTestBench origLines
isExeTestBench x = any
(\prefix -> prefix `isPrefixOf` x)
[ "executable"
, "test-suite"
, "benchmark"
]
l = " Handler." ++ name
go [] = [l]

View File

@ -1,3 +1,7 @@
## 1.4.18.3
* Adding a new handler adds it under wrong stanza [#1273](https://github.com/yesodweb/yesod/issues/1273)
## 1.4.18.2
* Work around change in behavior in newer optparse-applicative ([mailing list discussion](https://groups.google.com/d/msg/yesodweb/BrTkMKFREgU/AKVc9AK2AQAJ))

View File

@ -1,5 +1,5 @@
name: yesod-bin
version: 1.4.18.2
version: 1.4.18.3
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>