ronn-envparse 1.0.0.0 → 1.0.1.0
raw patch · 6 files changed
+25/−47 lines, 6 filesdep +ronn-testdep −filepathdep −hspec-goldendep −textdep ~ronn
Dependencies added: ronn-test
Dependencies removed: filepath, hspec-golden, text
Dependency ranges changed: ronn
Files
- CHANGELOG.md +5/−1
- README.md +2/−2
- ronn-envparse.cabal +3/−6
- src/Ronn/Env.hs +6/−0
- tests/Main.hs +2/−1
- tests/Ronn/EnvSpec.hs +7/−37
CHANGELOG.md view
@@ -1,4 +1,8 @@-## [_Unreleased_](https://github.com/pbrisbin/ronn/compare/ronn-envparse-v1.0.0.0...main)+## [_Unreleased_](https://github.com/pbrisbin/ronn/compare/ronn-envparse-v1.0.1.0...main)++## [v1.0.1.0](https://github.com/pbrisbin/ronn/tree/ronn-envparse-v1.0.1.0)++- Add `HasSections` instance ## [v1.0.0.0](https://github.com/pbrisbin/ronn/tree/ronn-envparse-v1.0.0.0)
README.md view
@@ -10,8 +10,8 @@ See [the test][test] and [the result][golden]. -[test]: ./ronn-envparse/tests/Ronn/EnvSpec.hs-[golden]: ./doc/ronn-envparse.1.ronn+[test]: ./tests/Ronn/EnvSpec.hs+[golden]: ./../doc/ronn-envparse.1.ronn ---
ronn-envparse.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: ronn-envparse-version: 1.0.0.0+version: 1.0.1.0 license: AGPL-3 maintainer: Pat Brisbin homepage: https://github.com/pbrisbin/ronn#readme@@ -39,7 +39,7 @@ build-depends: base >=4.16.4.0 && <5, envparse >=0.5.0,- ronn >=1.1.0.0+ ronn >=1.1.1.0 if impl(ghc >=9.8) ghc-options:@@ -71,12 +71,9 @@ build-depends: base >=4.16.4.0 && <5, envparse >=0.5.0,- filepath >=1.4.2.2, hspec >=2.9.7,- hspec-golden >=0.2.1.0,- ronn >=1.1.0.0, ronn-envparse,- text >=1.2.5.0+ ronn-test if impl(ghc >=9.8) ghc-options:
src/Ronn/Env.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS_GHC -Wno-orphans #-}+ -- | -- -- Module : Ronn.Env@@ -15,7 +17,11 @@ import Data.String (IsString (..)) import Env (Parser) import Env.Internal.Help (helpDoc)+import Ronn (HasSections (..)) import Ronn.AST++instance HasSections (Parser e) where+ getEnvDefinitions = Just . envDefinitions envDefinitions :: Parser e a -> [Definition] envDefinitions = map fromHelpLine . drop 2 . lines . helpDoc
tests/Main.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover -Wno-missing-export-lists #-}+ -- | -- -- Module : Main@@ -6,4 +8,3 @@ -- Maintainer : pbrisbin@gmail.com -- Stability : experimental -- Portability : POSIX-{-# OPTIONS_GHC -F -pgmF hspec-discover -Wno-missing-export-lists #-}
tests/Ronn/EnvSpec.hs view
@@ -12,46 +12,16 @@ import Prelude -import Data.Text (Text, unpack)-import Data.Text.IO qualified as T import Env-import Ronn-import Ronn.Env-import System.FilePath ((</>))+import Ronn.Env ()+import Ronn.Test import Test.Hspec-import Test.Hspec.Golden spec :: Spec spec = do specify "complete example" $- let- p :: Parser Error (Maybe Bool, FilePath, FilePath)- p =- (,,)- <$> optional (switch "DEBUG" $ help "Enable debug")- <*> var nonempty "OUTPUT" (help "Output file" <> def "-")- <*> var nonempty "INPUT" (help "Input file")- in- ronnGolden $- Ronn- { name = ManRef "ronn-envparse" ManSection1- , description = ["example Ronn from envparse"]- , sections =- [ Section- { name = "ENVIRONMENT"- , content = [Definitions $ envDefinitions p]- }- ]- }--ronnGolden :: Ronn -> Golden Text-ronnGolden ronn =- Golden- { output = ronnToText ronn- , encodePretty = unpack- , writeToFile = T.writeFile- , readFromFile = T.readFile- , goldenFile = "../doc" </> ronnFilePath ronn- , actualFile = Nothing- , failFirstTime = False- }+ ronnGolden "envparse" $+ (,,)+ <$> optional (switch "DEBUG" $ help "Enable debug")+ <*> var (nonempty @Error @String) "OUTPUT" (help "Output file" <> def "-")+ <*> var (nonempty @Error @String) "INPUT" (help "Input file")