dotenv 0.11.0.0 → 0.11.0.1
raw patch · 9 files changed
+57/−38 lines, 9 filesdep +data-default-classdep ~mtldep ~shellwordsPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependencies added: data-default-class
Dependency ranges changed: mtl, shellwords
API changes (from Hackage documentation)
+ Configuration.Dotenv: configParser :: Parser [ParsedVariable]
+ Configuration.Dotenv.Internal: CommandInterpolation :: String -> [String] -> VarFragment
+ Configuration.Dotenv.Internal: Config :: [FilePath] -> [FilePath] -> Bool -> Bool -> Bool -> Config
+ Configuration.Dotenv.Internal: DoubleQuoted :: VarContents -> VarValue
+ Configuration.Dotenv.Internal: ParsedVariable :: VarName -> VarValue -> ParsedVariable
+ Configuration.Dotenv.Internal: SingleQuoted :: VarContents -> VarValue
+ Configuration.Dotenv.Internal: Unquoted :: VarContents -> VarValue
+ Configuration.Dotenv.Internal: VarInterpolation :: String -> VarFragment
+ Configuration.Dotenv.Internal: VarLiteral :: String -> VarFragment
+ Configuration.Dotenv.Internal: [allowDuplicates] :: Config -> Bool
+ Configuration.Dotenv.Internal: [configExamplePath] :: Config -> [FilePath]
+ Configuration.Dotenv.Internal: [configOverride] :: Config -> Bool
+ Configuration.Dotenv.Internal: [configPath] :: Config -> [FilePath]
+ Configuration.Dotenv.Internal: [configVerbose] :: Config -> Bool
+ Configuration.Dotenv.Internal: configParser :: Parser [ParsedVariable]
+ Configuration.Dotenv.Internal: data Config
+ Configuration.Dotenv.Internal: data ParsedVariable
+ Configuration.Dotenv.Internal: data VarFragment
+ Configuration.Dotenv.Internal: data VarValue
+ Configuration.Dotenv.Internal: defaultConfig :: Config
+ Configuration.Dotenv.Internal: interpolateParsedVariables :: [ParsedVariable] -> IO [(String, String)]
+ Configuration.Dotenv.Internal: parseFile :: MonadIO m => FilePath -> m [(Text, Text)]
+ Configuration.Dotenv.Internal: type VarContents = [VarFragment]
+ Configuration.Dotenv.Internal: type VarName = String
Files
- CHANGELOG.md +6/−0
- dotenv.cabal +10/−20
- spec/Configuration/Dotenv/ParseSpec.hs +9/−8
- spec/Configuration/Dotenv/TextSpec.hs +5/−5
- spec/Configuration/DotenvSpec.hs +1/−2
- src/Configuration/Dotenv.hs +2/−1
- src/Configuration/Dotenv/Internal.hs +12/−0
- src/Configuration/Dotenv/ParsedVariable.hs +8/−2
- src/Configuration/Dotenv/Types.hs +4/−0
CHANGELOG.md view
@@ -1,4 +1,10 @@ ## MASTER+## Dotenv 0.11.0.1+### Modified+* Export internal module `Configuration.Dotenv.Internal` which exports all+the internal modules.+* Export `configParser` from `Configuration.Dotenv`.+ ## Dotenv 0.11.0.0 ### Modified (Breaking change - new behavior) * Take last rather than first env var in dotenv file (reported by @rudymatela and
dotenv.cabal view
@@ -1,5 +1,5 @@ name: dotenv-version: 0.11.0.0+version: 0.11.0.1 synopsis: Loads environment variables from dotenv files homepage: https://github.com/stackbuilders/dotenv-hs description:@@ -82,12 +82,13 @@ default-language: Haskell2010 library- exposed-modules: Configuration.Dotenv- , Configuration.Dotenv.Environment- other-modules: Configuration.Dotenv.Parse- , Configuration.Dotenv.ParsedVariable- , Configuration.Dotenv.Text- , Configuration.Dotenv.Types+ exposed-modules: Configuration.Dotenv+ , Configuration.Dotenv.Internal+ , Configuration.Dotenv.Environment+ other-modules: Configuration.Dotenv.Parse+ , Configuration.Dotenv.ParsedVariable+ , Configuration.Dotenv.Text+ , Configuration.Dotenv.Types build-depends: base >= 4.9 && < 5.0 , directory@@ -98,6 +99,7 @@ , text , exceptions >= 0.8 && < 0.11 , mtl >= 2.2.2 && < 2.4+ , data-default-class >= 0.1.2 && < 0.2 hs-source-dirs: src ghc-options: -Wall@@ -109,31 +111,19 @@ test-suite dotenv-test type: exitcode-stdio-1.0- hs-source-dirs: spec, src+ hs-source-dirs: spec main-is: Spec.hs other-modules: Configuration.DotenvSpec , Configuration.Dotenv.TextSpec , Configuration.Dotenv.ParseSpec- , Configuration.Dotenv- , Configuration.Dotenv.Environment- , Configuration.Dotenv.Text- , Configuration.Dotenv.Types- , Configuration.Dotenv.Parse- , Configuration.Dotenv.ParsedVariable build-depends: base >= 4.9 && < 5.0- , base-compat >= 0.4- , containers , dotenv- , directory , megaparsec , hspec , process- , shellwords , text- , exceptions >= 0.8 && < 0.11 , hspec-megaparsec >= 2.0 && < 3.0- , mtl build-tools: hspec-discover >= 2.0 && < 3.0
spec/Configuration/Dotenv/ParseSpec.hs view
@@ -2,14 +2,15 @@ module Configuration.Dotenv.ParseSpec (main, spec) where -import Configuration.Dotenv.Parse (configParser)-import Configuration.Dotenv.ParsedVariable (ParsedVariable(..),- VarValue(..),- VarFragment(..))-import Data.Void (Void)-import Test.Hspec (it, context, describe, Spec, hspec)-import Test.Hspec.Megaparsec (shouldParse, shouldFailOn, shouldSucceedOn)-import Text.Megaparsec (ParseErrorBundle, parse)+import Configuration.Dotenv.Internal (ParsedVariable (..),+ VarFragment (..), VarValue (..),+ configParser)+import Data.Void (Void)+import Test.Hspec (Spec, context, describe, hspec,+ it)+import Test.Hspec.Megaparsec (shouldFailOn, shouldParse,+ shouldSucceedOn)+import Text.Megaparsec (ParseErrorBundle, parse) main :: IO () main = hspec spec
spec/Configuration/Dotenv/TextSpec.hs view
@@ -1,12 +1,12 @@ module Configuration.Dotenv.TextSpec (main, spec) where -import Configuration.Dotenv.Text (parseFile)-import Configuration.Dotenv.Environment (lookupEnv, unsetEnv)+import Configuration.Dotenv.Environment (lookupEnv, unsetEnv)+import Configuration.Dotenv.Internal (parseFile) -import Test.Hspec+import Test.Hspec -import Control.Monad (liftM)-import qualified Data.Text as T+import Control.Monad (liftM)+import qualified Data.Text as T {-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
spec/Configuration/DotenvSpec.hs view
@@ -3,11 +3,10 @@ module Configuration.DotenvSpec (main, spec) where -import Configuration.Dotenv (load, loadFile,+import Configuration.Dotenv (Config (..), load, loadFile, onMissingFile, parseFile) import Configuration.Dotenv.Environment (getEnvironment, lookupEnv, setEnv, unsetEnv)-import Configuration.Dotenv.Types (Config (..)) import Test.Hspec
src/Configuration/Dotenv.hs view
@@ -16,7 +16,8 @@ , loadFile , parseFile , onMissingFile- -- * Dotenv Types+ , configParser+ -- * Dotenv Types , module Configuration.Dotenv.Types ) where
+ src/Configuration/Dotenv/Internal.hs view
@@ -0,0 +1,12 @@+module Configuration.Dotenv.Internal+ ( module Configuration.Dotenv.Types+ , module Configuration.Dotenv.Parse+ , module Configuration.Dotenv.ParsedVariable+ , module Configuration.Dotenv.Text+ )+where++import Configuration.Dotenv.Parse+import Configuration.Dotenv.ParsedVariable+import Configuration.Dotenv.Text+import Configuration.Dotenv.Types
src/Configuration/Dotenv/ParsedVariable.hs view
@@ -17,27 +17,33 @@ interpolateParsedVariables) where import Configuration.Dotenv.Environment (lookupEnv)-import Control.Monad (foldM) import Control.Applicative ((<|>))-import System.Process (readCreateProcess, proc)+import Control.Monad (foldM)+import System.Process (proc, readCreateProcess) +-- | Name and value pair data ParsedVariable = ParsedVariable VarName VarValue deriving (Show, Eq) +-- | Variable name type VarName = String +-- | Possible state of values data VarValue = Unquoted VarContents | SingleQuoted VarContents | DoubleQuoted VarContents deriving (Show, Eq) +-- | List of VarFragment type VarContents = [VarFragment] +-- | Placeholder for possible values data VarFragment = VarInterpolation String | VarLiteral String | CommandInterpolation String [String] deriving (Show, Eq) +-- | Interpotales parsed variables interpolateParsedVariables :: [ParsedVariable] -> IO [(String, String)] interpolateParsedVariables = fmap reverse . foldM addInterpolated []
src/Configuration/Dotenv/Types.hs view
@@ -15,6 +15,8 @@ ) where +import Data.Default.Class+ -- | Configuration Data Types with extra options for executing dotenv. data Config = Config { configPath :: [FilePath] -- ^ The paths for the .env files@@ -35,3 +37,5 @@ , configVerbose = False , allowDuplicates = True }++instance Default Config where def = defaultConfig