env_parser 1.6.2 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +6 -4
- data/Gemfile.lock +104 -30
- data/README.md +2 -2
- data/env_parser.gemspec +19 -12
- data/lib/env_parser/types/chronology_types.rb +1 -1
- data/lib/env_parser/types/internet_types.rb +3 -2
- data/lib/env_parser/version.rb +1 -1
- data/lib/env_parser.rb +18 -18
- metadata +5 -119
- data/.circleci/config.yml +0 -63
- data/.gitignore +0 -14
- data/.rspec +0 -3
- data/.rubocop.yml +0 -64
- data/.ruby-version +0 -1
- data/.yardopts +0 -1
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/docs/EnvParser/AutoregisterFileNotFound.html +0 -143
- data/docs/EnvParser/Error.html +0 -138
- data/docs/EnvParser/TypeAlreadyDefined.html +0 -143
- data/docs/EnvParser/TypeAlreadyDefinedError.html +0 -142
- data/docs/EnvParser/Types/BaseTypes.html +0 -179
- data/docs/EnvParser/Types/ChronologyTypes.html +0 -160
- data/docs/EnvParser/Types/InternetTypes.html +0 -172
- data/docs/EnvParser/Types.html +0 -128
- data/docs/EnvParser/UnknownTypeError.html +0 -142
- data/docs/EnvParser/UnparseableAutoregisterSpec.html +0 -143
- data/docs/EnvParser/ValueNotAllowed.html +0 -144
- data/docs/EnvParser/ValueNotAllowedError.html +0 -144
- data/docs/EnvParser/ValueNotConvertibleError.html +0 -142
- data/docs/EnvParser.html +0 -1240
- data/docs/EnvParserTypes/BaseTypes.html +0 -178
- data/docs/EnvParserTypes/ChronologyTypes.html +0 -159
- data/docs/EnvParserTypes/InternetTypes.html +0 -159
- data/docs/EnvParserTypes/TimeTypes.html +0 -158
- data/docs/EnvParserTypes.html +0 -129
- data/docs/_index.html +0 -243
- data/docs/class_list.html +0 -54
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -503
- data/docs/file.README.html +0 -419
- data/docs/file_list.html +0 -59
- data/docs/frames.html +0 -22
- data/docs/index.html +0 -419
- data/docs/js/app.js +0 -344
- data/docs/js/full_list.js +0 -242
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -94
- data/docs/top-level-namespace.html +0 -110
- data/spec/env_parser/types/base_types_spec.rb +0 -98
- data/spec/env_parser/types/chronology_types_spec.rb +0 -49
- data/spec/env_parser/types/internet_types_spec.rb +0 -95
- data/spec/env_parser_spec.rb +0 -214
- data/spec/spec_helper.rb +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a93e0a4e225b4aef6eb45b249bd39c37394c6657b6090e1136173dff2c9061a5
|
|
4
|
+
data.tar.gz: e970f68c44010617f946b1b26e2eae9c8d728a478067d20af74af97b8c841fed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: faf1d9d145986fbcd73d66d58d3b81a5a49521cacb1f9f5d29877bcdfc8339f4323c663acea28e67ebf86260cffe5511d2332748dba1880cea594170fe57390c
|
|
7
|
+
data.tar.gz: 986dc72b385820beb8899fc3d699fc0a178385e372b010489b39b8a9df7a63f12cb8d9878c7fb4a5dda78efe4b39f61d2a1e3b0ee7e9bbdcc0e902aba36092bf
|
data/Gemfile
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
4
|
-
|
|
5
|
-
# Specify your gem's dependencies in env_parser.gemspec
|
|
6
2
|
gemspec
|
|
3
|
+
|
|
4
|
+
gem 'irb'
|
|
5
|
+
gem 'rspec', '~> 3'
|
|
6
|
+
gem 'rspec_junit_formatter'
|
|
7
|
+
gem 'rubocop'
|
|
8
|
+
gem 'yard'
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
env_parser (1.
|
|
4
|
+
env_parser (1.7.1)
|
|
5
5
|
activesupport (>= 6.1.0, < 9)
|
|
6
6
|
chronic (~> 0)
|
|
7
7
|
chronic_duration (~> 0)
|
|
@@ -9,14 +9,14 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
activesupport (8.
|
|
12
|
+
activesupport (8.1.3)
|
|
13
13
|
base64
|
|
14
|
-
benchmark (>= 0.3)
|
|
15
14
|
bigdecimal
|
|
16
15
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
17
16
|
connection_pool (>= 2.2.5)
|
|
18
17
|
drb
|
|
19
18
|
i18n (>= 1.6, < 2)
|
|
19
|
+
json
|
|
20
20
|
logger (>= 1.4.2)
|
|
21
21
|
minitest (>= 5.1)
|
|
22
22
|
securerandom (>= 0.3)
|
|
@@ -24,80 +24,154 @@ GEM
|
|
|
24
24
|
uri (>= 0.13.1)
|
|
25
25
|
ast (2.4.3)
|
|
26
26
|
base64 (0.3.0)
|
|
27
|
-
|
|
28
|
-
bigdecimal (3.2.2)
|
|
27
|
+
bigdecimal (4.1.2)
|
|
29
28
|
chronic (0.10.2)
|
|
30
29
|
chronic_duration (0.10.6)
|
|
31
30
|
numerizer (~> 0.1.1)
|
|
32
|
-
concurrent-ruby (1.3.
|
|
33
|
-
connection_pool (
|
|
31
|
+
concurrent-ruby (1.3.7)
|
|
32
|
+
connection_pool (3.0.2)
|
|
34
33
|
diff-lcs (1.6.2)
|
|
35
34
|
drb (2.2.3)
|
|
36
|
-
|
|
35
|
+
erb (6.0.7)
|
|
36
|
+
i18n (1.15.2)
|
|
37
37
|
concurrent-ruby (~> 1.0)
|
|
38
|
-
|
|
38
|
+
io-console (0.9.2)
|
|
39
|
+
irb (1.18.0)
|
|
40
|
+
pp (>= 0.6.0)
|
|
41
|
+
prism (>= 1.3.0)
|
|
42
|
+
rdoc (>= 4.0.0)
|
|
43
|
+
reline (>= 0.4.2)
|
|
44
|
+
json (2.19.9)
|
|
39
45
|
language_server-protocol (3.17.0.5)
|
|
40
46
|
lint_roller (1.1.0)
|
|
41
47
|
logger (1.7.0)
|
|
42
|
-
minitest (
|
|
48
|
+
minitest (6.0.6)
|
|
49
|
+
drb (~> 2.0)
|
|
50
|
+
prism (~> 1.5)
|
|
43
51
|
numerizer (0.1.1)
|
|
44
|
-
parallel (1.
|
|
45
|
-
parser (3.3.
|
|
52
|
+
parallel (2.1.0)
|
|
53
|
+
parser (3.3.11.1)
|
|
46
54
|
ast (~> 2.4.1)
|
|
47
55
|
racc
|
|
48
|
-
|
|
56
|
+
pp (0.6.4)
|
|
57
|
+
prettyprint
|
|
58
|
+
prettyprint (0.2.0)
|
|
59
|
+
prism (1.9.0)
|
|
49
60
|
racc (1.8.1)
|
|
50
61
|
rainbow (3.1.1)
|
|
51
|
-
|
|
52
|
-
|
|
62
|
+
rbs (4.1.3)
|
|
63
|
+
logger
|
|
64
|
+
prism (>= 1.6.0)
|
|
65
|
+
tsort
|
|
66
|
+
rdoc (8.1.0)
|
|
67
|
+
erb
|
|
68
|
+
prism (>= 1.6.0)
|
|
69
|
+
rbs (>= 4.0.0)
|
|
70
|
+
tsort
|
|
71
|
+
regexp_parser (2.12.0)
|
|
72
|
+
reline (0.7.0)
|
|
73
|
+
io-console (~> 0.5)
|
|
74
|
+
rspec (3.13.2)
|
|
53
75
|
rspec-core (~> 3.13.0)
|
|
54
76
|
rspec-expectations (~> 3.13.0)
|
|
55
77
|
rspec-mocks (~> 3.13.0)
|
|
56
|
-
rspec-core (3.13.
|
|
78
|
+
rspec-core (3.13.6)
|
|
57
79
|
rspec-support (~> 3.13.0)
|
|
58
80
|
rspec-expectations (3.13.5)
|
|
59
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
60
82
|
rspec-support (~> 3.13.0)
|
|
61
|
-
rspec-mocks (3.13.
|
|
83
|
+
rspec-mocks (3.13.8)
|
|
62
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
63
85
|
rspec-support (~> 3.13.0)
|
|
64
|
-
rspec-support (3.13.
|
|
86
|
+
rspec-support (3.13.7)
|
|
65
87
|
rspec_junit_formatter (0.6.0)
|
|
66
88
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
67
|
-
rubocop (1.
|
|
89
|
+
rubocop (1.88.0)
|
|
68
90
|
json (~> 2.3)
|
|
69
91
|
language_server-protocol (~> 3.17.0.2)
|
|
70
92
|
lint_roller (~> 1.1.0)
|
|
71
|
-
parallel (
|
|
93
|
+
parallel (>= 1.10)
|
|
72
94
|
parser (>= 3.3.0.2)
|
|
73
95
|
rainbow (>= 2.2.2, < 4.0)
|
|
74
96
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
75
|
-
rubocop-ast (>= 1.
|
|
97
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
76
98
|
ruby-progressbar (~> 1.7)
|
|
77
99
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
78
|
-
rubocop-ast (1.
|
|
100
|
+
rubocop-ast (1.49.1)
|
|
79
101
|
parser (>= 3.3.7.2)
|
|
80
|
-
prism (~> 1.
|
|
102
|
+
prism (~> 1.7)
|
|
81
103
|
ruby-progressbar (1.13.0)
|
|
82
104
|
securerandom (0.4.1)
|
|
105
|
+
tsort (0.2.0)
|
|
83
106
|
tzinfo (2.0.6)
|
|
84
107
|
concurrent-ruby (~> 1.0)
|
|
85
|
-
unicode-display_width (3.
|
|
86
|
-
unicode-emoji (~> 4.
|
|
87
|
-
unicode-emoji (4.0
|
|
88
|
-
uri (1.
|
|
89
|
-
yard (0.9.
|
|
108
|
+
unicode-display_width (3.2.0)
|
|
109
|
+
unicode-emoji (~> 4.1)
|
|
110
|
+
unicode-emoji (4.2.0)
|
|
111
|
+
uri (1.1.1)
|
|
112
|
+
yard (0.9.44)
|
|
90
113
|
|
|
91
114
|
PLATFORMS
|
|
92
115
|
ruby
|
|
116
|
+
x86_64-linux
|
|
93
117
|
|
|
94
118
|
DEPENDENCIES
|
|
95
|
-
bundler (~> 2)
|
|
96
119
|
env_parser!
|
|
120
|
+
irb
|
|
97
121
|
rspec (~> 3)
|
|
98
122
|
rspec_junit_formatter
|
|
99
123
|
rubocop
|
|
100
124
|
yard
|
|
101
125
|
|
|
126
|
+
CHECKSUMS
|
|
127
|
+
activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e
|
|
128
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
129
|
+
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
130
|
+
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
131
|
+
chronic (0.10.2) sha256=766f2fcce6ac3cc152249ed0f2b827770d3e517e2e87c5fba7ed74f4889d2dc3
|
|
132
|
+
chronic_duration (0.10.6) sha256=fac58d4147d3183a40811400380cafcef049f2bb02421d2fd1c6e685fbe8facc
|
|
133
|
+
concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
|
|
134
|
+
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
135
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
136
|
+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
137
|
+
env_parser (1.7.1)
|
|
138
|
+
erb (6.0.7) sha256=c5ca6dc25b0ef974a44dc8f59fe847577122483b1968a38dec305c60bf91ee92
|
|
139
|
+
i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
|
|
140
|
+
io-console (0.9.2) sha256=efa74f891dd03c0939a931dfc6e74c2813d904763d456ea9762b0525e748db08
|
|
141
|
+
irb (1.18.0) sha256=de9454a0703a54704b9811a5ef31a60c86949fbf4013fcf244fabc7c775248e3
|
|
142
|
+
json (2.19.9) sha256=9b9025b7cdddafa38d316eca0b2358488e42d417045c1b90d216a9fefe46b79a
|
|
143
|
+
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
144
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
145
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
146
|
+
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
|
|
147
|
+
numerizer (0.1.1) sha256=10ec9efec62472b69a3a0e275a18a44baa595ce6e2e4cfc1678d5cb2974c336f
|
|
148
|
+
parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
|
|
149
|
+
parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
|
|
150
|
+
pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570
|
|
151
|
+
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
|
|
152
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
153
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
154
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
155
|
+
rbs (4.1.3) sha256=0c4474a9751cdc14364bfad0b3e53678323bbdc2c31683b0445932867dbab8c4
|
|
156
|
+
rdoc (8.1.0) sha256=befc37880a5cfd36dcb176c748b5fd5ee39dd3536a75e81824e4972ce230f60a
|
|
157
|
+
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
|
|
158
|
+
reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d
|
|
159
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
160
|
+
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
|
|
161
|
+
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
162
|
+
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
|
|
163
|
+
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
164
|
+
rspec_junit_formatter (0.6.0) sha256=40dde674e6ae4e6cc0ff560da25497677e34fefd2338cc467a8972f602b62b15
|
|
165
|
+
rubocop (1.88.0) sha256=e420ddf1662d0ef34bc8a2910ac4b396a7ddda0b51a708264405241734b08e0b
|
|
166
|
+
rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
|
|
167
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
168
|
+
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
169
|
+
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
|
170
|
+
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
|
|
171
|
+
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
172
|
+
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
173
|
+
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
174
|
+
yard (0.9.44) sha256=eb087e9b631ccd887b049f303d489963945452d5e2a7eb49a5a74a7cf6887f28
|
|
175
|
+
|
|
102
176
|
BUNDLED WITH
|
|
103
|
-
|
|
177
|
+
4.0.10
|
data/README.md
CHANGED
|
@@ -8,7 +8,7 @@ If your code uses environment variables, you know that `ENV` will always surface
|
|
|
8
8
|
|
|
9
9
|
Things can get out of control pretty fast, especially as the number of environment variables in play grows. Tools like [dotenv](https://github.com/bkeepers/dotenv) help to make sure you're loading the correct **set** of variables, but [EnvParser](https://github.com/nestor-custodio/env_parser) makes **the values themselves** usable with a minimum of effort.
|
|
10
10
|
|
|
11
|
-
[Full documentation is available here](
|
|
11
|
+
[Full documentation is available here](https://nestor-custodio.github.io/env_parser/EnvParser.html), but do read below for a crash course on availble featues!
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
@@ -85,7 +85,7 @@ EnvParser.add_env_bindings # ENV.parse will now be a proxy for EnvParser.parse
|
|
|
85
85
|
timeout_ms = EnvParser.parse ENV['TIMEOUT_MS'], as: :integer
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
You can check the full documentation for [a list of all **_as_** types available right out of the box](
|
|
88
|
+
You can check the full documentation for [a list of all **_as_** types available right out of the box](https://nestor-custodio.github.io/env_parser/EnvParser/Types.html).
|
|
89
89
|
|
|
90
90
|
- **How About Less Typing?**
|
|
91
91
|
|
data/env_parser.gemspec
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require 'env_parser/version'
|
|
1
|
+
require_relative 'lib/env_parser/version'
|
|
4
2
|
|
|
5
3
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.required_ruby_version =
|
|
4
|
+
spec.required_ruby_version = '>= 3.4'
|
|
7
5
|
|
|
8
6
|
spec.name = 'env_parser'
|
|
9
7
|
spec.version = EnvParser::VERSION
|
|
@@ -14,19 +12,28 @@ Gem::Specification.new do |spec|
|
|
|
14
12
|
spec.homepage = 'https://github.com/nestor-custodio/env_parser'
|
|
15
13
|
spec.license = 'MIT'
|
|
16
14
|
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0")
|
|
15
|
+
spec.files = `git ls-files -z`.split("\x0") & Dir['*', 'lib/**/*']
|
|
18
16
|
spec.executables = []
|
|
19
17
|
spec.require_paths = ['lib']
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
# ---
|
|
20
|
+
|
|
21
|
+
spec.metadata = {
|
|
22
|
+
# See: https://guides.rubygems.org/specification-reference/#metadata
|
|
23
|
+
|
|
24
|
+
# RubyGems.org Security
|
|
25
|
+
#
|
|
26
|
+
'allowed_push_host' => 'https://rubygems.org',
|
|
27
|
+
'rubygems_mfa_required' => 'true',
|
|
28
|
+
|
|
29
|
+
# Metadata-Provided URIs
|
|
30
|
+
#
|
|
31
|
+
'homepage_uri' => spec.homepage
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# ---
|
|
22
35
|
|
|
23
36
|
spec.add_dependency 'activesupport', ['>= 6.1.0', '< 9']
|
|
24
37
|
spec.add_dependency 'chronic', '~> 0'
|
|
25
38
|
spec.add_dependency 'chronic_duration', '~> 0'
|
|
26
|
-
|
|
27
|
-
spec.add_development_dependency 'bundler', '~> 2'
|
|
28
|
-
spec.add_development_dependency 'rspec', '~> 3'
|
|
29
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
|
30
|
-
spec.add_development_dependency 'rubocop'
|
|
31
|
-
spec.add_development_dependency 'yard'
|
|
32
39
|
end
|
|
@@ -88,7 +88,7 @@ module EnvParser::Types
|
|
|
88
88
|
# With `raise_exceptions` set, ChronicDuration will fail on the "P" and "T" in ISO8601
|
|
89
89
|
# periods, so we have to check for and remove them.
|
|
90
90
|
#
|
|
91
|
-
iso_period = %r{^\s*P(?:[0-9.]Y)?(?:[0-9.]M)?(?:[0-9.]W)?(?:[0-9.]D)?(?:T(?:[0-9.]H)?(?:[0-9.]M)?(?:[0-9.]S)?)?\s*$}
|
|
91
|
+
iso_period = %r{^\s*P(?:[0-9.]Y)?(?:[0-9.]M)?(?:[0-9.]W)?(?:[0-9.]D)?(?:T(?:[0-9.]H)?(?:[0-9.]M)?(?:[0-9.]S)?)?\s*$} # rubocop:disable Layout/LineLength
|
|
92
92
|
value = value.delete 'PT' if value =~ iso_period
|
|
93
93
|
|
|
94
94
|
value = ChronicDuration.parse value, keep_zero: true
|
|
@@ -102,7 +102,7 @@ module EnvParser::Types
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
EnvParser.define_type(:email_address, if_unset: nil) do |value|
|
|
105
|
-
simple_email = %r[^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$]i
|
|
105
|
+
simple_email = %r[^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$]i # rubocop:disable Layout/LineLength
|
|
106
106
|
raise(EnvParser::ValueNotConvertibleError, 'not an email') unless value.match?(simple_email)
|
|
107
107
|
|
|
108
108
|
value
|
|
@@ -110,7 +110,8 @@ module EnvParser::Types
|
|
|
110
110
|
|
|
111
111
|
EnvParser.define_type(:version, aliases: :semver, if_unset: nil) do |value|
|
|
112
112
|
# We're using the official semver.org-provided regex.
|
|
113
|
-
|
|
113
|
+
#
|
|
114
|
+
semver = %r{^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$} # rubocop:disable Layout/LineLength
|
|
114
115
|
|
|
115
116
|
match_data = value.match(semver)
|
|
116
117
|
raise(EnvParser::ValueNotConvertibleError, 'not a semver-compliant value') unless match_data
|
data/lib/env_parser/version.rb
CHANGED
data/lib/env_parser.rb
CHANGED
|
@@ -46,10 +46,10 @@ class EnvParser
|
|
|
46
46
|
|
|
47
47
|
given_types = (Array(name) + Array(options[:aliases])).map(&:to_s).map(&:to_sym)
|
|
48
48
|
given_types.each do |type|
|
|
49
|
-
raise(TypeAlreadyDefinedError, "cannot redefine #{type.inspect}") if known_types.
|
|
49
|
+
raise(TypeAlreadyDefinedError, "cannot redefine #{type.inspect}") if known_types.has_key?(type)
|
|
50
50
|
|
|
51
51
|
known_types[type] = {
|
|
52
|
-
parser:
|
|
52
|
+
parser: parser,
|
|
53
53
|
if_unset: options[:if_unset]
|
|
54
54
|
}
|
|
55
55
|
end
|
|
@@ -114,13 +114,13 @@ class EnvParser
|
|
|
114
114
|
value = value.to_s
|
|
115
115
|
|
|
116
116
|
type = known_types[options[:as]]
|
|
117
|
-
raise(ArgumentError, 'missing `as` parameter') unless options.
|
|
117
|
+
raise(ArgumentError, 'missing `as` parameter') unless options.has_key?(:as)
|
|
118
118
|
raise(UnknownTypeError, "invalid `as` parameter: #{options[:as].inspect}") unless type
|
|
119
119
|
|
|
120
|
-
return (options.
|
|
120
|
+
return (options.has_key?(:if_unset) ? options[:if_unset] : type[:if_unset]) if value.blank?
|
|
121
121
|
|
|
122
122
|
value = type[:parser].call(value)
|
|
123
|
-
check_for_set_inclusion(value, set: options[:from_set]) if options.
|
|
123
|
+
check_for_set_inclusion(value, set: options[:from_set]) if options.has_key?(:from_set)
|
|
124
124
|
check_user_defined_validations(value, proc: options[:validated_by], block: validation_block)
|
|
125
125
|
|
|
126
126
|
value
|
|
@@ -188,10 +188,11 @@ class EnvParser
|
|
|
188
188
|
#
|
|
189
189
|
# @raise [ArgumentError]
|
|
190
190
|
#
|
|
191
|
-
def register(name, options = {}, &
|
|
191
|
+
def register(name, options = {}, &)
|
|
192
192
|
# Allow for registering multiple variables simultaneously via a single call.
|
|
193
193
|
if name.is_a? Hash
|
|
194
194
|
raise(ArgumentError, 'cannot register multiple values with one block') if block_given?
|
|
195
|
+
|
|
195
196
|
return register_all(name)
|
|
196
197
|
end
|
|
197
198
|
|
|
@@ -199,22 +200,23 @@ class EnvParser
|
|
|
199
200
|
within = options.fetch(:within, Kernel)
|
|
200
201
|
|
|
201
202
|
named = name
|
|
202
|
-
named = options.fetch(:named, name) if options.
|
|
203
|
+
named = options.fetch(:named, name) if options.has_key? :within
|
|
203
204
|
|
|
204
205
|
# ENV *seems* like a Hash and it does *some* Hash-y things, but it is NOT a Hash and that can
|
|
205
206
|
# bite you in some cases. Making sure we're working with a straight-up Hash saves a lot of
|
|
206
207
|
# sanity checks later on. This is also a good place to make sure we're working with a String
|
|
207
208
|
# key.
|
|
209
|
+
#
|
|
208
210
|
if from == ENV
|
|
209
211
|
from = from.to_h
|
|
210
212
|
name = name.to_s
|
|
211
213
|
end
|
|
212
214
|
|
|
213
215
|
raise ArgumentError, "invalid `from` parameter: #{from.class}" unless from.is_a? Hash
|
|
214
|
-
raise ArgumentError, "invalid `within` parameter: #{within.inspect}" unless within.is_a?
|
|
216
|
+
raise ArgumentError, "invalid `within` parameter: #{within.inspect}" unless within.is_a? Module
|
|
215
217
|
|
|
216
218
|
value = from[name]
|
|
217
|
-
value = parse(value, options, &
|
|
219
|
+
value = parse(value, options, &)
|
|
218
220
|
within.const_set(named.upcase.to_sym, value.dup.freeze)
|
|
219
221
|
|
|
220
222
|
value
|
|
@@ -231,12 +233,12 @@ class EnvParser
|
|
|
231
233
|
#
|
|
232
234
|
def add_env_bindings
|
|
233
235
|
ENV.instance_eval do
|
|
234
|
-
def parse(name, options = {}, &
|
|
235
|
-
EnvParser.parse(self[name.to_s], options, &
|
|
236
|
+
def parse(name, options = {}, &)
|
|
237
|
+
EnvParser.parse(self[name.to_s], options, &)
|
|
236
238
|
end
|
|
237
239
|
|
|
238
|
-
def register(*
|
|
239
|
-
EnvParser.register(*
|
|
240
|
+
def register(*)
|
|
241
|
+
EnvParser.register(*)
|
|
240
242
|
end
|
|
241
243
|
end
|
|
242
244
|
|
|
@@ -265,8 +267,8 @@ class EnvParser
|
|
|
265
267
|
autoregister_spec.deep_symbolize_keys!
|
|
266
268
|
autoregister_spec.transform_values! do |spec|
|
|
267
269
|
sanitized = spec.slice(:as, :named, :within, :if_unset, :from_set)
|
|
268
|
-
sanitized[:as] = sanitized[:as].to_sym if sanitized.
|
|
269
|
-
sanitized[:within] = sanitized[:within].constantize if sanitized.
|
|
270
|
+
sanitized[:as] = sanitized[:as].to_sym if sanitized.has_key? :as
|
|
271
|
+
sanitized[:within] = sanitized[:within].constantize if sanitized.has_key? :within
|
|
270
272
|
|
|
271
273
|
sanitized
|
|
272
274
|
end
|
|
@@ -339,9 +341,7 @@ class EnvParser
|
|
|
339
341
|
def register_all(list)
|
|
340
342
|
raise(ArgumentError, "invalid 'list' parameter type: #{list.class}") unless list.is_a? Hash
|
|
341
343
|
|
|
342
|
-
list.
|
|
343
|
-
output[tuple.first] = register(tuple.first, tuple.second)
|
|
344
|
-
end
|
|
344
|
+
list.to_h { |name, options| [name, register(name, options)] }
|
|
345
345
|
end
|
|
346
346
|
end
|
|
347
347
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: env_parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nestor Custodio
|
|
@@ -57,128 +57,17 @@ dependencies:
|
|
|
57
57
|
- - "~>"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
59
|
version: '0'
|
|
60
|
-
- !ruby/object:Gem::Dependency
|
|
61
|
-
name: bundler
|
|
62
|
-
requirement: !ruby/object:Gem::Requirement
|
|
63
|
-
requirements:
|
|
64
|
-
- - "~>"
|
|
65
|
-
- !ruby/object:Gem::Version
|
|
66
|
-
version: '2'
|
|
67
|
-
type: :development
|
|
68
|
-
prerelease: false
|
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
70
|
-
requirements:
|
|
71
|
-
- - "~>"
|
|
72
|
-
- !ruby/object:Gem::Version
|
|
73
|
-
version: '2'
|
|
74
|
-
- !ruby/object:Gem::Dependency
|
|
75
|
-
name: rspec
|
|
76
|
-
requirement: !ruby/object:Gem::Requirement
|
|
77
|
-
requirements:
|
|
78
|
-
- - "~>"
|
|
79
|
-
- !ruby/object:Gem::Version
|
|
80
|
-
version: '3'
|
|
81
|
-
type: :development
|
|
82
|
-
prerelease: false
|
|
83
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
84
|
-
requirements:
|
|
85
|
-
- - "~>"
|
|
86
|
-
- !ruby/object:Gem::Version
|
|
87
|
-
version: '3'
|
|
88
|
-
- !ruby/object:Gem::Dependency
|
|
89
|
-
name: rspec_junit_formatter
|
|
90
|
-
requirement: !ruby/object:Gem::Requirement
|
|
91
|
-
requirements:
|
|
92
|
-
- - ">="
|
|
93
|
-
- !ruby/object:Gem::Version
|
|
94
|
-
version: '0'
|
|
95
|
-
type: :development
|
|
96
|
-
prerelease: false
|
|
97
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
98
|
-
requirements:
|
|
99
|
-
- - ">="
|
|
100
|
-
- !ruby/object:Gem::Version
|
|
101
|
-
version: '0'
|
|
102
|
-
- !ruby/object:Gem::Dependency
|
|
103
|
-
name: rubocop
|
|
104
|
-
requirement: !ruby/object:Gem::Requirement
|
|
105
|
-
requirements:
|
|
106
|
-
- - ">="
|
|
107
|
-
- !ruby/object:Gem::Version
|
|
108
|
-
version: '0'
|
|
109
|
-
type: :development
|
|
110
|
-
prerelease: false
|
|
111
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
112
|
-
requirements:
|
|
113
|
-
- - ">="
|
|
114
|
-
- !ruby/object:Gem::Version
|
|
115
|
-
version: '0'
|
|
116
|
-
- !ruby/object:Gem::Dependency
|
|
117
|
-
name: yard
|
|
118
|
-
requirement: !ruby/object:Gem::Requirement
|
|
119
|
-
requirements:
|
|
120
|
-
- - ">="
|
|
121
|
-
- !ruby/object:Gem::Version
|
|
122
|
-
version: '0'
|
|
123
|
-
type: :development
|
|
124
|
-
prerelease: false
|
|
125
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
126
|
-
requirements:
|
|
127
|
-
- - ">="
|
|
128
|
-
- !ruby/object:Gem::Version
|
|
129
|
-
version: '0'
|
|
130
60
|
email:
|
|
131
61
|
- nestor@custodio.org
|
|
132
62
|
executables: []
|
|
133
63
|
extensions: []
|
|
134
64
|
extra_rdoc_files: []
|
|
135
65
|
files:
|
|
136
|
-
- ".circleci/config.yml"
|
|
137
|
-
- ".gitignore"
|
|
138
|
-
- ".rspec"
|
|
139
|
-
- ".rubocop.yml"
|
|
140
|
-
- ".ruby-version"
|
|
141
|
-
- ".yardopts"
|
|
142
66
|
- Gemfile
|
|
143
67
|
- Gemfile.lock
|
|
144
68
|
- LICENSE.txt
|
|
145
69
|
- README.md
|
|
146
70
|
- Rakefile
|
|
147
|
-
- bin/console
|
|
148
|
-
- bin/setup
|
|
149
|
-
- docs/EnvParser.html
|
|
150
|
-
- docs/EnvParser/AutoregisterFileNotFound.html
|
|
151
|
-
- docs/EnvParser/Error.html
|
|
152
|
-
- docs/EnvParser/TypeAlreadyDefined.html
|
|
153
|
-
- docs/EnvParser/TypeAlreadyDefinedError.html
|
|
154
|
-
- docs/EnvParser/Types.html
|
|
155
|
-
- docs/EnvParser/Types/BaseTypes.html
|
|
156
|
-
- docs/EnvParser/Types/ChronologyTypes.html
|
|
157
|
-
- docs/EnvParser/Types/InternetTypes.html
|
|
158
|
-
- docs/EnvParser/UnknownTypeError.html
|
|
159
|
-
- docs/EnvParser/UnparseableAutoregisterSpec.html
|
|
160
|
-
- docs/EnvParser/ValueNotAllowed.html
|
|
161
|
-
- docs/EnvParser/ValueNotAllowedError.html
|
|
162
|
-
- docs/EnvParser/ValueNotConvertibleError.html
|
|
163
|
-
- docs/EnvParserTypes.html
|
|
164
|
-
- docs/EnvParserTypes/BaseTypes.html
|
|
165
|
-
- docs/EnvParserTypes/ChronologyTypes.html
|
|
166
|
-
- docs/EnvParserTypes/InternetTypes.html
|
|
167
|
-
- docs/EnvParserTypes/TimeTypes.html
|
|
168
|
-
- docs/_index.html
|
|
169
|
-
- docs/class_list.html
|
|
170
|
-
- docs/css/common.css
|
|
171
|
-
- docs/css/full_list.css
|
|
172
|
-
- docs/css/style.css
|
|
173
|
-
- docs/file.README.html
|
|
174
|
-
- docs/file_list.html
|
|
175
|
-
- docs/frames.html
|
|
176
|
-
- docs/index.html
|
|
177
|
-
- docs/js/app.js
|
|
178
|
-
- docs/js/full_list.js
|
|
179
|
-
- docs/js/jquery.js
|
|
180
|
-
- docs/method_list.html
|
|
181
|
-
- docs/top-level-namespace.html
|
|
182
71
|
- env_parser.gemspec
|
|
183
72
|
- lib/env_parser.rb
|
|
184
73
|
- lib/env_parser/autoregister.rb
|
|
@@ -188,24 +77,21 @@ files:
|
|
|
188
77
|
- lib/env_parser/types/chronology_types.rb
|
|
189
78
|
- lib/env_parser/types/internet_types.rb
|
|
190
79
|
- lib/env_parser/version.rb
|
|
191
|
-
- spec/env_parser/types/base_types_spec.rb
|
|
192
|
-
- spec/env_parser/types/chronology_types_spec.rb
|
|
193
|
-
- spec/env_parser/types/internet_types_spec.rb
|
|
194
|
-
- spec/env_parser_spec.rb
|
|
195
|
-
- spec/spec_helper.rb
|
|
196
80
|
homepage: https://github.com/nestor-custodio/env_parser
|
|
197
81
|
licenses:
|
|
198
82
|
- MIT
|
|
199
83
|
metadata:
|
|
84
|
+
allowed_push_host: https://rubygems.org
|
|
200
85
|
rubygems_mfa_required: 'true'
|
|
86
|
+
homepage_uri: https://github.com/nestor-custodio/env_parser
|
|
201
87
|
rdoc_options: []
|
|
202
88
|
require_paths:
|
|
203
89
|
- lib
|
|
204
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
91
|
requirements:
|
|
206
|
-
- - "
|
|
92
|
+
- - ">="
|
|
207
93
|
- !ruby/object:Gem::Version
|
|
208
|
-
version: '3'
|
|
94
|
+
version: '3.4'
|
|
209
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
96
|
requirements:
|
|
211
97
|
- - ">="
|
data/.circleci/config.yml
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Ruby CircleCI 2.0 configuration file
|
|
2
|
-
#
|
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
|
4
|
-
#
|
|
5
|
-
version: 2.1
|
|
6
|
-
jobs:
|
|
7
|
-
build:
|
|
8
|
-
docker:
|
|
9
|
-
# specify the version you desire here
|
|
10
|
-
- image: cimg/ruby:3.4
|
|
11
|
-
|
|
12
|
-
# Specify service dependencies here if necessary
|
|
13
|
-
# CircleCI maintains a library of pre-built images
|
|
14
|
-
# documented at https://circleci.com/docs/2.0/circleci-images/
|
|
15
|
-
# - image: circleci/postgres:9.4
|
|
16
|
-
|
|
17
|
-
working_directory: ~/repo
|
|
18
|
-
|
|
19
|
-
steps:
|
|
20
|
-
- checkout
|
|
21
|
-
|
|
22
|
-
# Download and cache dependencies
|
|
23
|
-
- restore_cache:
|
|
24
|
-
keys:
|
|
25
|
-
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
|
26
|
-
# fallback to using the latest cache if no exact match is found
|
|
27
|
-
- v1-dependencies
|
|
28
|
-
|
|
29
|
-
- run:
|
|
30
|
-
name: update bundler
|
|
31
|
-
command: |
|
|
32
|
-
gem install bundler --version $(tail -n 1 ~/repo/Gemfile.lock | tr -d ' ')
|
|
33
|
-
|
|
34
|
-
- run:
|
|
35
|
-
name: install dependencies
|
|
36
|
-
command: |
|
|
37
|
-
bundle install --jobs=$(nproc) --retry=3 --path vendor/bundle
|
|
38
|
-
|
|
39
|
-
- save_cache:
|
|
40
|
-
paths:
|
|
41
|
-
- ./vendor/bundle
|
|
42
|
-
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
|
43
|
-
|
|
44
|
-
# run tests!
|
|
45
|
-
- run:
|
|
46
|
-
name: run tests
|
|
47
|
-
command: |
|
|
48
|
-
mkdir /tmp/test-results
|
|
49
|
-
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
|
50
|
-
|
|
51
|
-
bundle exec rspec --format progress \
|
|
52
|
-
--format RspecJunitFormatter \
|
|
53
|
-
--out /tmp/test-results/rspec.xml \
|
|
54
|
-
--format progress \
|
|
55
|
-
-- \
|
|
56
|
-
$TEST_FILES
|
|
57
|
-
|
|
58
|
-
# collect reports
|
|
59
|
-
- store_test_results:
|
|
60
|
-
path: /tmp/test-results
|
|
61
|
-
- store_artifacts:
|
|
62
|
-
path: /tmp/test-results
|
|
63
|
-
destination: test-results
|