blinkist-config 1.3.1 → 1.5.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/.github/workflows/ci.yml +33 -0
- data/.github/workflows/tag-release.yml +54 -0
- data/.github/workflows/version-guard.yml +43 -0
- data/.gitignore +3 -1
- data/Dockerfile +3 -29
- data/Gemfile +7 -3
- data/README.md +64 -109
- data/Rakefile +5 -6
- data/Taskfile.yml +68 -0
- data/blinkist-config.gemspec +16 -17
- data/docker-compose.yml +7 -17
- data/lib/blinkist/config/adapters/adapter.rb +2 -1
- data/lib/blinkist/config/adapters/aws_ssm_adapter.rb +13 -10
- data/lib/blinkist/config/adapters/diplomat_adapter.rb +3 -5
- data/lib/blinkist/config/adapters/env_over_ssm_adapter.rb +24 -0
- data/lib/blinkist/config/adapters.rb +2 -1
- data/lib/blinkist/config/error_handlers/error_handler.rb +1 -1
- data/lib/blinkist/config/error_handlers/production_only_error_handler.rb +1 -1
- data/lib/blinkist/config/error_handlers.rb +0 -1
- data/lib/blinkist/config/factory.rb +2 -2
- data/lib/blinkist/config/version.rb +1 -1
- data/lib/blinkist/config.rb +9 -8
- metadata +15 -56
- data/.circleci/config.yml +0 -26
- data/.rubocop.yml +0 -71
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24385caf244b70efe62c358af91e8c21a665e4a58ce0f19c5afcfa8e3c880167
|
|
4
|
+
data.tar.gz: 0b2f4916ea3d0ce9d8383c6509b6f2ce842643ac1a3d85e8300a9be9cea2ebcb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86cb037791f449c78beb09fdceeffc122ddf84908a0ae9da2df2f4fe6d846fb04a452d0618ca27f8b4ca224a3907743958ca41e7ad85ec8c5c83dd39d84c2f06
|
|
7
|
+
data.tar.gz: cd8e50cddeee5da4f9d2be914b5dbf2e0806cbbb035e8dbdd11b6f05c253157ecbf3e14961b9e760a96752b4246b52c20efd62b06af0b1a038875c7fc1ce34b1
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
name: StandardRB
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: ruby/setup-ruby@v1
|
|
15
|
+
with:
|
|
16
|
+
ruby-version: "4.0"
|
|
17
|
+
bundler-cache: true
|
|
18
|
+
- run: bundle exec standardrb
|
|
19
|
+
|
|
20
|
+
test:
|
|
21
|
+
name: Test Ruby ${{ matrix.ruby }}
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
strategy:
|
|
24
|
+
fail-fast: false
|
|
25
|
+
matrix:
|
|
26
|
+
ruby: ["3.4", "4.0"]
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: ruby/setup-ruby@v1
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
|
32
|
+
bundler-cache: true
|
|
33
|
+
- run: bundle exec rspec
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Tag release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
name: Publish gem & release
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: release
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Read version
|
|
22
|
+
id: v
|
|
23
|
+
run: |
|
|
24
|
+
ver="$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+' lib/blinkist/config/version.rb | head -1)"
|
|
25
|
+
echo "tag=v$ver" >> "$GITHUB_OUTPUT"
|
|
26
|
+
|
|
27
|
+
- name: Check whether tag exists
|
|
28
|
+
id: exists
|
|
29
|
+
run: |
|
|
30
|
+
if git ls-remote --exit-code --tags origin "refs/tags/${{ steps.v.outputs.tag }}" >/dev/null 2>&1; then
|
|
31
|
+
echo "Tag ${{ steps.v.outputs.tag }} already exists, skipping."
|
|
32
|
+
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
33
|
+
else
|
|
34
|
+
echo "exists=false" >> "$GITHUB_OUTPUT"
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
- uses: ruby/setup-ruby@v1
|
|
38
|
+
if: steps.exists.outputs.exists == 'false'
|
|
39
|
+
with:
|
|
40
|
+
ruby-version: "4.0"
|
|
41
|
+
bundler-cache: true
|
|
42
|
+
|
|
43
|
+
- name: Push gem to rubygems.org
|
|
44
|
+
if: steps.exists.outputs.exists == 'false'
|
|
45
|
+
uses: rubygems/release-gem@v1
|
|
46
|
+
|
|
47
|
+
- name: Create GitHub release
|
|
48
|
+
if: steps.exists.outputs.exists == 'false'
|
|
49
|
+
env:
|
|
50
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
51
|
+
run: |
|
|
52
|
+
gh release create "${{ steps.v.outputs.tag }}" \
|
|
53
|
+
--title "${{ steps.v.outputs.tag }}" \
|
|
54
|
+
--generate-notes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Version guard
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
types: [opened, synchronize, reopened]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
version-guard:
|
|
13
|
+
name: Ensure version bump
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
env:
|
|
16
|
+
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
|
17
|
+
VERSION_FILE: lib/blinkist/config/version.rb
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Compare version against base
|
|
24
|
+
run: |
|
|
25
|
+
git fetch origin "$BASE_REF" --quiet
|
|
26
|
+
extract() { grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1; }
|
|
27
|
+
base="$(git show "origin/$BASE_REF:$VERSION_FILE" | extract)"
|
|
28
|
+
head="$(extract < "$VERSION_FILE")"
|
|
29
|
+
echo "base ($BASE_REF): $base"
|
|
30
|
+
echo "head (this PR): $head"
|
|
31
|
+
|
|
32
|
+
if [ "$base" = "$head" ]; then
|
|
33
|
+
echo "::error file=$VERSION_FILE::Version not bumped. Update VERSION in $VERSION_FILE."
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
highest="$(printf '%s\n%s\n' "$base" "$head" | sort -V | tail -1)"
|
|
38
|
+
if [ "$highest" != "$head" ]; then
|
|
39
|
+
echo "::error file=$VERSION_FILE::Version $head is not greater than main's $base. Rebase and bump above $base."
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
echo "Version bump OK: $base -> $head"
|
data/.gitignore
CHANGED
data/Dockerfile
CHANGED
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
ARG RUBY_VERSION=4.0
|
|
2
|
+
FROM ruby:${RUBY_VERSION}-alpine
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
ENV LANG en_US.UTF-8
|
|
5
|
-
ENV LANGUAGE en_US.UTF-8
|
|
6
|
-
ENV LC_ALL en_US.UTF-8
|
|
7
|
-
ENV LC_CTYPE en_US.UTF-8
|
|
4
|
+
RUN apk add --no-cache build-base git
|
|
8
5
|
|
|
9
|
-
ENV RUNTIME_PACKAGES pkg-config git
|
|
10
|
-
|
|
11
|
-
RUN mkdir /tmp/tmpapp
|
|
12
|
-
WORKDIR /tmp/tmpapp
|
|
13
|
-
ADD . /tmp/tmpapp
|
|
14
|
-
|
|
15
|
-
RUN echo 'gem: --no-document' >> ~/.gemrc && \
|
|
16
|
-
apt-get clean && apt-get update -qq && apt-get install -y build-essential $RUNTIME_PACKAGES && \
|
|
17
|
-
gem install bundler --version 2.2.10 && \
|
|
18
|
-
gem install gem-release && \
|
|
19
|
-
bundle update && bundle install --jobs 20 --retry 5 && \
|
|
20
|
-
rm -Rf /tmp/tmpapp/ && \
|
|
21
|
-
rm -rf /usr/share/doc/ /usr/share/man/ /usr/share/locale/ && apt-get clean
|
|
22
|
-
|
|
23
|
-
RUN mkdir /app
|
|
24
|
-
ADD . /app
|
|
25
6
|
WORKDIR /app
|
|
26
|
-
|
|
27
|
-
RUN bundle install -j1
|
|
28
|
-
|
|
29
|
-
RUN chown -R nobody:nogroup /app
|
|
30
|
-
RUN whoami
|
|
31
|
-
USER nobody
|
|
32
|
-
RUN whoami
|
data/Gemfile
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
# Specify your gem's dependencies in blinkist-config.gemspec
|
|
4
3
|
gemspec
|
|
5
4
|
|
|
5
|
+
group :development do
|
|
6
|
+
gem "rake", "~> 13.0"
|
|
7
|
+
gem "standard", ">= 1.50.0"
|
|
8
|
+
end
|
|
9
|
+
|
|
6
10
|
group :test do
|
|
7
|
-
gem "
|
|
11
|
+
gem "rspec"
|
|
8
12
|
gem "simplecov"
|
|
9
13
|
end
|
data/README.md
CHANGED
|
@@ -1,170 +1,125 @@
|
|
|
1
1
|
# Blinkist::Config
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://codeclimate.com/github/blinkist/blinkist-config)
|
|
3
|
+
Read configuration values through one interface, backed by the store you pick: the process ENV, AWS SSM Parameter Store, Consul (via Diplomat), or ENV with an SSM fallback.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Using the ENV
|
|
5
|
+
## Installation
|
|
9
6
|
|
|
10
7
|
```ruby
|
|
11
|
-
|
|
8
|
+
gem "blinkist-config"
|
|
9
|
+
```
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
config.url = "http://172.17.0.1:8500"
|
|
15
|
-
end
|
|
11
|
+
## Setup
|
|
16
12
|
|
|
13
|
+
Configure the gem once, before anything else loads. In Rails, put this in a `config.rb` and require it from `application.rb` right after `boot`.
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
17
16
|
Blinkist::Config.env = ENV["RAILS_ENV"]
|
|
18
17
|
Blinkist::Config.app_name = "my_nice_app"
|
|
19
|
-
Blinkist::Config.adapter_type = :env
|
|
18
|
+
Blinkist::Config.adapter_type = :env # :env, :aws_ssm, :env_over_ssm or :diplomat
|
|
20
19
|
Blinkist::Config.error_handler = :strict
|
|
21
|
-
|
|
22
|
-
my_config_value = Blinkist::Config.get! "some/folder/config"
|
|
23
|
-
|
|
24
|
-
# This is being translated to ENV["SOME_FOLDER_CONFIG"]
|
|
25
20
|
```
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
When configured with `Blinkist::Config.error_handler = :strict` (as recommended)
|
|
30
|
-
reading a configuration entry for which the value is missing
|
|
31
|
-
(for example missing enviroment variables) will cause
|
|
32
|
-
`Blinkist::Config::ValueMissingError` to be raised.
|
|
22
|
+
## Reading values
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
```ruby
|
|
25
|
+
Blinkist::Config.get! "some/folder/config"
|
|
26
|
+
```
|
|
36
27
|
|
|
37
|
-
|
|
28
|
+
With `:env` this reads `ENV["SOME_FOLDER_CONFIG"]`. With `:aws_ssm` it reads `/application/my_nice_app/some/folder/config`. With `:diplomat` it reads `my_nice_app/some/folder/config`.
|
|
38
29
|
|
|
39
|
-
###
|
|
30
|
+
### Default value
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
configuration entries then you canprovide a default value as a second
|
|
43
|
-
paramter to `get!`:
|
|
32
|
+
Pass a default as the second argument. Then a missing value returns the default instead of raising.
|
|
44
33
|
|
|
45
34
|
```ruby
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# If ENV["SOME_FOLDER_CONFIG"] is nil, "default value" will be returned
|
|
35
|
+
Blinkist::Config.get! "some/folder/config", "default value"
|
|
49
36
|
```
|
|
50
37
|
|
|
51
|
-
###
|
|
52
|
-
|
|
53
|
-
If you want to use Consul's key value store, simply use our diplomat adapter.
|
|
54
|
-
|
|
55
|
-
* [https://www.consul.io/](https://www.consul.io/)
|
|
56
|
-
* [https://github.com/WeAreFarmGeek/diplomat](https://github.com/WeAreFarmGeek/diplomat)
|
|
38
|
+
### Scope
|
|
57
39
|
|
|
58
|
-
|
|
40
|
+
A scope replaces the app name in the key path. The `:env` adapter ignores it.
|
|
59
41
|
|
|
60
42
|
```ruby
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Blinkist::Config.adapter_type = ENV["CONSUL_AVAILABLE"] == "true" ? :diplomat : :env
|
|
65
|
-
|
|
66
|
-
my_config_value = Blinkist::Config.get! "some/folder/config"
|
|
67
|
-
|
|
68
|
-
# This is will try to get a value from Consul's KV store at "my_nice_app/some/folder/config"
|
|
43
|
+
Blinkist::Config.get! "another/config", scope: "global"
|
|
44
|
+
# aws_ssm: /application/global/another/config
|
|
45
|
+
# diplomat: global/another/config
|
|
69
46
|
```
|
|
70
47
|
|
|
71
|
-
###
|
|
72
|
-
```ruby
|
|
73
|
-
# Here we setting a scope outside of the app
|
|
48
|
+
### Refetch
|
|
74
49
|
|
|
75
|
-
|
|
50
|
+
Values are cached after the first read. Pass `refetch: true` to read from the store again. This costs SSM quota, so use it with care.
|
|
76
51
|
|
|
77
|
-
|
|
78
|
-
|
|
52
|
+
```ruby
|
|
53
|
+
Blinkist::Config.get! "some/folder/config", refetch: true
|
|
79
54
|
```
|
|
80
55
|
|
|
81
|
-
###
|
|
56
|
+
### Error handling
|
|
82
57
|
|
|
83
|
-
|
|
58
|
+
- `:strict` raises `Blinkist::Config::ValueMissingError` when a value is missing. Recommended.
|
|
59
|
+
- `:heuristic` raises only when `env == "production"`. This is the default for backwards compatibility.
|
|
84
60
|
|
|
85
|
-
|
|
61
|
+
## Adapters
|
|
86
62
|
|
|
87
|
-
|
|
88
|
-
Blinkist::Config.env = ENV["RAILS_ENV"]
|
|
89
|
-
Blinkist::Config.app_name = "my_nice_app"
|
|
90
|
-
Blinkist::Config.adapter_type = ENV["SSM_AVAILABLE"] == "true" ? :aws_ssm : :env
|
|
63
|
+
### `:env`
|
|
91
64
|
|
|
92
|
-
|
|
65
|
+
Reads from `ENV`. The key is upcased and `/` becomes `_`.
|
|
93
66
|
|
|
94
|
-
|
|
67
|
+
### `:aws_ssm`
|
|
95
68
|
|
|
96
|
-
|
|
97
|
-
Blinkist::Config.preload
|
|
98
|
-
Blinkist::Config.preload scope: "global" # in case you need also another scope being preloaded
|
|
99
|
-
```
|
|
69
|
+
Reads from AWS SSM Parameter Store with decryption. The code must run with IAM access to the parameters.
|
|
100
70
|
|
|
101
|
-
### Using SSM with a folder scope
|
|
102
71
|
```ruby
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
my_config_value = Blinkist::Config.get! "another/config", scope: "global"
|
|
72
|
+
Blinkist::Config.adapter_type = :aws_ssm
|
|
106
73
|
|
|
107
|
-
#
|
|
74
|
+
# Load all parameters of a scope in one call to avoid later lookups
|
|
75
|
+
Blinkist::Config.preload
|
|
76
|
+
Blinkist::Config.preload scope: "global"
|
|
108
77
|
```
|
|
109
78
|
|
|
79
|
+
### `:env_over_ssm`
|
|
110
80
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Add this line to your application's Gemfile:
|
|
81
|
+
Reads from `ENV` first. When the ENV has no value, it falls back to SSM. This lets you override single SSM values locally or in CI without touching the parameter store.
|
|
114
82
|
|
|
115
83
|
```ruby
|
|
116
|
-
|
|
84
|
+
Blinkist::Config.adapter_type = :env_over_ssm
|
|
85
|
+
|
|
86
|
+
Blinkist::Config.get! "database/url"
|
|
87
|
+
# 1. ENV["DATABASE_URL"] if set
|
|
88
|
+
# 2. otherwise /application/my_nice_app/database/url from SSM
|
|
117
89
|
```
|
|
118
90
|
|
|
119
|
-
|
|
91
|
+
`scope`, `refetch` and `preload` apply to the SSM part only.
|
|
120
92
|
|
|
121
|
-
|
|
93
|
+
### `:diplomat`
|
|
122
94
|
|
|
123
|
-
|
|
124
|
-
Blinkist::Config.env = "production" || "test" || "development"
|
|
125
|
-
Blinkist::Config.app_name = "your_app_name" # Used only with diplomat adapter
|
|
126
|
-
Blinkist::Config.adapter_type = :diplomat || :env
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
It's best to drop a `config.rb` into your app and load this file before every other file. In Rails you can link it into your `application.rb`
|
|
95
|
+
Reads from Consul's key value store through [Diplomat](https://github.com/WeAreFarmGeek/diplomat). Configure Diplomat yourself before use.
|
|
130
96
|
|
|
131
97
|
```ruby
|
|
132
|
-
|
|
133
|
-
|
|
98
|
+
Diplomat.configure do |config|
|
|
99
|
+
config.url = "http://172.17.0.1:8500"
|
|
100
|
+
end
|
|
134
101
|
|
|
135
|
-
|
|
136
|
-
# ...
|
|
102
|
+
Blinkist::Config.adapter_type = :diplomat
|
|
137
103
|
```
|
|
138
104
|
|
|
139
105
|
## Development
|
|
140
106
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
docker-compose run rake
|
|
145
|
-
```
|
|
107
|
+
Requires [Task](https://taskfile.dev) and Docker.
|
|
146
108
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
109
|
+
```sh
|
|
110
|
+
task bundle # install gems for all supported Ruby versions
|
|
111
|
+
task test # run specs on all supported Ruby versions
|
|
112
|
+
task test:local # run specs on the default Ruby version
|
|
113
|
+
task test:3.4 # run specs on one Ruby version
|
|
114
|
+
task lint # run StandardRB
|
|
115
|
+
task shell # open a shell in the container
|
|
153
116
|
```
|
|
154
117
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
docker-compose run gem release
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
You'll have to have proper rights to access rubygems.org
|
|
162
|
-
|
|
163
|
-
## Contributing
|
|
164
|
-
|
|
165
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/blinkist/blinkist-config.
|
|
118
|
+
## Release
|
|
166
119
|
|
|
120
|
+
1. Bump `VERSION` in `lib/blinkist/config/version.rb`. The `version-guard` workflow fails a PR to `main` without a bump.
|
|
121
|
+
2. Merge to `main`.
|
|
167
122
|
|
|
168
123
|
## License
|
|
169
124
|
|
|
170
|
-
|
|
125
|
+
MIT, see [LICENSE](LICENSE).
|
data/Rakefile
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
2
|
require "rspec/core/rake_task"
|
|
3
|
-
require "rubocop/rake_task"
|
|
4
|
-
|
|
5
|
-
RuboCop::RakeTask.new do |task|
|
|
6
|
-
task.options = %w(-a)
|
|
7
|
-
end
|
|
8
3
|
|
|
9
4
|
RSpec::Core::RakeTask.new(:spec)
|
|
10
5
|
|
|
6
|
+
task :standardrb do
|
|
7
|
+
sh "bundle exec standardrb --fix"
|
|
8
|
+
end
|
|
9
|
+
|
|
11
10
|
task(:default).clear
|
|
12
|
-
task default: %i
|
|
11
|
+
task default: %i[standardrb spec]
|
data/Taskfile.yml
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
version: "3"
|
|
2
|
+
|
|
3
|
+
tasks:
|
|
4
|
+
default:
|
|
5
|
+
desc: List all available tasks
|
|
6
|
+
cmds:
|
|
7
|
+
- task --list-all
|
|
8
|
+
silent: true
|
|
9
|
+
|
|
10
|
+
bundle:
|
|
11
|
+
desc: Bundles the gem in Docker for all supported Ruby versions
|
|
12
|
+
deps:
|
|
13
|
+
- bundle:3.4
|
|
14
|
+
- bundle:4.0
|
|
15
|
+
# we need stty sane to fix terminal output after running task bundle in parallel
|
|
16
|
+
cmd: stty sane
|
|
17
|
+
|
|
18
|
+
bundle:*:
|
|
19
|
+
env:
|
|
20
|
+
RUBY_VERSION: "{{index .MATCH 0}}"
|
|
21
|
+
cmds:
|
|
22
|
+
- docker compose run --rm ruby bundle install -j8
|
|
23
|
+
|
|
24
|
+
test:
|
|
25
|
+
desc: Runs tests against all supported Ruby versions
|
|
26
|
+
cmds:
|
|
27
|
+
- task: test:3.4
|
|
28
|
+
- task: test:4.0
|
|
29
|
+
|
|
30
|
+
test:local:
|
|
31
|
+
desc: Runs tests against the default Ruby version
|
|
32
|
+
cmds:
|
|
33
|
+
- task: test:4.0
|
|
34
|
+
vars:
|
|
35
|
+
CLI_ARGS: "{{.CLI_ARGS}}"
|
|
36
|
+
|
|
37
|
+
test:*:
|
|
38
|
+
env:
|
|
39
|
+
RUBY_VERSION: "{{index .MATCH 0}}"
|
|
40
|
+
cmds:
|
|
41
|
+
- docker compose run --rm ruby bundle exec rspec {{.CLI_ARGS}}
|
|
42
|
+
|
|
43
|
+
lint:
|
|
44
|
+
desc: Runs StandardRB
|
|
45
|
+
env:
|
|
46
|
+
RUBY_VERSION: "4.0"
|
|
47
|
+
cmds:
|
|
48
|
+
- docker compose run --rm ruby bundle exec standardrb {{.CLI_ARGS}}
|
|
49
|
+
|
|
50
|
+
run:
|
|
51
|
+
desc: Runs an arbitrary command in the default Ruby container
|
|
52
|
+
env:
|
|
53
|
+
RUBY_VERSION: "4.0"
|
|
54
|
+
cmds:
|
|
55
|
+
- docker compose run --rm ruby {{.CLI_ARGS}}
|
|
56
|
+
|
|
57
|
+
shell:
|
|
58
|
+
desc: Opens a shell in the default Ruby container
|
|
59
|
+
env:
|
|
60
|
+
RUBY_VERSION: "4.0"
|
|
61
|
+
cmds:
|
|
62
|
+
- docker compose run --rm ruby ash
|
|
63
|
+
|
|
64
|
+
docker:clean:
|
|
65
|
+
desc: Purges local Docker setup
|
|
66
|
+
cmds:
|
|
67
|
+
- docker compose down -v --remove-orphans --rmi local
|
|
68
|
+
- rm -rf .docker-compose/*
|
data/blinkist-config.gemspec
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
3
|
require_relative "lib/blinkist/config/version"
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name
|
|
8
|
-
spec.version
|
|
9
|
-
spec.authors
|
|
10
|
-
spec.email
|
|
6
|
+
spec.name = "blinkist-config"
|
|
7
|
+
spec.version = Blinkist::Config::VERSION
|
|
8
|
+
spec.authors = ["Sebastian Schleicher, Blinks Labs GmbH"]
|
|
9
|
+
spec.email = ["sj@blinkist.com"]
|
|
10
|
+
|
|
11
|
+
spec.required_ruby_version = ">= 3.2.8"
|
|
11
12
|
|
|
12
|
-
spec.summary
|
|
13
|
-
spec.description
|
|
14
|
-
spec.homepage
|
|
15
|
-
spec.license
|
|
13
|
+
spec.summary = "Simple adapter based configuration handler (supports ENV and Consul/Diplomat)."
|
|
14
|
+
spec.description = "This GEM allows you to keep your configuration class-based by calling Blinkist::Config.get!(...) instead of accessing the ENV directly. You can set up different types of adapters to connect to various configuration systems like your ENV or Consul's key-value-store."
|
|
15
|
+
spec.homepage = "https://github.com/blinkist/blinkist-config"
|
|
16
|
+
spec.license = "MIT"
|
|
16
17
|
|
|
17
|
-
spec.files
|
|
18
|
-
spec.require_paths = %w
|
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
19
|
+
spec.require_paths = %w[lib]
|
|
19
20
|
|
|
20
|
-
spec.
|
|
21
|
-
spec.
|
|
22
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
|
21
|
+
spec.add_dependency "aws-sdk-ssm", "~> 1"
|
|
22
|
+
spec.add_dependency "diplomat", "~> 2"
|
|
23
23
|
|
|
24
|
-
spec.
|
|
25
|
-
spec.add_runtime_dependency "aws-sdk-ssm", "~> 1"
|
|
24
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
26
25
|
end
|
data/docker-compose.yml
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
version: "2"
|
|
2
1
|
services:
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
ruby:
|
|
3
|
+
image: blinkist-config-ruby:${RUBY_VERSION:-4.0}
|
|
5
4
|
build:
|
|
6
5
|
context: .
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
args:
|
|
7
|
+
RUBY_VERSION: ${RUBY_VERSION:-4.0}
|
|
8
|
+
tty: true
|
|
10
9
|
volumes:
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
gem:
|
|
14
|
-
build:
|
|
15
|
-
context: .
|
|
16
|
-
entrypoint: gem
|
|
17
|
-
volumes:
|
|
18
|
-
- .:/app
|
|
19
|
-
- ~/.gitconfig:/nonexistent/.gitconfig
|
|
20
|
-
- ~/.ssh:/nonexistent/.ssh
|
|
21
|
-
- ~/.gem:/nonexistent/.gem
|
|
10
|
+
- ./:/app
|
|
11
|
+
- .docker-compose/bundle-${RUBY_VERSION:-4.0}:/usr/local/bundle
|
|
@@ -6,7 +6,7 @@ module Blinkist
|
|
|
6
6
|
@app_name = app_name
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def get(_key, _default=nil, **)
|
|
9
|
+
def get(_key, _default = nil, **)
|
|
10
10
|
raise NotImplementedError
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -20,6 +20,7 @@ module Blinkist
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
extend Gem::Deprecate
|
|
23
|
+
|
|
23
24
|
deprecate :instance_for, :none, 2017, 12
|
|
24
25
|
end
|
|
25
26
|
end
|
|
@@ -7,16 +7,16 @@ module Blinkist
|
|
|
7
7
|
DEFAULT_PREFIX = "/application/".freeze
|
|
8
8
|
|
|
9
9
|
def initialize(env, app_name)
|
|
10
|
-
super
|
|
10
|
+
super
|
|
11
11
|
|
|
12
12
|
@items_cache = {}
|
|
13
13
|
@client = Aws::SSM::Client.new
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def get(key, default=nil, scope: nil)
|
|
16
|
+
def get(key, default = nil, scope: nil, refetch: false)
|
|
17
17
|
prefix = prefix_for(scope)
|
|
18
18
|
|
|
19
|
-
query_ssm_parameter
|
|
19
|
+
query_ssm_parameter(prefix + key, refetch)
|
|
20
20
|
rescue Aws::SSM::Errors::ParameterNotFound
|
|
21
21
|
default
|
|
22
22
|
end
|
|
@@ -29,17 +29,20 @@ module Blinkist
|
|
|
29
29
|
|
|
30
30
|
def prefix_for(scope)
|
|
31
31
|
if scope.nil?
|
|
32
|
-
DEFAULT_PREFIX
|
|
32
|
+
"#{DEFAULT_PREFIX}#{@app_name}/"
|
|
33
33
|
else
|
|
34
|
-
DEFAULT_PREFIX
|
|
34
|
+
"#{DEFAULT_PREFIX}#{scope}/"
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def query_ssm_parameter(name)
|
|
39
|
-
|
|
40
|
-
name
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
def query_ssm_parameter(name, refetch)
|
|
39
|
+
if refetch || !@items_cache.key?(name)
|
|
40
|
+
@items_cache[name] = @client.get_parameter(
|
|
41
|
+
name: name,
|
|
42
|
+
with_decryption: true
|
|
43
|
+
).parameter.value
|
|
44
|
+
end
|
|
45
|
+
@items_cache[name]
|
|
43
46
|
end
|
|
44
47
|
|
|
45
48
|
def query_all_ssm_parameters(prefix)
|
|
@@ -5,19 +5,17 @@ module Blinkist
|
|
|
5
5
|
class Config
|
|
6
6
|
class DiplomatAdapter < Adapter
|
|
7
7
|
def initialize(env, app_name)
|
|
8
|
-
super
|
|
8
|
+
super
|
|
9
9
|
|
|
10
10
|
@items_cache = {}
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
def get(key, default=nil, scope: nil)
|
|
13
|
+
def get(key, default = nil, scope: nil, refetch: false)
|
|
14
14
|
scope ||= @app_name
|
|
15
15
|
|
|
16
16
|
diplomat_key = "#{scope}/#{key}"
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
@items_cache[diplomat_key] = Diplomat::Kv.get(diplomat_key)
|
|
20
|
-
end
|
|
18
|
+
@items_cache[diplomat_key] = Diplomat::Kv.get(diplomat_key) if refetch || !@items_cache.key?(diplomat_key)
|
|
21
19
|
|
|
22
20
|
@items_cache[diplomat_key]
|
|
23
21
|
rescue Diplomat::KeyNotFound
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require_relative "adapter"
|
|
2
|
+
require_relative "env_adapter"
|
|
3
|
+
require_relative "aws_ssm_adapter"
|
|
4
|
+
|
|
5
|
+
module Blinkist
|
|
6
|
+
class Config
|
|
7
|
+
class EnvOverSsmAdapter < Adapter
|
|
8
|
+
def initialize(env, app_name)
|
|
9
|
+
super
|
|
10
|
+
|
|
11
|
+
@env_adapter = EnvAdapter.new(env, app_name)
|
|
12
|
+
@ssm_adapter = AwsSsmAdapter.new(env, app_name)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def get(key, default = nil, scope: nil, refetch: false)
|
|
16
|
+
@env_adapter.get(key) || @ssm_adapter.get(key, default, scope: scope, refetch: refetch)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def preload(scope: nil)
|
|
20
|
+
@ssm_adapter.preload(scope: scope)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -7,7 +7,7 @@ module Blinkist
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def call(key, scope)
|
|
10
|
-
raise ValueMissingError, "Missing value for #{key} in the scope: #{scope ||
|
|
10
|
+
raise ValueMissingError, "Missing value for #{key} in the scope: #{scope || "<default>"} (Please check the configuration for missing keys)"
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Blinkist
|
|
2
2
|
class Config
|
|
3
3
|
class Factory
|
|
4
|
-
def initialize(aspect, implementations, env=Blinkist::Config.env, app_name=Blinkist::Config.app_name)
|
|
4
|
+
def initialize(aspect, implementations, env = Blinkist::Config.env, app_name = Blinkist::Config.app_name)
|
|
5
5
|
@aspect = aspect
|
|
6
6
|
@implementations = implementations
|
|
7
7
|
@env = env
|
|
@@ -12,7 +12,7 @@ module Blinkist
|
|
|
12
12
|
case strategy
|
|
13
13
|
when Symbol
|
|
14
14
|
klass = @implementations[strategy] ||
|
|
15
|
-
|
|
15
|
+
raise(NotImplementedError, "Unknown strategy #{strategy} for #{@aspect}")
|
|
16
16
|
when Class
|
|
17
17
|
klass = strategy
|
|
18
18
|
else
|
data/lib/blinkist/config.rb
CHANGED
|
@@ -10,6 +10,7 @@ require_relative "config/error_handlers"
|
|
|
10
10
|
require_relative "config/adapters/env_adapter"
|
|
11
11
|
require_relative "config/adapters/diplomat_adapter"
|
|
12
12
|
require_relative "config/adapters/aws_ssm_adapter"
|
|
13
|
+
require_relative "config/adapters/env_over_ssm_adapter"
|
|
13
14
|
require_relative "config/adapters"
|
|
14
15
|
|
|
15
16
|
module Blinkist
|
|
@@ -17,8 +18,8 @@ module Blinkist
|
|
|
17
18
|
class << self
|
|
18
19
|
attr_accessor :adapter_type, :logger, :env, :app_name, :error_handler
|
|
19
20
|
|
|
20
|
-
def get(key, default = nil, scope: nil)
|
|
21
|
-
get!(key, default, scope: scope)
|
|
21
|
+
def get(key, default = nil, scope: nil, refetch: false)
|
|
22
|
+
get!(key, default, scope: scope, refetch: refetch)
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
def preload(scope: nil)
|
|
@@ -26,28 +27,29 @@ module Blinkist
|
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
extend Gem::Deprecate
|
|
30
|
+
|
|
29
31
|
deprecate :get, "get!", 2017, 12
|
|
30
32
|
|
|
31
|
-
def get!(key, *args, scope: nil)
|
|
33
|
+
def get!(key, *args, scope: nil, refetch: false)
|
|
32
34
|
# NOTE: we need to do this this way
|
|
33
35
|
# to handle 'nil' default correctly
|
|
34
36
|
case args.length
|
|
35
37
|
when 0
|
|
36
38
|
default = nil
|
|
37
|
-
bang
|
|
39
|
+
bang = true
|
|
38
40
|
when 1
|
|
39
41
|
default = args.first
|
|
40
|
-
bang
|
|
42
|
+
bang = false
|
|
41
43
|
else
|
|
42
44
|
raise ArgumentError, "wrong number of arguments (given #{args.length + 1}, expected 1..2)"
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
from_adapter = adapter.get(key, scope: scope)
|
|
47
|
+
from_adapter = adapter.get(key, scope: scope, refetch: refetch)
|
|
46
48
|
|
|
47
49
|
if from_adapter.nil? && bang
|
|
48
50
|
handle_error(key, scope)
|
|
49
51
|
else
|
|
50
|
-
|
|
52
|
+
from_adapter || default
|
|
51
53
|
end
|
|
52
54
|
end
|
|
53
55
|
|
|
@@ -59,7 +61,6 @@ module Blinkist
|
|
|
59
61
|
handler = Factory.new("Blinkist::Config.error_handler", ErrorHandlers::BUILT_IN).call(error_handler)
|
|
60
62
|
handler.call(key, scope)
|
|
61
63
|
end
|
|
62
|
-
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
# NOTE: default configuration goes here
|
metadata
CHANGED
|
@@ -1,57 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blinkist-config
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sebastian Schleicher, Blinks Labs GmbH
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.2.10
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.2.10
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: rake
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '12.0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '12.0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rspec
|
|
13
|
+
name: aws-sdk-ssm
|
|
43
14
|
requirement: !ruby/object:Gem::Requirement
|
|
44
15
|
requirements:
|
|
45
16
|
- - "~>"
|
|
46
17
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
48
|
-
type: :
|
|
18
|
+
version: '1'
|
|
19
|
+
type: :runtime
|
|
49
20
|
prerelease: false
|
|
50
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
22
|
requirements:
|
|
52
23
|
- - "~>"
|
|
53
24
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
25
|
+
version: '1'
|
|
55
26
|
- !ruby/object:Gem::Dependency
|
|
56
27
|
name: diplomat
|
|
57
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,20 +37,6 @@ dependencies:
|
|
|
66
37
|
- - "~>"
|
|
67
38
|
- !ruby/object:Gem::Version
|
|
68
39
|
version: '2'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: aws-sdk-ssm
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - "~>"
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '1'
|
|
76
|
-
type: :runtime
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - "~>"
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '1'
|
|
83
40
|
description: This GEM allows you to keep your configuration class-based by calling
|
|
84
41
|
Blinkist::Config.get!(...) instead of accessing the ENV directly. You can set up
|
|
85
42
|
different types of adapters to connect to various configuration systems like your
|
|
@@ -90,15 +47,17 @@ executables: []
|
|
|
90
47
|
extensions: []
|
|
91
48
|
extra_rdoc_files: []
|
|
92
49
|
files:
|
|
93
|
-
- ".
|
|
50
|
+
- ".github/workflows/ci.yml"
|
|
51
|
+
- ".github/workflows/tag-release.yml"
|
|
52
|
+
- ".github/workflows/version-guard.yml"
|
|
94
53
|
- ".gitignore"
|
|
95
|
-
- ".rubocop.yml"
|
|
96
54
|
- Dockerfile
|
|
97
55
|
- Gemfile
|
|
98
56
|
- LICENSE
|
|
99
57
|
- LICENSE.txt
|
|
100
58
|
- README.md
|
|
101
59
|
- Rakefile
|
|
60
|
+
- Taskfile.yml
|
|
102
61
|
- bin/console
|
|
103
62
|
- bin/setup
|
|
104
63
|
- blinkist-config.gemspec
|
|
@@ -109,6 +68,7 @@ files:
|
|
|
109
68
|
- lib/blinkist/config/adapters/aws_ssm_adapter.rb
|
|
110
69
|
- lib/blinkist/config/adapters/diplomat_adapter.rb
|
|
111
70
|
- lib/blinkist/config/adapters/env_adapter.rb
|
|
71
|
+
- lib/blinkist/config/adapters/env_over_ssm_adapter.rb
|
|
112
72
|
- lib/blinkist/config/error.rb
|
|
113
73
|
- lib/blinkist/config/error_handlers.rb
|
|
114
74
|
- lib/blinkist/config/error_handlers/error_handler.rb
|
|
@@ -121,8 +81,8 @@ files:
|
|
|
121
81
|
homepage: https://github.com/blinkist/blinkist-config
|
|
122
82
|
licenses:
|
|
123
83
|
- MIT
|
|
124
|
-
metadata:
|
|
125
|
-
|
|
84
|
+
metadata:
|
|
85
|
+
rubygems_mfa_required: 'true'
|
|
126
86
|
rdoc_options: []
|
|
127
87
|
require_paths:
|
|
128
88
|
- lib
|
|
@@ -130,15 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
130
90
|
requirements:
|
|
131
91
|
- - ">="
|
|
132
92
|
- !ruby/object:Gem::Version
|
|
133
|
-
version:
|
|
93
|
+
version: 3.2.8
|
|
134
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
95
|
requirements:
|
|
136
96
|
- - ">="
|
|
137
97
|
- !ruby/object:Gem::Version
|
|
138
98
|
version: '0'
|
|
139
99
|
requirements: []
|
|
140
|
-
rubygems_version:
|
|
141
|
-
signing_key:
|
|
100
|
+
rubygems_version: 4.0.20
|
|
142
101
|
specification_version: 4
|
|
143
102
|
summary: Simple adapter based configuration handler (supports ENV and Consul/Diplomat).
|
|
144
103
|
test_files: []
|
data/.circleci/config.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
jobs:
|
|
3
|
-
build:
|
|
4
|
-
working_directory: ~/blinkist/blinkist-config
|
|
5
|
-
parallelism: 1
|
|
6
|
-
docker:
|
|
7
|
-
- image: cimg/ruby:2.7.3-browsers
|
|
8
|
-
steps:
|
|
9
|
-
- checkout
|
|
10
|
-
- restore_cache:
|
|
11
|
-
keys:
|
|
12
|
-
- gem-cache-{{ checksum "Gemfile.lock" }}
|
|
13
|
-
- gem-cache-
|
|
14
|
-
- run:
|
|
15
|
-
name: Bundle Install
|
|
16
|
-
command: bundle install --jobs=4 --retry=3 --path=vendor/bundle
|
|
17
|
-
- save_cache:
|
|
18
|
-
key: gem-cache-{{ checksum "Gemfile.lock" }}
|
|
19
|
-
paths:
|
|
20
|
-
- vendor/bundle
|
|
21
|
-
- run:
|
|
22
|
-
name: RSpec
|
|
23
|
-
command: bundle exec rspec --format progress spec
|
|
24
|
-
environment:
|
|
25
|
-
RAILS_ENV: test
|
|
26
|
-
RACK_ENV: test
|
data/.rubocop.yml
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
Lint/ParenthesesAsGroupedExpression:
|
|
2
|
-
Enabled: true
|
|
3
|
-
Exclude:
|
|
4
|
-
- 'spec/**/*'
|
|
5
|
-
|
|
6
|
-
Metrics/ModuleLength:
|
|
7
|
-
Exclude:
|
|
8
|
-
- "**/*_spec.rb"
|
|
9
|
-
|
|
10
|
-
Metrics/BlockLength:
|
|
11
|
-
Exclude:
|
|
12
|
-
- "**/*_spec.rb"
|
|
13
|
-
|
|
14
|
-
Style/BlockDelimiters:
|
|
15
|
-
Enabled: true
|
|
16
|
-
Exclude:
|
|
17
|
-
- 'spec/**/*'
|
|
18
|
-
|
|
19
|
-
Style/Documentation:
|
|
20
|
-
Enabled: false
|
|
21
|
-
|
|
22
|
-
Style/EmptyLinesAroundClassBody:
|
|
23
|
-
Enabled: false
|
|
24
|
-
|
|
25
|
-
Style/EmptyLinesAroundModuleBody:
|
|
26
|
-
Enabled: false
|
|
27
|
-
|
|
28
|
-
Style/GuardClause:
|
|
29
|
-
Enabled: false
|
|
30
|
-
|
|
31
|
-
Style/PredicateName:
|
|
32
|
-
Enabled: false
|
|
33
|
-
|
|
34
|
-
Style/SignalException:
|
|
35
|
-
Enabled: false
|
|
36
|
-
|
|
37
|
-
Style/SpaceAroundEqualsInParameterDefault:
|
|
38
|
-
Enabled: false
|
|
39
|
-
|
|
40
|
-
Style/StringLiterals:
|
|
41
|
-
Enabled: false
|
|
42
|
-
|
|
43
|
-
Style/ZeroLengthPredicate:
|
|
44
|
-
Enabled: false
|
|
45
|
-
|
|
46
|
-
# Offense count: 9
|
|
47
|
-
Metrics/AbcSize:
|
|
48
|
-
Enabled: false
|
|
49
|
-
|
|
50
|
-
# Offense count: 1
|
|
51
|
-
# Configuration parameters: CountComments.
|
|
52
|
-
Metrics/ClassLength:
|
|
53
|
-
Enabled: false
|
|
54
|
-
|
|
55
|
-
# Offense count: 2
|
|
56
|
-
Metrics/CyclomaticComplexity:
|
|
57
|
-
Enabled: false
|
|
58
|
-
|
|
59
|
-
# Offense count: 79
|
|
60
|
-
# Configuration parameters: AllowURI, URISchemes.
|
|
61
|
-
Metrics/LineLength:
|
|
62
|
-
Enabled: false
|
|
63
|
-
|
|
64
|
-
# Offense count: 10
|
|
65
|
-
# Configuration parameters: CountComments.
|
|
66
|
-
Metrics/MethodLength:
|
|
67
|
-
Enabled: false
|
|
68
|
-
|
|
69
|
-
# Offense count: 2
|
|
70
|
-
Metrics/PerceivedComplexity:
|
|
71
|
-
Enabled: false
|