Skip to content

Commit 34ef7e7

Browse files
chore: Expose new modules and update cabal file (#164)
* chore: Reduce dependencies * chore: Indent code * doc: Simple doc string for new exposed types * feat: Expose some internal modules * chore: Reduce dependencies * chore: Export Internal module * bump: Version 0.12.0.0 * fix: Avoid major version by keeping the export of Configuration.Dotenv.Environment * bump: Version 0.11.0.1
1 parent 77ad814 commit 34ef7e7

File tree

8 files changed

+52
-39
lines changed

8 files changed

+52
-39
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
## MASTER
2+
## Dotenv 0.11.0.1
3+
### Modified
4+
* Export internal module `Configuration.Dotenv.Internal` which exports all
5+
the internal modules.
6+
* Export `configParser` from `Configuration.Dotenv`.
7+
28
## Dotenv 0.11.0.0
39
### Modified (Breaking change - new behavior)
410
* Take last rather than first env var in dotenv file (reported by @rudymatela and

dotenv.cabal

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: dotenv
2-
version: 0.11.0.0
2+
version: 0.11.0.1
33
synopsis: Loads environment variables from dotenv files
44
homepage: https://github.com/stackbuilders/dotenv-hs
55
description:
@@ -82,12 +82,13 @@ executable dotenv
8282
default-language: Haskell2010
8383

8484
library
85-
exposed-modules: Configuration.Dotenv
86-
, Configuration.Dotenv.Environment
87-
other-modules: Configuration.Dotenv.Parse
88-
, Configuration.Dotenv.ParsedVariable
89-
, Configuration.Dotenv.Text
90-
, Configuration.Dotenv.Types
85+
exposed-modules: Configuration.Dotenv
86+
, Configuration.Dotenv.Internal
87+
, Configuration.Dotenv.Environment
88+
other-modules: Configuration.Dotenv.Parse
89+
, Configuration.Dotenv.ParsedVariable
90+
, Configuration.Dotenv.Text
91+
, Configuration.Dotenv.Types
9192

9293
build-depends: base >= 4.9 && < 5.0
9394
, directory
@@ -110,32 +111,19 @@ library
110111

111112
test-suite dotenv-test
112113
type: exitcode-stdio-1.0
113-
hs-source-dirs: spec, src
114+
hs-source-dirs: spec
114115
main-is: Spec.hs
115116
other-modules: Configuration.DotenvSpec
116117
, Configuration.Dotenv.TextSpec
117118
, Configuration.Dotenv.ParseSpec
118-
, Configuration.Dotenv
119-
, Configuration.Dotenv.Environment
120-
, Configuration.Dotenv.Text
121-
, Configuration.Dotenv.Types
122-
, Configuration.Dotenv.Parse
123-
, Configuration.Dotenv.ParsedVariable
124119

125120
build-depends: base >= 4.9 && < 5.0
126-
, base-compat >= 0.4
127-
, containers
128121
, dotenv
129-
, directory
130122
, megaparsec
131123
, hspec
132124
, process
133-
, shellwords
134125
, text
135-
, exceptions >= 0.8 && < 0.11
136126
, hspec-megaparsec >= 2.0 && < 3.0
137-
, mtl
138-
, data-default-class >= 0.1.2 && < 0.2
139127

140128
build-tools: hspec-discover >= 2.0 && < 3.0
141129

spec/Configuration/Dotenv/ParseSpec.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
module Configuration.Dotenv.ParseSpec (main, spec) where
44

5-
import Configuration.Dotenv.Parse (configParser)
6-
import Configuration.Dotenv.ParsedVariable (ParsedVariable(..),
7-
VarValue(..),
8-
VarFragment(..))
9-
import Data.Void (Void)
10-
import Test.Hspec (it, context, describe, Spec, hspec)
11-
import Test.Hspec.Megaparsec (shouldParse, shouldFailOn, shouldSucceedOn)
12-
import Text.Megaparsec (ParseErrorBundle, parse)
5+
import Configuration.Dotenv.Internal (ParsedVariable (..),
6+
VarFragment (..), VarValue (..),
7+
configParser)
8+
import Data.Void (Void)
9+
import Test.Hspec (Spec, context, describe, hspec,
10+
it)
11+
import Test.Hspec.Megaparsec (shouldFailOn, shouldParse,
12+
shouldSucceedOn)
13+
import Text.Megaparsec (ParseErrorBundle, parse)
1314

1415
main :: IO ()
1516
main = hspec spec

spec/Configuration/Dotenv/TextSpec.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module Configuration.Dotenv.TextSpec (main, spec) where
22

3-
import Configuration.Dotenv.Text (parseFile)
4-
import Configuration.Dotenv.Environment (lookupEnv, unsetEnv)
3+
import Configuration.Dotenv.Environment (lookupEnv, unsetEnv)
4+
import Configuration.Dotenv.Internal (parseFile)
55

6-
import Test.Hspec
6+
import Test.Hspec
77

8-
import Control.Monad (liftM)
9-
import qualified Data.Text as T
8+
import Control.Monad (liftM)
9+
import qualified Data.Text as T
1010

1111
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
1212

spec/Configuration/DotenvSpec.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
module Configuration.DotenvSpec (main, spec) where
55

6-
import Configuration.Dotenv (load, loadFile,
6+
import Configuration.Dotenv (Config (..), load, loadFile,
77
onMissingFile, parseFile)
88
import Configuration.Dotenv.Environment (getEnvironment, lookupEnv,
99
setEnv, unsetEnv)
10-
import Configuration.Dotenv.Types (Config (..))
1110

1211

1312
import Test.Hspec

src/Configuration/Dotenv.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module Configuration.Dotenv
1616
, loadFile
1717
, parseFile
1818
, onMissingFile
19-
-- * Dotenv Types
19+
, configParser
20+
-- * Dotenv Types
2021
, module Configuration.Dotenv.Types
2122
) where
2223

src/Configuration/Dotenv/Internal.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module Configuration.Dotenv.Internal
2+
( module Configuration.Dotenv.Types
3+
, module Configuration.Dotenv.Parse
4+
, module Configuration.Dotenv.ParsedVariable
5+
, module Configuration.Dotenv.Text
6+
)
7+
where
8+
9+
import Configuration.Dotenv.Parse
10+
import Configuration.Dotenv.ParsedVariable
11+
import Configuration.Dotenv.Text
12+
import Configuration.Dotenv.Types

src/Configuration/Dotenv/ParsedVariable.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,33 @@ module Configuration.Dotenv.ParsedVariable (ParsedVariable(..),
1717
interpolateParsedVariables) where
1818

1919
import Configuration.Dotenv.Environment (lookupEnv)
20-
import Control.Monad (foldM)
2120
import Control.Applicative ((<|>))
22-
import System.Process (readCreateProcess, proc)
21+
import Control.Monad (foldM)
22+
import System.Process (proc, readCreateProcess)
2323

24+
-- | Name and value pair
2425
data ParsedVariable
2526
= ParsedVariable VarName VarValue deriving (Show, Eq)
2627

28+
-- | Variable name
2729
type VarName = String
2830

31+
-- | Possible state of values
2932
data VarValue
3033
= Unquoted VarContents
3134
| SingleQuoted VarContents
3235
| DoubleQuoted VarContents deriving (Show, Eq)
3336

37+
-- | List of VarFragment
3438
type VarContents = [VarFragment]
3539

40+
-- | Placeholder for possible values
3641
data VarFragment
3742
= VarInterpolation String
3843
| VarLiteral String
3944
| CommandInterpolation String [String] deriving (Show, Eq)
4045

46+
-- | Interpotales parsed variables
4147
interpolateParsedVariables :: [ParsedVariable] -> IO [(String, String)]
4248
interpolateParsedVariables = fmap reverse . foldM addInterpolated []
4349

0 commit comments

Comments
 (0)