environment_helpers 1.4.0 → 1.6.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/.bundle/config +2 -0
- data/.github/workflows/quality.yml +6 -8
- data/.github/workflows/rspec.yml +6 -13
- data/.gitignore +0 -1
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +137 -0
- data/Gemfile.ruby2.7 +3 -0
- data/Gemfile.ruby2.7.lock +128 -0
- data/Gemfile.ruby3.0 +1 -0
- data/Gemfile.ruby3.0.lock +157 -0
- data/Gemfile.ruby3.1 +1 -0
- data/Gemfile.ruby3.1.lock +128 -0
- data/Gemfile.ruby3.2 +1 -0
- data/Gemfile.ruby3.2.lock +169 -0
- data/Gemfile.ruby3.3 +1 -0
- data/Gemfile.ruby3.3.lock +1 -0
- data/README.md +15 -0
- data/Steepfile +9 -0
- data/environment_helpers.gemspec +6 -6
- data/lib/environment_helpers/boolean_helpers.rb +16 -4
- data/lib/environment_helpers/enumerable_helpers.rb +13 -12
- data/lib/environment_helpers/numeric_helpers.rb +13 -1
- data/lib/environment_helpers/range_helpers.rb +1 -1
- data/lib/environment_helpers/string_helpers.rb +2 -1
- data/lib/environment_helpers/version.rb +1 -1
- data/lib/environment_helpers.rb +8 -8
- metadata +30 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7210a6ad0407c6441884d1c6d04d5052ee8ab2e77c7c5e541742b8dd0001ad42
|
4
|
+
data.tar.gz: 23f1a86a5e58e51463e4dbda465d15e14ee60b4891666c2e6d335a3d6110f177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de1d1c87a18b0f81bb3cb4e91a96aa6d7ca8fb2cf68e626efbcf3abd75a6ceddcb3421409158ce2f8b91b00985acd3d22a4fd0b6b524967e77ef8f517029826
|
7
|
+
data.tar.gz: 3323cc62c83b0950d595f12885ce6d005730e93dce49f3e17eea7b63b3b2dfd854e605e278ac31a65f136938a9565bce1495c14f03d31586657bbc5bbbf1267b
|
data/.bundle/config
ADDED
@@ -6,8 +6,10 @@ permissions: write-all
|
|
6
6
|
jobs:
|
7
7
|
check:
|
8
8
|
runs-on: ubuntu-latest
|
9
|
+
env:
|
10
|
+
BUNDLE_GEMFILE: Gemfile.ruby3.3
|
9
11
|
steps:
|
10
|
-
- uses: actions/checkout@
|
12
|
+
- uses: actions/checkout@v4
|
11
13
|
with:
|
12
14
|
fetch-depth: 0
|
13
15
|
|
@@ -18,12 +20,8 @@ jobs:
|
|
18
20
|
- name: Set up Ruby
|
19
21
|
uses: ruby/setup-ruby@v1
|
20
22
|
with:
|
21
|
-
ruby-version: 3.
|
22
|
-
|
23
|
-
- name: Install gems
|
24
|
-
run: bundle install --jobs 4 --retry 3
|
23
|
+
ruby-version: 3.3
|
24
|
+
bundler-cache: true
|
25
25
|
|
26
26
|
- name: Run QuietQuality
|
27
|
-
run:
|
28
|
-
gem install quiet_quality standard rubocop
|
29
|
-
qq -C .quiet_quality.ci-cd.yml
|
27
|
+
run: bundle exec qq -C .quiet_quality.ci-cd.yml
|
data/.github/workflows/rspec.yml
CHANGED
@@ -8,26 +8,19 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
|
-
ruby-version: ['2.7', '3.0', '3.1', '3.2', '
|
11
|
+
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3']
|
12
|
+
env:
|
13
|
+
SIMPLECOV: "enabled"
|
14
|
+
BUNDLE_GEMFILE: Gemfile.ruby${{ matrix.ruby-version }}
|
12
15
|
|
13
16
|
steps:
|
14
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v4
|
15
18
|
|
16
19
|
- name: Set up ruby
|
17
20
|
uses: ruby/setup-ruby@v1
|
18
21
|
with:
|
19
22
|
ruby-version: ${{ matrix.ruby-version }}
|
20
|
-
|
21
|
-
- name: Cache gems
|
22
|
-
uses: actions/cache@v3
|
23
|
-
with:
|
24
|
-
path: vendor/bundle
|
25
|
-
key: ${{ runner.os }}-rspec-${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.lock') }}
|
26
|
-
restore-keys:
|
27
|
-
${{ runner.os }}-rspec-${{ matrix.ruby-version }}-
|
28
|
-
|
29
|
-
- name: Install gems
|
30
|
-
run: bundle install --jobs 4 --retry 3
|
23
|
+
bundler-cache: true
|
31
24
|
|
32
25
|
- name: Run RSpec
|
33
26
|
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Release 1.6.0
|
4
|
+
|
5
|
+
* Remove steep and the rbs types (#41)
|
6
|
+
* Check the default's type in StringHelpers, preventing
|
7
|
+
`ENV.string("FOO", default: 5)` (#38 fixes #33)
|
8
|
+
* Handle non-numeric values in `ENV.integer` in a more sensible way (#39 fixes #34)
|
9
|
+
* Split Gemfile out per supported ruby, and commit all of the resulting lockfiles.
|
10
|
+
|
11
|
+
## Release 1.5.0
|
12
|
+
|
13
|
+
* Add rbs/steep, and enforce types in CI (.rbs file is exported as part
|
14
|
+
of the gem) (#28, resolves #21)
|
15
|
+
* Support env-based customization of the truthy/falsey strings used by
|
16
|
+
`ENV.boolean` (#29, resolves #27)
|
17
|
+
* Update github workflows to use checkout@v4 (which should have no real
|
18
|
+
impact on us, aside from staying current). (#30)
|
19
|
+
* Update README to explain `ENV.array`
|
20
|
+
|
3
21
|
## Release 1.4.0
|
4
22
|
|
5
23
|
* Drop support for ruby 2.6
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
environment_helpers (1.6.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.8.7)
|
10
|
+
public_suffix (>= 2.0.2, < 7.0)
|
11
|
+
ast (2.4.3)
|
12
|
+
chef-utils (18.7.10)
|
13
|
+
concurrent-ruby
|
14
|
+
coderay (1.1.3)
|
15
|
+
concurrent-ruby (1.3.5)
|
16
|
+
diff-lcs (1.6.2)
|
17
|
+
docile (1.4.1)
|
18
|
+
git (1.19.1)
|
19
|
+
addressable (~> 2.8)
|
20
|
+
rchardet (~> 1.8)
|
21
|
+
git_diff_parser (4.0.0)
|
22
|
+
json (2.12.2)
|
23
|
+
kramdown (2.5.1)
|
24
|
+
rexml (>= 3.3.9)
|
25
|
+
kramdown-parser-gfm (1.1.0)
|
26
|
+
kramdown (~> 2.0)
|
27
|
+
language_server-protocol (3.17.0.5)
|
28
|
+
lint_roller (1.1.0)
|
29
|
+
mdl (0.13.0)
|
30
|
+
kramdown (~> 2.3)
|
31
|
+
kramdown-parser-gfm (~> 1.1)
|
32
|
+
mixlib-cli (~> 2.1, >= 2.1.1)
|
33
|
+
mixlib-config (>= 2.2.1, < 4)
|
34
|
+
mixlib-shellout
|
35
|
+
method_source (1.1.0)
|
36
|
+
mixlib-cli (2.1.8)
|
37
|
+
mixlib-config (3.0.27)
|
38
|
+
tomlrb
|
39
|
+
mixlib-shellout (3.3.9)
|
40
|
+
chef-utils
|
41
|
+
parallel (1.27.0)
|
42
|
+
parser (3.3.8.0)
|
43
|
+
ast (~> 2.4.1)
|
44
|
+
racc
|
45
|
+
prism (1.4.0)
|
46
|
+
pry (0.15.2)
|
47
|
+
coderay (~> 1.1)
|
48
|
+
method_source (~> 1.0)
|
49
|
+
public_suffix (6.0.2)
|
50
|
+
quiet_quality (1.5.2)
|
51
|
+
git (>= 1.18)
|
52
|
+
git_diff_parser (~> 4)
|
53
|
+
racc (1.8.1)
|
54
|
+
rainbow (3.1.1)
|
55
|
+
rchardet (1.9.0)
|
56
|
+
regexp_parser (2.10.0)
|
57
|
+
rexml (3.4.1)
|
58
|
+
rspec (3.13.1)
|
59
|
+
rspec-core (~> 3.13.0)
|
60
|
+
rspec-expectations (~> 3.13.0)
|
61
|
+
rspec-mocks (~> 3.13.0)
|
62
|
+
rspec-core (3.13.5)
|
63
|
+
rspec-support (~> 3.13.0)
|
64
|
+
rspec-cover_it (0.1.0)
|
65
|
+
rspec (~> 3.10)
|
66
|
+
rspec-expectations (3.13.5)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.13.0)
|
69
|
+
rspec-mocks (3.13.5)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.13.0)
|
72
|
+
rspec-support (3.13.4)
|
73
|
+
rubocop (1.64.1)
|
74
|
+
json (~> 2.3)
|
75
|
+
language_server-protocol (>= 3.17.0)
|
76
|
+
parallel (~> 1.10)
|
77
|
+
parser (>= 3.3.0.2)
|
78
|
+
rainbow (>= 2.2.2, < 4.0)
|
79
|
+
regexp_parser (>= 1.8, < 3.0)
|
80
|
+
rexml (>= 3.2.5, < 4.0)
|
81
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
82
|
+
ruby-progressbar (~> 1.7)
|
83
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
84
|
+
rubocop-ast (1.45.1)
|
85
|
+
parser (>= 3.3.7.2)
|
86
|
+
prism (~> 1.4)
|
87
|
+
rubocop-performance (1.23.1)
|
88
|
+
rubocop (>= 1.48.1, < 2.0)
|
89
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
90
|
+
ruby-progressbar (1.13.0)
|
91
|
+
simplecov (0.22.0)
|
92
|
+
docile (~> 1.1)
|
93
|
+
simplecov-html (~> 0.11)
|
94
|
+
simplecov_json_formatter (~> 0.1)
|
95
|
+
simplecov-html (0.13.1)
|
96
|
+
simplecov_json_formatter (0.1.4)
|
97
|
+
standard (1.37.0)
|
98
|
+
language_server-protocol (~> 3.17.0.2)
|
99
|
+
lint_roller (~> 1.0)
|
100
|
+
rubocop (~> 1.64.0)
|
101
|
+
standard-custom (~> 1.0.0)
|
102
|
+
standard-performance (~> 1.4)
|
103
|
+
standard-custom (1.0.2)
|
104
|
+
lint_roller (~> 1.0)
|
105
|
+
rubocop (~> 1.50)
|
106
|
+
standard-performance (1.6.0)
|
107
|
+
lint_roller (~> 1.1)
|
108
|
+
rubocop-performance (~> 1.23.0)
|
109
|
+
tomlrb (2.0.3)
|
110
|
+
unicode-display_width (2.6.0)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
aarch64-linux-gnu
|
114
|
+
aarch64-linux-musl
|
115
|
+
arm-linux-gnu
|
116
|
+
arm-linux-musl
|
117
|
+
arm64-darwin
|
118
|
+
ruby
|
119
|
+
x86-linux-gnu
|
120
|
+
x86-linux-musl
|
121
|
+
x86_64-darwin
|
122
|
+
x86_64-linux-gnu
|
123
|
+
x86_64-linux-musl
|
124
|
+
|
125
|
+
DEPENDENCIES
|
126
|
+
environment_helpers!
|
127
|
+
mdl (~> 0.13)
|
128
|
+
pry (~> 0.15)
|
129
|
+
quiet_quality (~> 1.5)
|
130
|
+
rspec (~> 3.13)
|
131
|
+
rspec-cover_it (~> 0.1.0)
|
132
|
+
rubocop (~> 1.63)
|
133
|
+
simplecov (~> 0.22.0)
|
134
|
+
standard (= 1.37.0)
|
135
|
+
|
136
|
+
BUNDLED WITH
|
137
|
+
2.4.22
|
data/Gemfile.ruby2.7
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
environment_helpers (1.6.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.8.7)
|
10
|
+
public_suffix (>= 2.0.2, < 7.0)
|
11
|
+
ast (2.4.3)
|
12
|
+
chef-utils (18.7.10)
|
13
|
+
concurrent-ruby
|
14
|
+
coderay (1.1.3)
|
15
|
+
concurrent-ruby (1.3.5)
|
16
|
+
diff-lcs (1.6.2)
|
17
|
+
docile (1.4.1)
|
18
|
+
git (1.19.1)
|
19
|
+
addressable (~> 2.8)
|
20
|
+
rchardet (~> 1.8)
|
21
|
+
git_diff_parser (4.0.0)
|
22
|
+
json (2.12.2)
|
23
|
+
kramdown (2.5.1)
|
24
|
+
rexml (>= 3.3.9)
|
25
|
+
kramdown-parser-gfm (1.1.0)
|
26
|
+
kramdown (~> 2.0)
|
27
|
+
language_server-protocol (3.17.0.5)
|
28
|
+
lint_roller (1.1.0)
|
29
|
+
mdl (0.13.0)
|
30
|
+
kramdown (~> 2.3)
|
31
|
+
kramdown-parser-gfm (~> 1.1)
|
32
|
+
mixlib-cli (~> 2.1, >= 2.1.1)
|
33
|
+
mixlib-config (>= 2.2.1, < 4)
|
34
|
+
mixlib-shellout
|
35
|
+
method_source (1.1.0)
|
36
|
+
mixlib-cli (2.1.8)
|
37
|
+
mixlib-config (3.0.27)
|
38
|
+
tomlrb
|
39
|
+
mixlib-shellout (3.3.8)
|
40
|
+
chef-utils
|
41
|
+
parallel (1.27.0)
|
42
|
+
parser (3.3.8.0)
|
43
|
+
ast (~> 2.4.1)
|
44
|
+
racc
|
45
|
+
prism (1.4.0)
|
46
|
+
pry (0.15.2)
|
47
|
+
coderay (~> 1.1)
|
48
|
+
method_source (~> 1.0)
|
49
|
+
public_suffix (5.1.1)
|
50
|
+
quiet_quality (1.5.2)
|
51
|
+
git (>= 1.18)
|
52
|
+
git_diff_parser (~> 4)
|
53
|
+
racc (1.8.1)
|
54
|
+
rainbow (3.1.1)
|
55
|
+
rchardet (1.8.0)
|
56
|
+
regexp_parser (2.10.0)
|
57
|
+
rexml (3.4.1)
|
58
|
+
rspec (3.13.1)
|
59
|
+
rspec-core (~> 3.13.0)
|
60
|
+
rspec-expectations (~> 3.13.0)
|
61
|
+
rspec-mocks (~> 3.13.0)
|
62
|
+
rspec-core (3.13.5)
|
63
|
+
rspec-support (~> 3.13.0)
|
64
|
+
rspec-cover_it (0.1.0)
|
65
|
+
rspec (~> 3.10)
|
66
|
+
rspec-expectations (3.13.5)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.13.0)
|
69
|
+
rspec-mocks (3.13.5)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.13.0)
|
72
|
+
rspec-support (3.13.4)
|
73
|
+
rubocop (1.64.1)
|
74
|
+
json (~> 2.3)
|
75
|
+
language_server-protocol (>= 3.17.0)
|
76
|
+
parallel (~> 1.10)
|
77
|
+
parser (>= 3.3.0.2)
|
78
|
+
rainbow (>= 2.2.2, < 4.0)
|
79
|
+
regexp_parser (>= 1.8, < 3.0)
|
80
|
+
rexml (>= 3.2.5, < 4.0)
|
81
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
82
|
+
ruby-progressbar (~> 1.7)
|
83
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
84
|
+
rubocop-ast (1.45.1)
|
85
|
+
parser (>= 3.3.7.2)
|
86
|
+
prism (~> 1.4)
|
87
|
+
rubocop-performance (1.21.1)
|
88
|
+
rubocop (>= 1.48.1, < 2.0)
|
89
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
90
|
+
ruby-progressbar (1.13.0)
|
91
|
+
simplecov (0.22.0)
|
92
|
+
docile (~> 1.1)
|
93
|
+
simplecov-html (~> 0.11)
|
94
|
+
simplecov_json_formatter (~> 0.1)
|
95
|
+
simplecov-html (0.13.1)
|
96
|
+
simplecov_json_formatter (0.1.4)
|
97
|
+
standard (1.37.0)
|
98
|
+
language_server-protocol (~> 3.17.0.2)
|
99
|
+
lint_roller (~> 1.0)
|
100
|
+
rubocop (~> 1.64.0)
|
101
|
+
standard-custom (~> 1.0.0)
|
102
|
+
standard-performance (~> 1.4)
|
103
|
+
standard-custom (1.0.2)
|
104
|
+
lint_roller (~> 1.0)
|
105
|
+
rubocop (~> 1.50)
|
106
|
+
standard-performance (1.4.0)
|
107
|
+
lint_roller (~> 1.1)
|
108
|
+
rubocop-performance (~> 1.21.0)
|
109
|
+
tomlrb (2.0.3)
|
110
|
+
unicode-display_width (2.6.0)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
arm64-darwin-23
|
114
|
+
x86_64-linux
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
environment_helpers!
|
118
|
+
mdl (~> 0.13)
|
119
|
+
pry (~> 0.15)
|
120
|
+
quiet_quality (~> 1.5)
|
121
|
+
rspec (~> 3.13)
|
122
|
+
rspec-cover_it (~> 0.1.0)
|
123
|
+
rubocop (~> 1.63)
|
124
|
+
simplecov (~> 0.22.0)
|
125
|
+
standard (= 1.37.0)
|
126
|
+
|
127
|
+
BUNDLED WITH
|
128
|
+
2.4.22
|
data/Gemfile.ruby3.0
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile
|
@@ -0,0 +1,157 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
environment_helpers (1.6.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (7.1.5.1)
|
10
|
+
base64
|
11
|
+
benchmark (>= 0.3)
|
12
|
+
bigdecimal
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
connection_pool (>= 2.2.5)
|
15
|
+
drb
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
logger (>= 1.4.2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
mutex_m
|
20
|
+
securerandom (>= 0.3)
|
21
|
+
tzinfo (~> 2.0)
|
22
|
+
addressable (2.8.7)
|
23
|
+
public_suffix (>= 2.0.2, < 7.0)
|
24
|
+
ast (2.4.3)
|
25
|
+
base64 (0.3.0)
|
26
|
+
benchmark (0.4.1)
|
27
|
+
bigdecimal (3.2.2)
|
28
|
+
chef-utils (18.7.10)
|
29
|
+
concurrent-ruby
|
30
|
+
coderay (1.1.3)
|
31
|
+
concurrent-ruby (1.3.5)
|
32
|
+
connection_pool (2.5.3)
|
33
|
+
diff-lcs (1.6.2)
|
34
|
+
docile (1.4.1)
|
35
|
+
drb (2.2.3)
|
36
|
+
git (2.3.3)
|
37
|
+
activesupport (>= 5.0)
|
38
|
+
addressable (~> 2.8)
|
39
|
+
process_executer (~> 1.1)
|
40
|
+
rchardet (~> 1.8)
|
41
|
+
git_diff_parser (4.0.0)
|
42
|
+
i18n (1.14.7)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
json (2.12.2)
|
45
|
+
kramdown (2.5.1)
|
46
|
+
rexml (>= 3.3.9)
|
47
|
+
kramdown-parser-gfm (1.1.0)
|
48
|
+
kramdown (~> 2.0)
|
49
|
+
language_server-protocol (3.17.0.5)
|
50
|
+
lint_roller (1.1.0)
|
51
|
+
logger (1.7.0)
|
52
|
+
mdl (0.13.0)
|
53
|
+
kramdown (~> 2.3)
|
54
|
+
kramdown-parser-gfm (~> 1.1)
|
55
|
+
mixlib-cli (~> 2.1, >= 2.1.1)
|
56
|
+
mixlib-config (>= 2.2.1, < 4)
|
57
|
+
mixlib-shellout
|
58
|
+
method_source (1.1.0)
|
59
|
+
minitest (5.25.5)
|
60
|
+
mixlib-cli (2.1.8)
|
61
|
+
mixlib-config (3.0.27)
|
62
|
+
tomlrb
|
63
|
+
mixlib-shellout (3.3.9)
|
64
|
+
chef-utils
|
65
|
+
mutex_m (0.3.0)
|
66
|
+
parallel (1.27.0)
|
67
|
+
parser (3.3.8.0)
|
68
|
+
ast (~> 2.4.1)
|
69
|
+
racc
|
70
|
+
prism (1.4.0)
|
71
|
+
process_executer (1.1.2)
|
72
|
+
pry (0.15.2)
|
73
|
+
coderay (~> 1.1)
|
74
|
+
method_source (~> 1.0)
|
75
|
+
public_suffix (6.0.2)
|
76
|
+
quiet_quality (1.5.2)
|
77
|
+
git (>= 1.18)
|
78
|
+
git_diff_parser (~> 4)
|
79
|
+
racc (1.8.1)
|
80
|
+
rainbow (3.1.1)
|
81
|
+
rchardet (1.9.0)
|
82
|
+
regexp_parser (2.10.0)
|
83
|
+
rexml (3.4.1)
|
84
|
+
rspec (3.13.1)
|
85
|
+
rspec-core (~> 3.13.0)
|
86
|
+
rspec-expectations (~> 3.13.0)
|
87
|
+
rspec-mocks (~> 3.13.0)
|
88
|
+
rspec-core (3.13.5)
|
89
|
+
rspec-support (~> 3.13.0)
|
90
|
+
rspec-cover_it (0.1.0)
|
91
|
+
rspec (~> 3.10)
|
92
|
+
rspec-expectations (3.13.5)
|
93
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
94
|
+
rspec-support (~> 3.13.0)
|
95
|
+
rspec-mocks (3.13.5)
|
96
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
+
rspec-support (~> 3.13.0)
|
98
|
+
rspec-support (3.13.4)
|
99
|
+
rubocop (1.64.1)
|
100
|
+
json (~> 2.3)
|
101
|
+
language_server-protocol (>= 3.17.0)
|
102
|
+
parallel (~> 1.10)
|
103
|
+
parser (>= 3.3.0.2)
|
104
|
+
rainbow (>= 2.2.2, < 4.0)
|
105
|
+
regexp_parser (>= 1.8, < 3.0)
|
106
|
+
rexml (>= 3.2.5, < 4.0)
|
107
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
108
|
+
ruby-progressbar (~> 1.7)
|
109
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
110
|
+
rubocop-ast (1.45.1)
|
111
|
+
parser (>= 3.3.7.2)
|
112
|
+
prism (~> 1.4)
|
113
|
+
rubocop-performance (1.23.1)
|
114
|
+
rubocop (>= 1.48.1, < 2.0)
|
115
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
116
|
+
ruby-progressbar (1.13.0)
|
117
|
+
securerandom (0.3.2)
|
118
|
+
simplecov (0.22.0)
|
119
|
+
docile (~> 1.1)
|
120
|
+
simplecov-html (~> 0.11)
|
121
|
+
simplecov_json_formatter (~> 0.1)
|
122
|
+
simplecov-html (0.13.1)
|
123
|
+
simplecov_json_formatter (0.1.4)
|
124
|
+
standard (1.37.0)
|
125
|
+
language_server-protocol (~> 3.17.0.2)
|
126
|
+
lint_roller (~> 1.0)
|
127
|
+
rubocop (~> 1.64.0)
|
128
|
+
standard-custom (~> 1.0.0)
|
129
|
+
standard-performance (~> 1.4)
|
130
|
+
standard-custom (1.0.2)
|
131
|
+
lint_roller (~> 1.0)
|
132
|
+
rubocop (~> 1.50)
|
133
|
+
standard-performance (1.6.0)
|
134
|
+
lint_roller (~> 1.1)
|
135
|
+
rubocop-performance (~> 1.23.0)
|
136
|
+
tomlrb (2.0.3)
|
137
|
+
tzinfo (2.0.6)
|
138
|
+
concurrent-ruby (~> 1.0)
|
139
|
+
unicode-display_width (2.6.0)
|
140
|
+
|
141
|
+
PLATFORMS
|
142
|
+
arm64-darwin-23
|
143
|
+
x86_64-linux
|
144
|
+
|
145
|
+
DEPENDENCIES
|
146
|
+
environment_helpers!
|
147
|
+
mdl (~> 0.13)
|
148
|
+
pry (~> 0.15)
|
149
|
+
quiet_quality (~> 1.5)
|
150
|
+
rspec (~> 3.13)
|
151
|
+
rspec-cover_it (~> 0.1.0)
|
152
|
+
rubocop (~> 1.63)
|
153
|
+
simplecov (~> 0.22.0)
|
154
|
+
standard (= 1.37.0)
|
155
|
+
|
156
|
+
BUNDLED WITH
|
157
|
+
2.2.33
|
data/Gemfile.ruby3.1
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile
|
@@ -0,0 +1,128 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
environment_helpers (1.6.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.8.7)
|
10
|
+
public_suffix (>= 2.0.2, < 7.0)
|
11
|
+
ast (2.4.3)
|
12
|
+
chef-utils (18.7.10)
|
13
|
+
concurrent-ruby
|
14
|
+
coderay (1.1.3)
|
15
|
+
concurrent-ruby (1.3.5)
|
16
|
+
diff-lcs (1.6.2)
|
17
|
+
docile (1.4.1)
|
18
|
+
git (1.19.1)
|
19
|
+
addressable (~> 2.8)
|
20
|
+
rchardet (~> 1.8)
|
21
|
+
git_diff_parser (4.0.0)
|
22
|
+
json (2.12.2)
|
23
|
+
kramdown (2.5.1)
|
24
|
+
rexml (>= 3.3.9)
|
25
|
+
kramdown-parser-gfm (1.1.0)
|
26
|
+
kramdown (~> 2.0)
|
27
|
+
language_server-protocol (3.17.0.5)
|
28
|
+
lint_roller (1.1.0)
|
29
|
+
mdl (0.13.0)
|
30
|
+
kramdown (~> 2.3)
|
31
|
+
kramdown-parser-gfm (~> 1.1)
|
32
|
+
mixlib-cli (~> 2.1, >= 2.1.1)
|
33
|
+
mixlib-config (>= 2.2.1, < 4)
|
34
|
+
mixlib-shellout
|
35
|
+
method_source (1.1.0)
|
36
|
+
mixlib-cli (2.1.8)
|
37
|
+
mixlib-config (3.0.27)
|
38
|
+
tomlrb
|
39
|
+
mixlib-shellout (3.3.9)
|
40
|
+
chef-utils
|
41
|
+
parallel (1.27.0)
|
42
|
+
parser (3.3.8.0)
|
43
|
+
ast (~> 2.4.1)
|
44
|
+
racc
|
45
|
+
prism (1.4.0)
|
46
|
+
pry (0.15.2)
|
47
|
+
coderay (~> 1.1)
|
48
|
+
method_source (~> 1.0)
|
49
|
+
public_suffix (6.0.2)
|
50
|
+
quiet_quality (1.5.2)
|
51
|
+
git (>= 1.18)
|
52
|
+
git_diff_parser (~> 4)
|
53
|
+
racc (1.8.1)
|
54
|
+
rainbow (3.1.1)
|
55
|
+
rchardet (1.9.0)
|
56
|
+
regexp_parser (2.10.0)
|
57
|
+
rexml (3.4.1)
|
58
|
+
rspec (3.13.1)
|
59
|
+
rspec-core (~> 3.13.0)
|
60
|
+
rspec-expectations (~> 3.13.0)
|
61
|
+
rspec-mocks (~> 3.13.0)
|
62
|
+
rspec-core (3.13.5)
|
63
|
+
rspec-support (~> 3.13.0)
|
64
|
+
rspec-cover_it (0.1.0)
|
65
|
+
rspec (~> 3.10)
|
66
|
+
rspec-expectations (3.13.5)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.13.0)
|
69
|
+
rspec-mocks (3.13.5)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.13.0)
|
72
|
+
rspec-support (3.13.4)
|
73
|
+
rubocop (1.64.1)
|
74
|
+
json (~> 2.3)
|
75
|
+
language_server-protocol (>= 3.17.0)
|
76
|
+
parallel (~> 1.10)
|
77
|
+
parser (>= 3.3.0.2)
|
78
|
+
rainbow (>= 2.2.2, < 4.0)
|
79
|
+
regexp_parser (>= 1.8, < 3.0)
|
80
|
+
rexml (>= 3.2.5, < 4.0)
|
81
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
82
|
+
ruby-progressbar (~> 1.7)
|
83
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
84
|
+
rubocop-ast (1.45.1)
|
85
|
+
parser (>= 3.3.7.2)
|
86
|
+
prism (~> 1.4)
|
87
|
+
rubocop-performance (1.23.1)
|
88
|
+
rubocop (>= 1.48.1, < 2.0)
|
89
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
90
|
+
ruby-progressbar (1.13.0)
|
91
|
+
simplecov (0.22.0)
|
92
|
+
docile (~> 1.1)
|
93
|
+
simplecov-html (~> 0.11)
|
94
|
+
simplecov_json_formatter (~> 0.1)
|
95
|
+
simplecov-html (0.13.1)
|
96
|
+
simplecov_json_formatter (0.1.4)
|
97
|
+
standard (1.37.0)
|
98
|
+
language_server-protocol (~> 3.17.0.2)
|
99
|
+
lint_roller (~> 1.0)
|
100
|
+
rubocop (~> 1.64.0)
|
101
|
+
standard-custom (~> 1.0.0)
|
102
|
+
standard-performance (~> 1.4)
|
103
|
+
standard-custom (1.0.2)
|
104
|
+
lint_roller (~> 1.0)
|
105
|
+
rubocop (~> 1.50)
|
106
|
+
standard-performance (1.6.0)
|
107
|
+
lint_roller (~> 1.1)
|
108
|
+
rubocop-performance (~> 1.23.0)
|
109
|
+
tomlrb (2.0.3)
|
110
|
+
unicode-display_width (2.6.0)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
arm64-darwin-23
|
114
|
+
x86_64-linux
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
environment_helpers!
|
118
|
+
mdl (~> 0.13)
|
119
|
+
pry (~> 0.15)
|
120
|
+
quiet_quality (~> 1.5)
|
121
|
+
rspec (~> 3.13)
|
122
|
+
rspec-cover_it (~> 0.1.0)
|
123
|
+
rubocop (~> 1.63)
|
124
|
+
simplecov (~> 0.22.0)
|
125
|
+
standard (= 1.37.0)
|
126
|
+
|
127
|
+
BUNDLED WITH
|
128
|
+
2.4.22
|
data/Gemfile.ruby3.2
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile
|
@@ -0,0 +1,169 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
environment_helpers (1.6.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (8.0.2)
|
10
|
+
base64
|
11
|
+
benchmark (>= 0.3)
|
12
|
+
bigdecimal
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
14
|
+
connection_pool (>= 2.2.5)
|
15
|
+
drb
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
logger (>= 1.4.2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
securerandom (>= 0.3)
|
20
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
21
|
+
uri (>= 0.13.1)
|
22
|
+
addressable (2.8.7)
|
23
|
+
public_suffix (>= 2.0.2, < 7.0)
|
24
|
+
ast (2.4.3)
|
25
|
+
base64 (0.3.0)
|
26
|
+
benchmark (0.4.1)
|
27
|
+
bigdecimal (3.2.2)
|
28
|
+
chef-utils (18.7.10)
|
29
|
+
concurrent-ruby
|
30
|
+
coderay (1.1.3)
|
31
|
+
concurrent-ruby (1.3.5)
|
32
|
+
connection_pool (2.5.3)
|
33
|
+
diff-lcs (1.6.2)
|
34
|
+
docile (1.4.1)
|
35
|
+
drb (2.2.3)
|
36
|
+
git (4.0.1)
|
37
|
+
activesupport (>= 5.0)
|
38
|
+
addressable (~> 2.8)
|
39
|
+
process_executer (~> 4.0)
|
40
|
+
rchardet (~> 1.9)
|
41
|
+
git_diff_parser (4.0.0)
|
42
|
+
i18n (1.14.7)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
json (2.12.2)
|
45
|
+
kramdown (2.5.1)
|
46
|
+
rexml (>= 3.3.9)
|
47
|
+
kramdown-parser-gfm (1.1.0)
|
48
|
+
kramdown (~> 2.0)
|
49
|
+
language_server-protocol (3.17.0.5)
|
50
|
+
lint_roller (1.1.0)
|
51
|
+
logger (1.7.0)
|
52
|
+
mdl (0.13.0)
|
53
|
+
kramdown (~> 2.3)
|
54
|
+
kramdown-parser-gfm (~> 1.1)
|
55
|
+
mixlib-cli (~> 2.1, >= 2.1.1)
|
56
|
+
mixlib-config (>= 2.2.1, < 4)
|
57
|
+
mixlib-shellout
|
58
|
+
method_source (1.1.0)
|
59
|
+
minitest (5.25.5)
|
60
|
+
mixlib-cli (2.1.8)
|
61
|
+
mixlib-config (3.0.27)
|
62
|
+
tomlrb
|
63
|
+
mixlib-shellout (3.3.9)
|
64
|
+
chef-utils
|
65
|
+
parallel (1.27.0)
|
66
|
+
parser (3.3.8.0)
|
67
|
+
ast (~> 2.4.1)
|
68
|
+
racc
|
69
|
+
prism (1.4.0)
|
70
|
+
process_executer (4.0.0)
|
71
|
+
track_open_instances (~> 0.1)
|
72
|
+
pry (0.15.2)
|
73
|
+
coderay (~> 1.1)
|
74
|
+
method_source (~> 1.0)
|
75
|
+
public_suffix (6.0.2)
|
76
|
+
quiet_quality (1.5.2)
|
77
|
+
git (>= 1.18)
|
78
|
+
git_diff_parser (~> 4)
|
79
|
+
racc (1.8.1)
|
80
|
+
rainbow (3.1.1)
|
81
|
+
rchardet (1.9.0)
|
82
|
+
regexp_parser (2.10.0)
|
83
|
+
rexml (3.4.1)
|
84
|
+
rspec (3.13.1)
|
85
|
+
rspec-core (~> 3.13.0)
|
86
|
+
rspec-expectations (~> 3.13.0)
|
87
|
+
rspec-mocks (~> 3.13.0)
|
88
|
+
rspec-core (3.13.5)
|
89
|
+
rspec-support (~> 3.13.0)
|
90
|
+
rspec-cover_it (0.1.0)
|
91
|
+
rspec (~> 3.10)
|
92
|
+
rspec-expectations (3.13.5)
|
93
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
94
|
+
rspec-support (~> 3.13.0)
|
95
|
+
rspec-mocks (3.13.5)
|
96
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
+
rspec-support (~> 3.13.0)
|
98
|
+
rspec-support (3.13.4)
|
99
|
+
rubocop (1.64.1)
|
100
|
+
json (~> 2.3)
|
101
|
+
language_server-protocol (>= 3.17.0)
|
102
|
+
parallel (~> 1.10)
|
103
|
+
parser (>= 3.3.0.2)
|
104
|
+
rainbow (>= 2.2.2, < 4.0)
|
105
|
+
regexp_parser (>= 1.8, < 3.0)
|
106
|
+
rexml (>= 3.2.5, < 4.0)
|
107
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
108
|
+
ruby-progressbar (~> 1.7)
|
109
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
110
|
+
rubocop-ast (1.45.1)
|
111
|
+
parser (>= 3.3.7.2)
|
112
|
+
prism (~> 1.4)
|
113
|
+
rubocop-performance (1.23.1)
|
114
|
+
rubocop (>= 1.48.1, < 2.0)
|
115
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
116
|
+
ruby-progressbar (1.13.0)
|
117
|
+
securerandom (0.4.1)
|
118
|
+
simplecov (0.22.0)
|
119
|
+
docile (~> 1.1)
|
120
|
+
simplecov-html (~> 0.11)
|
121
|
+
simplecov_json_formatter (~> 0.1)
|
122
|
+
simplecov-html (0.13.1)
|
123
|
+
simplecov_json_formatter (0.1.4)
|
124
|
+
standard (1.37.0)
|
125
|
+
language_server-protocol (~> 3.17.0.2)
|
126
|
+
lint_roller (~> 1.0)
|
127
|
+
rubocop (~> 1.64.0)
|
128
|
+
standard-custom (~> 1.0.0)
|
129
|
+
standard-performance (~> 1.4)
|
130
|
+
standard-custom (1.0.2)
|
131
|
+
lint_roller (~> 1.0)
|
132
|
+
rubocop (~> 1.50)
|
133
|
+
standard-performance (1.6.0)
|
134
|
+
lint_roller (~> 1.1)
|
135
|
+
rubocop-performance (~> 1.23.0)
|
136
|
+
tomlrb (2.0.3)
|
137
|
+
track_open_instances (0.1.15)
|
138
|
+
tzinfo (2.0.6)
|
139
|
+
concurrent-ruby (~> 1.0)
|
140
|
+
unicode-display_width (2.6.0)
|
141
|
+
uri (1.0.3)
|
142
|
+
|
143
|
+
PLATFORMS
|
144
|
+
aarch64-linux-gnu
|
145
|
+
aarch64-linux-musl
|
146
|
+
arm-linux-gnu
|
147
|
+
arm-linux-musl
|
148
|
+
arm64-darwin
|
149
|
+
ruby
|
150
|
+
x86-linux-gnu
|
151
|
+
x86-linux-musl
|
152
|
+
x86_64-darwin
|
153
|
+
x86_64-linux
|
154
|
+
x86_64-linux-gnu
|
155
|
+
x86_64-linux-musl
|
156
|
+
|
157
|
+
DEPENDENCIES
|
158
|
+
environment_helpers!
|
159
|
+
mdl (~> 0.13)
|
160
|
+
pry (~> 0.15)
|
161
|
+
quiet_quality (~> 1.5)
|
162
|
+
rspec (~> 3.13)
|
163
|
+
rspec-cover_it (~> 0.1.0)
|
164
|
+
rubocop (~> 1.63)
|
165
|
+
simplecov (~> 0.22.0)
|
166
|
+
standard (= 1.37.0)
|
167
|
+
|
168
|
+
BUNDLED WITH
|
169
|
+
2.4.19
|
data/Gemfile.ruby3.3
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile
|
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/README.md
CHANGED
@@ -43,6 +43,7 @@ ENV.integer("MAX_THREAD_COUNT", default: 5)
|
|
43
43
|
ENV.file_path("FILE_PATH", default: "/some/path", required: true)
|
44
44
|
ENV.date("SCHEDULED_DATE", required: true, format: "%Y-%m-%d")
|
45
45
|
ENV.date_time("RUN_AT", required: true, default: DateTime.now)
|
46
|
+
ENV.array("QUEUE_NAMES", of: :strings, required: false, default: ["high", "low"])
|
46
47
|
```
|
47
48
|
|
48
49
|
Each of the supplied methods takes a positional parameter for the name of the
|
@@ -83,3 +84,17 @@ The available methods added to `ENV`:
|
|
83
84
|
as a strptime format string (the `:unix` format is equivalent to the format
|
84
85
|
string `"%s"`). It handles invalid or unparseable values like `ENV.date` does,
|
85
86
|
in that they are treated as if not supplied.
|
87
|
+
* `array` - produces an array of strings, symbols, or integers, depending on the
|
88
|
+
value of the `of` parameter. You can specify the delimiter using a `delimiter`
|
89
|
+
parameter (it defaults to a comma).
|
90
|
+
|
91
|
+
## Configuration
|
92
|
+
|
93
|
+
If you want to specify your own list of truthy/falsey strings, you can do that
|
94
|
+
by setting either or both of these environment variables, supplying comma-
|
95
|
+
separated (whitespace-free) strings:
|
96
|
+
|
97
|
+
* `ENVIRONMENT_HELPERS_TRUTHY_STRINGS` - the default value used is
|
98
|
+
`true,yes,on,enabled,enable,allow,t,y,1,ok,okay`
|
99
|
+
* `ENVIRONMENT_HELPERS_FALSEY_STRINGS` - the default value used is
|
100
|
+
`false,no,off,disabled,disable,deny,f,n,0,nope`
|
data/Steepfile
ADDED
data/environment_helpers.gemspec
CHANGED
@@ -28,12 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = []
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_development_dependency "rspec", "~> 3.
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.13"
|
32
32
|
spec.add_development_dependency "simplecov", "~> 0.22.0"
|
33
33
|
spec.add_development_dependency "rspec-cover_it", "~> 0.1.0"
|
34
|
-
spec.add_development_dependency "pry", "~> 0.
|
35
|
-
spec.add_development_dependency "standard", "
|
36
|
-
spec.add_development_dependency "rubocop", "~> 1.
|
37
|
-
spec.add_development_dependency "quiet_quality", "~> 1.
|
38
|
-
spec.add_development_dependency "mdl", "~> 0.
|
34
|
+
spec.add_development_dependency "pry", "~> 0.15"
|
35
|
+
spec.add_development_dependency "standard", "= 1.37.0"
|
36
|
+
spec.add_development_dependency "rubocop", "~> 1.63"
|
37
|
+
spec.add_development_dependency "quiet_quality", "~> 1.5"
|
38
|
+
spec.add_development_dependency "mdl", "~> 0.13"
|
39
39
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module EnvironmentHelpers
|
2
2
|
module BooleanHelpers
|
3
|
-
TRUTHY_STRINGS = %w[true yes on enabled enable allow t y 1 ok okay].to_set
|
4
|
-
FALSEY_STRINGS = %w[false no off disabled disable deny f n 0 nope].to_set
|
5
3
|
BOOLEAN_VALUES = [true, false, nil].to_set
|
6
4
|
|
7
5
|
def boolean(name, default: nil, required: false)
|
@@ -19,12 +17,26 @@ module EnvironmentHelpers
|
|
19
17
|
|
20
18
|
def truthy_text?(text)
|
21
19
|
return false if text.nil?
|
22
|
-
|
20
|
+
truthy_strings.include?(text.strip.downcase)
|
23
21
|
end
|
24
22
|
|
25
23
|
def falsey_text?(text)
|
26
24
|
return false if text.nil?
|
27
|
-
|
25
|
+
falsey_strings.include?(text.strip.downcase)
|
26
|
+
end
|
27
|
+
|
28
|
+
def truthy_strings
|
29
|
+
@_truthy_strings ||=
|
30
|
+
ENV.fetch("ENVIRONMENT_HELPERS_TRUTHY_STRINGS", "true,yes,on,enabled,enable,allow,t,y,1,ok,okay")
|
31
|
+
.split(",")
|
32
|
+
.to_set
|
33
|
+
end
|
34
|
+
|
35
|
+
def falsey_strings
|
36
|
+
@_falsey_strings ||=
|
37
|
+
ENV.fetch("ENVIRONMENT_HELPERS_FALSEY_STRINGS", "false,no,off,disabled,disable,deny,f,n,0,nope")
|
38
|
+
.split(",")
|
39
|
+
.to_set
|
28
40
|
end
|
29
41
|
end
|
30
42
|
end
|
@@ -2,6 +2,18 @@ module EnvironmentHelpers
|
|
2
2
|
module EnumerableHelpers
|
3
3
|
VALID_TYPES = %i[strings symbols integers]
|
4
4
|
|
5
|
+
TYPE_HANDLERS = {
|
6
|
+
integers: :to_i,
|
7
|
+
strings: :to_s,
|
8
|
+
symbols: :to_sym
|
9
|
+
}
|
10
|
+
|
11
|
+
TYPE_MAP = {
|
12
|
+
integers: Integer,
|
13
|
+
strings: String,
|
14
|
+
symbols: Symbol
|
15
|
+
}
|
16
|
+
|
5
17
|
def array(key, of: :strings, delimiter: ",", default: nil, required: false)
|
6
18
|
check_default_type(:array, default, Array)
|
7
19
|
check_valid_data_type!(of)
|
@@ -22,23 +34,12 @@ module EnvironmentHelpers
|
|
22
34
|
end
|
23
35
|
|
24
36
|
def check_default_data_types!(default, type)
|
37
|
+
return if default.nil?
|
25
38
|
invalid = Array(default).reject { |val| val.is_a? TYPE_MAP[type] }
|
26
39
|
|
27
40
|
unless invalid.empty?
|
28
41
|
fail(BadDefault, "Default array contains values not of type `#{type}': #{invalid.join(", ")}")
|
29
42
|
end
|
30
43
|
end
|
31
|
-
|
32
|
-
TYPE_HANDLERS = {
|
33
|
-
integers: :to_i,
|
34
|
-
strings: :to_s,
|
35
|
-
symbols: :to_sym
|
36
|
-
}
|
37
|
-
|
38
|
-
TYPE_MAP = {
|
39
|
-
integers: Integer,
|
40
|
-
strings: String,
|
41
|
-
symbols: Symbol
|
42
|
-
}
|
43
44
|
end
|
44
45
|
end
|
@@ -2,8 +2,20 @@ module EnvironmentHelpers
|
|
2
2
|
module NumericHelpers
|
3
3
|
def integer(name, default: nil, required: false)
|
4
4
|
check_default_type(:integer, default, Integer)
|
5
|
-
text = fetch_value(name, required: required)
|
5
|
+
text = fetch_value(name, required: required)&.strip
|
6
|
+
text = enforced_format(name: name, text: text, required: required)
|
6
7
|
text&.to_i || default
|
7
8
|
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def enforced_format(name:, text:, required:)
|
13
|
+
return nil unless text
|
14
|
+
return text if text.match?(/\A-?\d+\z/)
|
15
|
+
|
16
|
+
# Not a "correct" integer (we accept only limited forms here)
|
17
|
+
return nil unless required
|
18
|
+
fail(InvalidIntegerText, "The environment variable '#{name}' contains text that does not look like an integer")
|
19
|
+
end
|
8
20
|
end
|
9
21
|
end
|
@@ -6,7 +6,7 @@ module EnvironmentHelpers
|
|
6
6
|
check_range_endpoint(:integer_range, default.end) if default
|
7
7
|
|
8
8
|
text = fetch_value(name, required: required)
|
9
|
-
range = parse_range_from(text)
|
9
|
+
range = text ? parse_range_from(text) : nil
|
10
10
|
return range if range
|
11
11
|
return default unless required
|
12
12
|
fail(InvalidRangeText, "Required Integer Range environment variable #{name} had inappropriate content '#{text}'")
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module EnvironmentHelpers
|
2
2
|
module StringHelpers
|
3
3
|
def string(name, default: nil, required: false)
|
4
|
+
check_default_type(:string, default, String)
|
4
5
|
fetch_value(name, required: required) || default
|
5
6
|
end
|
6
7
|
|
7
8
|
def symbol(name, default: nil, required: false)
|
8
9
|
check_default_type(:symbol, default, Symbol)
|
9
|
-
string(name, default: default, required: required)&.to_sym
|
10
|
+
string(name, default: default&.to_s, required: required)&.to_sym
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
data/lib/environment_helpers.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
# And we're compatible back to 2.6
|
3
3
|
require "set" # rubocop:disable Lint/RedundantRequireStatement
|
4
4
|
|
5
|
-
require_relative "
|
6
|
-
require_relative "
|
7
|
-
require_relative "
|
8
|
-
require_relative "
|
9
|
-
require_relative "
|
10
|
-
require_relative "
|
11
|
-
require_relative "
|
12
|
-
require_relative "
|
5
|
+
require_relative "environment_helpers/access_helpers"
|
6
|
+
require_relative "environment_helpers/string_helpers"
|
7
|
+
require_relative "environment_helpers/boolean_helpers"
|
8
|
+
require_relative "environment_helpers/range_helpers"
|
9
|
+
require_relative "environment_helpers/numeric_helpers"
|
10
|
+
require_relative "environment_helpers/file_helpers"
|
11
|
+
require_relative "environment_helpers/datetime_helpers"
|
12
|
+
require_relative "environment_helpers/enumerable_helpers"
|
13
13
|
|
14
14
|
module EnvironmentHelpers
|
15
15
|
Error = Class.new(::StandardError)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: environment_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Mueller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.13'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: simplecov
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,70 +58,70 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.15'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.15'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: standard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.37.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.37.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.63'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.63'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: quiet_quality
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: '1.5'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: '1.5'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mdl
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0.
|
117
|
+
version: '0.13'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0.
|
124
|
+
version: '0.13'
|
125
125
|
description: |
|
126
126
|
Convenience helpers for more simply accessing data passed to applications through the
|
127
127
|
environment that may have types and/or defaults
|
@@ -131,6 +131,7 @@ executables: []
|
|
131
131
|
extensions: []
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
|
+
- ".bundle/config"
|
134
135
|
- ".github/workflows/quality.yml"
|
135
136
|
- ".github/workflows/rspec.yml"
|
136
137
|
- ".gitignore"
|
@@ -142,8 +143,20 @@ files:
|
|
142
143
|
- ".rubocop.yml"
|
143
144
|
- CHANGELOG.md
|
144
145
|
- Gemfile
|
146
|
+
- Gemfile.lock
|
147
|
+
- Gemfile.ruby2.7
|
148
|
+
- Gemfile.ruby2.7.lock
|
149
|
+
- Gemfile.ruby3.0
|
150
|
+
- Gemfile.ruby3.0.lock
|
151
|
+
- Gemfile.ruby3.1
|
152
|
+
- Gemfile.ruby3.1.lock
|
153
|
+
- Gemfile.ruby3.2
|
154
|
+
- Gemfile.ruby3.2.lock
|
155
|
+
- Gemfile.ruby3.3
|
156
|
+
- Gemfile.ruby3.3.lock
|
145
157
|
- LICENSE
|
146
158
|
- README.md
|
159
|
+
- Steepfile
|
147
160
|
- environment_helpers.gemspec
|
148
161
|
- lib/environment_helpers.rb
|
149
162
|
- lib/environment_helpers/access_helpers.rb
|
@@ -176,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
189
|
- !ruby/object:Gem::Version
|
177
190
|
version: '0'
|
178
191
|
requirements: []
|
179
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.5.22
|
180
193
|
signing_key:
|
181
194
|
specification_version: 4
|
182
195
|
summary: A set of convenience methods for accessing environment data
|