env_parser 0.2.0 → 0.3.0
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/.circleci/config.yml +62 -0
- data/Gemfile.lock +4 -1
- data/README.md +21 -2
- data/docs/EnvParser/ValueNotAllowed.html +136 -0
- data/docs/EnvParser.html +97 -46
- data/docs/_index.html +16 -1
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +38 -12
- data/docs/index.html +38 -12
- data/docs/top-level-namespace.html +1 -1
- data/env_parser.gemspec +1 -0
- data/lib/env_parser/version.rb +1 -1
- data/lib/env_parser.rb +54 -20
- metadata +18 -3
- data/CODE_OF_CONDUCT.md +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4a74430339836ddc96fb9cc9a263cda76cd56e8
|
4
|
+
data.tar.gz: 54a8006eafc16759eaf77d5b599f3d971ceaa1cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb0f1411eed85ebb78ef6d60954252a1625bffb4a7018c2273eaee3412cf932fa48e3d09028b9786054ecf4df683244f9ceaa9727d70254343107b2d14eb81d
|
7
|
+
data.tar.gz: 855b7753725fdc5da43cb1d064fbf96717e50e0e4bb8190c40a58f2d73ad29eeff3b3156ed125ba215f45c83587d27d8cbdd0b34a0d715d69931d4b3ec50eb41
|
@@ -0,0 +1,62 @@
|
|
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
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
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=4 --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
|
+
"${TEST_FILES}"
|
56
|
+
|
57
|
+
# collect reports
|
58
|
+
- store_test_results:
|
59
|
+
path: /tmp/test-results
|
60
|
+
- store_artifacts:
|
61
|
+
path: /tmp/test-results
|
62
|
+
destination: test-results
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
env_parser (0.
|
4
|
+
env_parser (0.3.0)
|
5
5
|
activesupport (>= 5.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -31,6 +31,8 @@ GEM
|
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
32
|
rspec-support (~> 3.7.0)
|
33
33
|
rspec-support (3.7.0)
|
34
|
+
rspec_junit_formatter (0.3.0)
|
35
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
34
36
|
thread_safe (0.3.6)
|
35
37
|
tzinfo (1.2.4)
|
36
38
|
thread_safe (~> 0.1)
|
@@ -43,6 +45,7 @@ DEPENDENCIES
|
|
43
45
|
env_parser!
|
44
46
|
rake (~> 10.0)
|
45
47
|
rspec (~> 3.0)
|
48
|
+
rspec_junit_formatter
|
46
49
|
|
47
50
|
BUNDLED WITH
|
48
51
|
1.16.0
|
data/README.md
CHANGED
@@ -39,6 +39,27 @@ timeout_ms = EnvParser.parse ENV['TIMEOUT_MS'], as: :integer
|
|
39
39
|
## (i.e. passing in `ENV['X']` is equivalent to passing in `:X`)
|
40
40
|
##
|
41
41
|
timeout_ms = EnvParser.parse :TIMEOUT_MS, as: :integer
|
42
|
+
|
43
|
+
## If the ENV variable you want is unset (`nil`) or blank (`''`),
|
44
|
+
## the return value is a sensible default for the given "as" type.
|
45
|
+
## Sometimes you want a non-trivial default (not just 0, '', etc), however.
|
46
|
+
##
|
47
|
+
EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer ## => 0
|
48
|
+
EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer, if_unset: 250 ## => 250
|
49
|
+
|
50
|
+
## Note that "if_unset" values are used as-is, with no type conversion.
|
51
|
+
##
|
52
|
+
EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer, if_unset: 'oof!' ## => 'oof!'
|
53
|
+
|
54
|
+
## You can also restrict the set of allowed values.
|
55
|
+
## (Sometimes setting the type alone is a bit too open-ended.)
|
56
|
+
##
|
57
|
+
EnvParser.parse :API_TO_USE, as: :symbol, from_set: %i[internal external]
|
58
|
+
EnvParser.parse :SOME_CUSTOM_NETWORK_PORT, as: :integer, from_set: (1..65535), if_unset: 80
|
59
|
+
|
60
|
+
## And if the value is not allowed...
|
61
|
+
##
|
62
|
+
EnvParser.parse :SOME_NEGATIVE_NUMBER, as: :integer, from_set: (1..5) ## => raises EnvParser::ValueNotAllowed
|
42
63
|
```
|
43
64
|
|
44
65
|
---
|
@@ -66,8 +87,6 @@ Note JSON is parsed using *quirks-mode* (meaning 'true', '25', and 'null' are al
|
|
66
87
|
## Feature Roadmap / Future Development
|
67
88
|
|
68
89
|
Additional features/options coming in the future:
|
69
|
-
- An `:if_unset` option to more easily set default values.
|
70
|
-
- A `:from_set` option to restrict acceptable values to those on a given list.
|
71
90
|
- An `EnvParser.load` method that will not only parse the given value, but will set a constant, easily converting environment variables into constants in your code.
|
72
91
|
- An `EnvParser.load_all` method to shortcut multiple `.load` calls.
|
73
92
|
- A means to **optionally** bind `#parse`, `#load`, and `#load_all` methods onto `ENV` itself (not all hashes!). Because `ENV.parse ...` reads better than `EnvParser.parse ...`.
|
@@ -0,0 +1,136 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Exception: EnvParser::ValueNotAllowed
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.11
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "EnvParser::ValueNotAllowed";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (V)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../EnvParser.html" title="EnvParser (class)">EnvParser</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">ValueNotAllowed</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Exception: EnvParser::ValueNotAllowed
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">StandardError</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">StandardError</li>
|
78
|
+
|
79
|
+
<li class="next">EnvParser::ValueNotAllowed</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/env_parser.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>Exception class used to indicate parsed values not allowed per a “from_set”
|
108
|
+
option.</p>
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
<div class="tags">
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
</div>
|
127
|
+
|
128
|
+
<div id="footer">
|
129
|
+
Generated on Wed Nov 29 18:34:06 2017 by
|
130
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
131
|
+
0.9.11 (ruby-2.4.2).
|
132
|
+
</div>
|
133
|
+
|
134
|
+
</div>
|
135
|
+
</body>
|
136
|
+
</html>
|
data/docs/EnvParser.html
CHANGED
@@ -113,14 +113,24 @@ different data types.</p>
|
|
113
113
|
<div class="tags">
|
114
114
|
|
115
115
|
|
116
|
-
</div>
|
116
|
+
</div><h2>Defined Under Namespace</h2>
|
117
|
+
<p class="children">
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="EnvParser/ValueNotAllowed.html" title="EnvParser::ValueNotAllowed (class)">ValueNotAllowed</a></span>
|
123
|
+
|
124
|
+
|
125
|
+
</p>
|
126
|
+
|
117
127
|
<h2>Constant Summary</h2>
|
118
128
|
<dl class="constants">
|
119
129
|
|
120
130
|
<dt id="VERSION-constant" class="">VERSION =
|
121
131
|
|
122
132
|
</dt>
|
123
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.
|
133
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.3.0</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
124
134
|
|
125
135
|
</dl>
|
126
136
|
|
@@ -265,6 +275,9 @@ source String to the requested type. Valid “as” types are:</p>
|
|
265
275
|
</li><li>
|
266
276
|
<p><code>:hash</code></p>
|
267
277
|
</li></ul>
|
278
|
+
|
279
|
+
<p>If no “as” option is given (or the “as” value given is not on the above
|
280
|
+
list), an ArgumentError exception is raised.</p>
|
268
281
|
</div>
|
269
282
|
|
270
283
|
</li>
|
@@ -277,11 +290,36 @@ source String to the requested type. Valid “as” types are:</p>
|
|
277
290
|
</span>
|
278
291
|
|
279
292
|
— <div class='inline'>
|
280
|
-
<p>Specifies the default value to return if the given “value” is either
|
281
|
-
|
282
|
-
as-is, with no type conversion or other change
|
283
|
-
unspecified, the “default” value for
|
284
|
-
the “as”
|
293
|
+
<p>Specifies the default value to return if the given “value” is either unset
|
294
|
+
(<code>nil</code>) or blank (<code>''</code>). Any “if_unset” value
|
295
|
+
given will be returned as-is, with no type conversion or other change
|
296
|
+
having been made. If unspecified, the “default” value for
|
297
|
+
<code>nil</code>/<code>''</code> input will depend on the “as”
|
298
|
+
type.</p>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
</li>
|
302
|
+
|
303
|
+
<li>
|
304
|
+
<span class="name">from_set</span>
|
305
|
+
<span class="type">(<tt>Array</tt>, <tt>Range</tt>)</span>
|
306
|
+
<span class="default">
|
307
|
+
|
308
|
+
</span>
|
309
|
+
|
310
|
+
— <div class='inline'>
|
311
|
+
<p>Gives a limited set of allowed values (after type conversion). If, after
|
312
|
+
parsing, the final value is not included in the “from_set” list/range, an
|
313
|
+
EnvParser::ValueNotAllowed exception is raised.</p>
|
314
|
+
|
315
|
+
<p>Note that if the “if_unset” option is given and the value to parse is
|
316
|
+
<code>nil</code>/<code>''</code>, the “if_unset” value will be
|
317
|
+
returned, even if it is not part of the “from_set” list/range.</p>
|
318
|
+
|
319
|
+
<p>Also note that, due to the nature of the lookup, the “from_set” option is
|
320
|
+
only available for scalar values (i.e. not arrays, hashes, or other
|
321
|
+
enumerables). An attempt to use the “from_set” option with a non-scalar
|
322
|
+
value will raise an ArgumentError exception.</p>
|
285
323
|
</div>
|
286
324
|
|
287
325
|
</li>
|
@@ -289,6 +327,19 @@ the “as” type.</p>
|
|
289
327
|
</ul>
|
290
328
|
|
291
329
|
|
330
|
+
<p class="tag_title">Raises:</p>
|
331
|
+
<ul class="raise">
|
332
|
+
|
333
|
+
<li>
|
334
|
+
|
335
|
+
|
336
|
+
<span class='type'>(<tt>ArgumentError</tt>, <tt><span class='object_link'><a href="EnvParser/ValueNotAllowed.html" title="EnvParser::ValueNotAllowed (class)">EnvParser::ValueNotAllowed</a></span></tt>)</span>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
</li>
|
341
|
+
|
342
|
+
</ul>
|
292
343
|
|
293
344
|
</div><table class="source_code">
|
294
345
|
<tr>
|
@@ -296,51 +347,51 @@ the “as” type.</p>
|
|
296
347
|
<pre class="lines">
|
297
348
|
|
298
349
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
350
|
+
55
|
351
|
+
56
|
352
|
+
57
|
353
|
+
58
|
354
|
+
59
|
355
|
+
60
|
356
|
+
61
|
357
|
+
62
|
358
|
+
63
|
359
|
+
64
|
360
|
+
65
|
361
|
+
66
|
362
|
+
67
|
363
|
+
68
|
364
|
+
69
|
365
|
+
70
|
366
|
+
71
|
367
|
+
72
|
368
|
+
73
|
369
|
+
74
|
370
|
+
75</pre>
|
320
371
|
</td>
|
321
372
|
<td>
|
322
|
-
<pre class="code"><span class="info file"># File 'lib/env_parser.rb', line
|
373
|
+
<pre class="code"><span class="info file"># File 'lib/env_parser.rb', line 55</span>
|
323
374
|
|
324
375
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
325
|
-
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
326
|
-
|
327
|
-
<span class='kw'>else</span>
|
328
|
-
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
329
|
-
<span class='kw'>end</span>
|
376
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span>
|
377
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
330
378
|
|
331
379
|
<span class='kw'>return</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:if_unset</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>&&</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='symbol'>:if_unset</span><span class='rparen'>)</span>
|
332
380
|
|
333
|
-
<span class='kw'>case</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:as</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
381
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:as</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
382
|
+
<span class='kw'>when</span> <span class='symbol'>:string</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_string'>parse_string</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
383
|
+
<span class='kw'>when</span> <span class='symbol'>:symbol</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_symbol'>parse_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
384
|
+
<span class='kw'>when</span> <span class='symbol'>:boolean</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_boolean'>parse_boolean</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
385
|
+
<span class='kw'>when</span> <span class='symbol'>:int</span><span class='comma'>,</span> <span class='symbol'>:integer</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_integer'>parse_integer</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
386
|
+
<span class='kw'>when</span> <span class='symbol'>:float</span><span class='comma'>,</span> <span class='symbol'>:decimal</span><span class='comma'>,</span> <span class='symbol'>:number</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_float'>parse_float</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
387
|
+
<span class='kw'>when</span> <span class='symbol'>:json</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_json'>parse_json</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
388
|
+
<span class='kw'>when</span> <span class='symbol'>:array</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_array'>parse_array</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
389
|
+
<span class='kw'>when</span> <span class='symbol'>:hash</span> <span class='kw'>then</span> <span class='id identifier rubyid_parse_hash'>parse_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
390
|
+
<span class='kw'>else</span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>invalid `as` parameter: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:as</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
391
|
+
<span class='kw'>end</span>
|
392
|
+
|
393
|
+
<span class='id identifier rubyid_check_for_set_inclusion'>check_for_set_inclusion</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='label'>set:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:from_set</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='symbol'>:from_set</span><span class='rparen'>)</span>
|
394
|
+
<span class='id identifier rubyid_value'>value</span>
|
344
395
|
<span class='kw'>end</span></pre>
|
345
396
|
</td>
|
346
397
|
</tr>
|
@@ -352,7 +403,7 @@ the “as” type.</p>
|
|
352
403
|
</div>
|
353
404
|
|
354
405
|
<div id="footer">
|
355
|
-
Generated on Wed Nov 29
|
406
|
+
Generated on Wed Nov 29 18:34:06 2017 by
|
356
407
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
357
408
|
0.9.11 (ruby-2.4.2).
|
358
409
|
</div>
|
data/docs/_index.html
CHANGED
@@ -88,6 +88,21 @@
|
|
88
88
|
</ul>
|
89
89
|
</ul>
|
90
90
|
|
91
|
+
|
92
|
+
<ul id="alpha_V" class="alpha">
|
93
|
+
<li class="letter">V</li>
|
94
|
+
<ul>
|
95
|
+
|
96
|
+
<li>
|
97
|
+
<span class='object_link'><a href="EnvParser/ValueNotAllowed.html" title="EnvParser::ValueNotAllowed (class)">ValueNotAllowed</a></span>
|
98
|
+
|
99
|
+
<small>(EnvParser)</small>
|
100
|
+
|
101
|
+
</li>
|
102
|
+
|
103
|
+
</ul>
|
104
|
+
</ul>
|
105
|
+
|
91
106
|
</td>
|
92
107
|
</tr>
|
93
108
|
</table>
|
@@ -97,7 +112,7 @@
|
|
97
112
|
</div>
|
98
113
|
|
99
114
|
<div id="footer">
|
100
|
-
Generated on Wed Nov 29
|
115
|
+
Generated on Wed Nov 29 18:34:06 2017 by
|
101
116
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
102
117
|
0.9.11 (ruby-2.4.2).
|
103
118
|
</div>
|
data/docs/class_list.html
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
<ul id="full_list" class="class">
|
45
45
|
<li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
|
46
|
-
<li id='object_EnvParser' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li>
|
46
|
+
<li id='object_EnvParser' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="EnvParser.html" title="EnvParser (class)">EnvParser</a></span> < Object<small class='search_info'>Top Level Namespace</small></div><ul><li id='object_EnvParser::ValueNotAllowed' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="EnvParser/ValueNotAllowed.html" title="EnvParser::ValueNotAllowed (class)">ValueNotAllowed</a></span> < StandardError<small class='search_info'>EnvParser</small></div></li></ul></li>
|
47
47
|
|
48
48
|
</ul>
|
49
49
|
</div>
|
data/docs/file.README.html
CHANGED
@@ -110,7 +110,35 @@ simple.</p>
|
|
110
110
|
|
111
111
|
<h2 id="label-28i.e.+passing+in+ENV-5B-27X-27-5D+is+equivalent+to+passing+in+-3AX-29">(i.e. passing in <code>ENV['X']</code> is equivalent to passing in <code>:X</code>)</h2>
|
112
112
|
|
113
|
-
<p>## timeout_ms = EnvParser.parse :TIMEOUT_MS, as: :integer
|
113
|
+
<p>## timeout_ms = EnvParser.parse :TIMEOUT_MS, as: :integer</p>
|
114
|
+
|
115
|
+
<h2 id="label-If+the+ENV+variable+you+want+is+unset+-28nil-29+or+blank+-28-27-27-29-2C">If the ENV variable you want is unset (<code>nil</code>) or blank (<code>''</code>),</h2>
|
116
|
+
|
117
|
+
<h2 id="label-the+return+value+is+a+sensible+default+for+the+given+-22as-22+type.">the return value is a sensible default for the given “as” type.</h2>
|
118
|
+
|
119
|
+
<h2 id="label-Sometimes+you+want+a+non-trivial+default+-28not+just+0-2C+-27-27-2C+etc-29-2C+however.">Sometimes you want a non-trivial default (not just 0, '', etc), however.</h2>
|
120
|
+
|
121
|
+
<p>## EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer ## => 0
|
122
|
+
EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer, if_unset: 250 ## =>
|
123
|
+
250</p>
|
124
|
+
|
125
|
+
<h2 id="label-Note+that+-22if_unset-22+values+are+used+as-is-2C+with+no+type+conversion.">Note that “if_unset” values are used as-is, with no type conversion.</h2>
|
126
|
+
|
127
|
+
<p>## EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer, if_unset:
|
128
|
+
'oof!' ## => 'oof!'</p>
|
129
|
+
|
130
|
+
<h2 id="label-You+can+also+restrict+the+set+of+allowed+values.">You can also restrict the set of allowed values.</h2>
|
131
|
+
|
132
|
+
<h2 id="label-28Sometimes+setting+the+type+alone+is+a+bit+too+open-ended.-29">(Sometimes setting the type alone is a bit too open-ended.)</h2>
|
133
|
+
|
134
|
+
<p>## EnvParser.parse :API_TO_USE, as: :symbol, from_set: %i[internal
|
135
|
+
external] EnvParser.parse :SOME_CUSTOM_NETWORK_PORT, as: :integer,
|
136
|
+
from_set: (1..65535), if_unset: 80</p>
|
137
|
+
|
138
|
+
<h2 id="label-And+if+the+value+is+not+allowed...">And if the value is not allowed…</h2>
|
139
|
+
|
140
|
+
<p>## EnvParser.parse :SOME_NEGATIVE_NUMBER, as: :integer, from_set: (1..5) ##
|
141
|
+
=> raises EnvParser::ValueNotAllowed “`</p>
|
114
142
|
<hr>
|
115
143
|
|
116
144
|
<p>The named <code>:as</code> value is required. Allowed values are:</p>
|
@@ -132,16 +160,14 @@ the repo docs</a> for the full EnvParser documentation.</p>
|
|
132
160
|
<h2 id="label-Feature+Roadmap+-2F+Future+Development">Feature Roadmap / Future Development</h2>
|
133
161
|
|
134
162
|
<p>Additional features/options coming in the future: - An
|
135
|
-
<code
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
<code
|
141
|
-
<code
|
142
|
-
<code
|
143
|
-
onto <code>ENV</code> itself (not all hashes!). Because <code>ENV.parse
|
144
|
-
...</code> reads better than <code>EnvParser.parse ...</code>. - … ?</p>
|
163
|
+
<code>EnvParser.load</code> method that will not only parse the given
|
164
|
+
value, but will set a constant, easily converting environment variables
|
165
|
+
into constants in your code. - An <code>EnvParser.load_all</code> method to
|
166
|
+
shortcut multiple <code>.load</code> calls. - A means to
|
167
|
+
<strong>optionally</strong> bind <code>#parse</code>, <code>#load</code>,
|
168
|
+
and <code>#load_all</code> methods onto <code>ENV</code> itself (not all
|
169
|
+
hashes!). Because <code>ENV.parse ...</code> reads better than
|
170
|
+
<code>EnvParser.parse ...</code>. - … ?</p>
|
145
171
|
|
146
172
|
<h2 id="label-Contribution+-2F+Development">Contribution / Development</h2>
|
147
173
|
|
@@ -172,7 +198,7 @@ href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
|
172
198
|
</div></div>
|
173
199
|
|
174
200
|
<div id="footer">
|
175
|
-
Generated on Wed Nov 29
|
201
|
+
Generated on Wed Nov 29 18:34:06 2017 by
|
176
202
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
177
203
|
0.9.11 (ruby-2.4.2).
|
178
204
|
</div>
|
data/docs/index.html
CHANGED
@@ -110,7 +110,35 @@ simple.</p>
|
|
110
110
|
|
111
111
|
<h2 id="label-28i.e.+passing+in+ENV-5B-27X-27-5D+is+equivalent+to+passing+in+-3AX-29">(i.e. passing in <code>ENV['X']</code> is equivalent to passing in <code>:X</code>)</h2>
|
112
112
|
|
113
|
-
<p>## timeout_ms = EnvParser.parse :TIMEOUT_MS, as: :integer
|
113
|
+
<p>## timeout_ms = EnvParser.parse :TIMEOUT_MS, as: :integer</p>
|
114
|
+
|
115
|
+
<h2 id="label-If+the+ENV+variable+you+want+is+unset+-28nil-29+or+blank+-28-27-27-29-2C">If the ENV variable you want is unset (<code>nil</code>) or blank (<code>''</code>),</h2>
|
116
|
+
|
117
|
+
<h2 id="label-the+return+value+is+a+sensible+default+for+the+given+-22as-22+type.">the return value is a sensible default for the given “as” type.</h2>
|
118
|
+
|
119
|
+
<h2 id="label-Sometimes+you+want+a+non-trivial+default+-28not+just+0-2C+-27-27-2C+etc-29-2C+however.">Sometimes you want a non-trivial default (not just 0, '', etc), however.</h2>
|
120
|
+
|
121
|
+
<p>## EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer ## => 0
|
122
|
+
EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer, if_unset: 250 ## =>
|
123
|
+
250</p>
|
124
|
+
|
125
|
+
<h2 id="label-Note+that+-22if_unset-22+values+are+used+as-is-2C+with+no+type+conversion.">Note that “if_unset” values are used as-is, with no type conversion.</h2>
|
126
|
+
|
127
|
+
<p>## EnvParser.parse :MISSING_ENV_VARIABLE, as: :integer, if_unset:
|
128
|
+
'oof!' ## => 'oof!'</p>
|
129
|
+
|
130
|
+
<h2 id="label-You+can+also+restrict+the+set+of+allowed+values.">You can also restrict the set of allowed values.</h2>
|
131
|
+
|
132
|
+
<h2 id="label-28Sometimes+setting+the+type+alone+is+a+bit+too+open-ended.-29">(Sometimes setting the type alone is a bit too open-ended.)</h2>
|
133
|
+
|
134
|
+
<p>## EnvParser.parse :API_TO_USE, as: :symbol, from_set: %i[internal
|
135
|
+
external] EnvParser.parse :SOME_CUSTOM_NETWORK_PORT, as: :integer,
|
136
|
+
from_set: (1..65535), if_unset: 80</p>
|
137
|
+
|
138
|
+
<h2 id="label-And+if+the+value+is+not+allowed...">And if the value is not allowed…</h2>
|
139
|
+
|
140
|
+
<p>## EnvParser.parse :SOME_NEGATIVE_NUMBER, as: :integer, from_set: (1..5) ##
|
141
|
+
=> raises EnvParser::ValueNotAllowed “`</p>
|
114
142
|
<hr>
|
115
143
|
|
116
144
|
<p>The named <code>:as</code> value is required. Allowed values are:</p>
|
@@ -132,16 +160,14 @@ the repo docs</a> for the full EnvParser documentation.</p>
|
|
132
160
|
<h2 id="label-Feature+Roadmap+-2F+Future+Development">Feature Roadmap / Future Development</h2>
|
133
161
|
|
134
162
|
<p>Additional features/options coming in the future: - An
|
135
|
-
<code
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
<code
|
141
|
-
<code
|
142
|
-
<code
|
143
|
-
onto <code>ENV</code> itself (not all hashes!). Because <code>ENV.parse
|
144
|
-
...</code> reads better than <code>EnvParser.parse ...</code>. - … ?</p>
|
163
|
+
<code>EnvParser.load</code> method that will not only parse the given
|
164
|
+
value, but will set a constant, easily converting environment variables
|
165
|
+
into constants in your code. - An <code>EnvParser.load_all</code> method to
|
166
|
+
shortcut multiple <code>.load</code> calls. - A means to
|
167
|
+
<strong>optionally</strong> bind <code>#parse</code>, <code>#load</code>,
|
168
|
+
and <code>#load_all</code> methods onto <code>ENV</code> itself (not all
|
169
|
+
hashes!). Because <code>ENV.parse ...</code> reads better than
|
170
|
+
<code>EnvParser.parse ...</code>. - … ?</p>
|
145
171
|
|
146
172
|
<h2 id="label-Contribution+-2F+Development">Contribution / Development</h2>
|
147
173
|
|
@@ -172,7 +198,7 @@ href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
|
172
198
|
</div></div>
|
173
199
|
|
174
200
|
<div id="footer">
|
175
|
-
Generated on Wed Nov 29
|
201
|
+
Generated on Wed Nov 29 18:34:06 2017 by
|
176
202
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
177
203
|
0.9.11 (ruby-2.4.2).
|
178
204
|
</div>
|
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on Wed Nov 29
|
103
|
+
Generated on Wed Nov 29 18:34:06 2017 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.9.11 (ruby-2.4.2).
|
106
106
|
</div>
|
data/env_parser.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
26
27
|
|
27
28
|
spec.add_dependency 'activesupport', '>= 5.0.0'
|
28
29
|
end
|
data/lib/env_parser/version.rb
CHANGED
data/lib/env_parser.rb
CHANGED
@@ -4,6 +4,11 @@ require 'active_support/all'
|
|
4
4
|
## The EnvParser class simplifies parsing of environment variables as different data types.
|
5
5
|
##
|
6
6
|
class EnvParser
|
7
|
+
## Exception class used to indicate parsed values not allowed per a "from_set" option.
|
8
|
+
##
|
9
|
+
class ValueNotAllowed < StandardError
|
10
|
+
end
|
11
|
+
|
7
12
|
class << self
|
8
13
|
## Interprets the given value as the specified type.
|
9
14
|
##
|
@@ -24,32 +29,49 @@ class EnvParser
|
|
24
29
|
## - `:array`
|
25
30
|
## - `:hash`
|
26
31
|
##
|
32
|
+
## If no "as" option is given (or the "as" value given is not on the above list), an
|
33
|
+
## ArgumentError exception is raised.
|
34
|
+
##
|
27
35
|
## @option options if_unset
|
28
|
-
## Specifies the default value to return if the given "value" is either nil or
|
29
|
-
## (''). Any "if_unset" value given will be returned as-is, with no type conversion or other
|
30
|
-
## change having been made. If unspecified, the "default" value for nil
|
31
|
-
## on the "as" type.
|
36
|
+
## Specifies the default value to return if the given "value" is either unset (`nil`) or blank
|
37
|
+
## (`''`). Any "if_unset" value given will be returned as-is, with no type conversion or other
|
38
|
+
## change having been made. If unspecified, the "default" value for `nil`/`''` input will
|
39
|
+
## depend on the "as" type.
|
40
|
+
##
|
41
|
+
## @option options from_set [Array, Range]
|
42
|
+
## Gives a limited set of allowed values (after type conversion). If, after parsing, the final
|
43
|
+
## value is not included in the "from_set" list/range, an EnvParser::ValueNotAllowed exception
|
44
|
+
## is raised.
|
45
|
+
##
|
46
|
+
## Note that if the "if_unset" option is given and the value to parse is `nil`/`''`, the
|
47
|
+
## "if_unset" value will be returned, even if it is not part of the "from_set" list/range.
|
48
|
+
##
|
49
|
+
## Also note that, due to the nature of the lookup, the "from_set" option is only available
|
50
|
+
## for scalar values (i.e. not arrays, hashes, or other enumerables). An attempt to use the
|
51
|
+
## "from_set" option with a non-scalar value will raise an ArgumentError exception.
|
52
|
+
##
|
53
|
+
## @raise [ArgumentError, EnvParser::ValueNotAllowed]
|
32
54
|
##
|
33
55
|
def parse(value, options = {})
|
34
|
-
value = if value.is_a? Symbol
|
35
|
-
|
36
|
-
else
|
37
|
-
value.to_s
|
38
|
-
end
|
56
|
+
value = ENV[value.to_s] if value.is_a? Symbol
|
57
|
+
value = value.to_s
|
39
58
|
|
40
59
|
return options[:if_unset] if value.blank? && options.key?(:if_unset)
|
41
60
|
|
42
|
-
case options[:as].to_sym
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
61
|
+
value = case options[:as].to_sym
|
62
|
+
when :string then parse_string(value)
|
63
|
+
when :symbol then parse_symbol(value)
|
64
|
+
when :boolean then parse_boolean(value)
|
65
|
+
when :int, :integer then parse_integer(value)
|
66
|
+
when :float, :decimal, :number then parse_float(value)
|
67
|
+
when :json then parse_json(value)
|
68
|
+
when :array then parse_array(value)
|
69
|
+
when :hash then parse_hash(value)
|
70
|
+
else raise ArgumentError, "invalid `as` parameter: #{options[:as].inspect}"
|
71
|
+
end
|
72
|
+
|
73
|
+
check_for_set_inclusion(value, set: options[:from_set]) if options.key?(:from_set)
|
74
|
+
value
|
53
75
|
end
|
54
76
|
|
55
77
|
private
|
@@ -103,5 +125,17 @@ class EnvParser
|
|
103
125
|
|
104
126
|
decoded_json
|
105
127
|
end
|
128
|
+
|
129
|
+
def check_for_set_inclusion(value, set: nil)
|
130
|
+
if value.respond_to?(:each)
|
131
|
+
raise ArgumentError, "`from_set` option is not compatible with #{value.class} values"
|
132
|
+
end
|
133
|
+
|
134
|
+
unless set.is_a?(Array) || set.is_a?(Range)
|
135
|
+
raise ArgumentError, "invalid `from_set` parameter type: #{set.class}"
|
136
|
+
end
|
137
|
+
|
138
|
+
raise ValueNotAllowed, 'parsed value not in allowed list/range' unless set.include?(value)
|
139
|
+
end
|
106
140
|
end
|
107
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: env_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nestor Custodio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: activesupport
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,13 +87,13 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
90
|
+
- ".circleci/config.yml"
|
76
91
|
- ".gitignore"
|
77
92
|
- ".rspec"
|
78
93
|
- ".rubocop.yml"
|
79
94
|
- ".ruby-version"
|
80
95
|
- ".travis.yml"
|
81
96
|
- ".yardopts"
|
82
|
-
- CODE_OF_CONDUCT.md
|
83
97
|
- Gemfile
|
84
98
|
- Gemfile.lock
|
85
99
|
- LICENSE.txt
|
@@ -88,6 +102,7 @@ files:
|
|
88
102
|
- bin/console
|
89
103
|
- bin/setup
|
90
104
|
- docs/EnvParser.html
|
105
|
+
- docs/EnvParser/ValueNotAllowed.html
|
91
106
|
- docs/_index.html
|
92
107
|
- docs/class_list.html
|
93
108
|
- docs/css/common.css
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at sakimorix@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|