From 2e0e3fecbe17bd3034ddbc80df52c5ce8ccbe4f5 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Fri, 25 May 2018 16:47:49 -0400 Subject: [PATCH 1/3] Back-fill CHANGELOG --- CHANGELOG.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1333ed7..9685dcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,40 @@ -TODO +## [*Unreleased*](https://github.com/pbrisbin/load-env/compare/master...v0.2.0.1) + +None + +## [v0.2.0.1](https://github.com/pbrisbin/load-env/compare/v0.2.0.0...v0.2.0.1) + +- Packaging and documentation updates + +## [v0.2.0.0](https://github.com/pbrisbin/load-env/compare/v0.1.2...v0.2.0.0) + +- Traverse up parent directories to find the `.env` file + +## [v0.1.2](https://github.com/pbrisbin/load-env/compare/v0.1.1...v0.1.2) + +- Packaging updates + +## [v0.1.1](https://github.com/pbrisbin/load-env/compare/v0.1.0...v0.1.1) + +- Parse variables names more strictly + +## [v0.1.0](https://github.com/pbrisbin/load-env/compare/v0.0.4...v0.1.0) + +- Don't fail on an empty file +- Ignore any invalid lines, not specifically things that look like comments + +## [v0.0.4](https://github.com/pbrisbin/load-env/compare/v0.0.3...v0.0.4) + +- Don't throw an exception if the `.env` file is missing + +## [v0.0.3](https://github.com/pbrisbin/load-env/compare/v0.0.2...v0.0.3) + +- Variable names can contain underscores + +## [v0.0.2](https://github.com/pbrisbin/load-env/compare/v0.0.1...v0.0.2) + +- Drop support for GHC < 7.8 + +## [v0.0.1](https://github.com/pbrisbin/load-env/tree/v0.0.1) + +Initial release. From 755a360d7939c8a6c1e37a1ab57365ab1814b975 Mon Sep 17 00:00:00 2001 From: Deni Bertovic Date: Thu, 11 Oct 2018 14:04:19 +0200 Subject: [PATCH 2/3] Allows lower case variable names As per updated spec: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html --- src/LoadEnv/Parse.hs | 18 ++++++++++++------ test/LoadEnv/ParseSpec.hs | 6 ++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/LoadEnv/Parse.hs b/src/LoadEnv/Parse.hs index 90fefac..d218da4 100644 --- a/src/LoadEnv/Parse.hs +++ b/src/LoadEnv/Parse.hs @@ -38,16 +38,22 @@ parseVariable = do pure (i, v) -- Environment variable names used by the utilities in the Shell and Utilities --- volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, --- and the '_' (underscore) from the characters defined in Portable Character --- Set and do not begin with a digit. +-- volume of POSIX.1-2017 consist solely of uppercase letters, digits, +-- and the ( '_' ) from the characters defined in Portable +-- Character Set and do not begin with a digit. Other characters may be +-- permitted by an implementation; applications shall tolerate the presence +-- of such names. Uppercase and lowercase letters shall retain their unique +-- identities and shall not be folded together. The name space of environment +-- variable names containing lowercase letters is reserved for applications. +-- Applications can define any environment variables with names from this name +-- space without modifying the behavior of the standard utilities. -- --- +-- -- identifier :: Parser String identifier = do - x <- upper <|> underscore - ys <- many $ upper <|> digit <|> underscore + x <- upper <|> lower <|> underscore + ys <- many $ upper <|> lower <|> digit <|> underscore pure (x:ys) diff --git a/test/LoadEnv/ParseSpec.hs b/test/LoadEnv/ParseSpec.hs index 6c1f90b..925ead5 100644 --- a/test/LoadEnv/ParseSpec.hs +++ b/test/LoadEnv/ParseSpec.hs @@ -97,13 +97,15 @@ spec = do `shouldBe` Right ("S3_KEY", "abc123") parse parseVariable "" "_S3_KEY=abc123\n" `shouldBe` Right ("_S3_KEY", "abc123") + parse parseVariable "" "S3_key=abc123\n" + `shouldBe` Right ("S3_key", "abc123") + parse parseVariable "" "s3_key=abc123\n" + `shouldBe` Right ("s3_key", "abc123") parse parseVariable "" "S3~KEY=abc123\n" `shouldContainError` "unexpected \"~\"" parse parseVariable "" "S3-KEY=abc123\n" `shouldContainError` "unexpected \"-\"" - parse parseVariable "" "S3_key=abc123\n" - `shouldContainError` "unexpected \"k\"" parse parseVariable "" "3_KEY=abc123\n" `shouldContainError` "unexpected \"3\"" From 963eb3671ce6b96e375c00404b8a41f8f063549e Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Fri, 12 Oct 2018 16:27:24 -0400 Subject: [PATCH 3/3] Version bump --- CHANGELOG.md | 6 +++++- package.yaml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9685dcf..e7d408f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ -## [*Unreleased*](https://github.com/pbrisbin/load-env/compare/master...v0.2.0.1) +## [*Unreleased*](https://github.com/pbrisbin/load-env/compare/v0.2.0.2...master) None +## [v0.2.0.2](https://github.com/pbrisbin/load-env/compare/v0.2.0.1...v0.2.0.2) + +- Allow lower-case characters in variable names [@denibertovic](https://github.com/pbrisbin/load-env/pull/4) + ## [v0.2.0.1](https://github.com/pbrisbin/load-env/compare/v0.2.0.0...v0.2.0.1) - Packaging and documentation updates diff --git a/package.yaml b/package.yaml index 44265b7..da1df3d 100644 --- a/package.yaml +++ b/package.yaml @@ -1,6 +1,6 @@ --- name: load-env -version: '0.2.0.1' +version: '0.2.0.2' synopsis: Load environment variables from a file. description: > Parse a .env file and load any declared variables into the current process's