barsoom_utils 0.2.0.65 → 0.2.0.68
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 +1 -2
- data/VERSION +1 -1
- data/lib/barsoom_utils/feature_toggle.rb +8 -28
- data/shared_rubocop.yml +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d6916857f234c7a9b12f2a3a976a7221723de1fca3f6f8fe3d5b9dd37698e23
|
|
4
|
+
data.tar.gz: 7cfe75d61e28721f7cceac8e0b41431965eb4b58cc85e6158ffb42fc11ffd3e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0f2354720fb697f824d41fed01c46f9c1f1047b9cff03d9ecc04514ecc90664867117d491ee322cf8cc1655b650e47fb812d32e6e900f3f2361defa0c1105061
|
|
7
|
+
data.tar.gz: 288d4a96988eab093e06e0d588abddd503fb6a7047528747f95da7e1956bf55a04d1c14e98ccdb5e10463ff208a7076958a70315c18bdd94b53b609b53621281
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -17,7 +17,6 @@ jobs:
|
|
|
17
17
|
- "4.0"
|
|
18
18
|
- "3.4"
|
|
19
19
|
- "3.3"
|
|
20
|
-
- "3.2"
|
|
21
20
|
steps:
|
|
22
21
|
- uses: actions/checkout@v6
|
|
23
22
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
@@ -45,7 +44,7 @@ jobs:
|
|
|
45
44
|
mkdir -p $HOME/.gem
|
|
46
45
|
touch $HOME/.gem/credentials
|
|
47
46
|
chmod 0600 $HOME/.gem/credentials
|
|
48
|
-
printf --
|
|
47
|
+
printf -- '---\n:rubygems_api_key: %s\n' "$RUBYGEMS_API_KEY" > "$HOME/.gem/credentials"
|
|
49
48
|
sed -i "1s/.*/&.${GITHUB_RUN_NUMBER}/" VERSION # Add build number to version
|
|
50
49
|
gem build *.gemspec
|
|
51
50
|
gem push *.gem
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.0.
|
|
1
|
+
0.2.0.68
|
|
@@ -11,9 +11,7 @@ module BarsoomUtils
|
|
|
11
11
|
@redis = redis
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def self.redis
|
|
15
|
-
@redis || $redis
|
|
16
|
-
end
|
|
14
|
+
def self.redis = @redis || $redis
|
|
17
15
|
|
|
18
16
|
def self.on?(feature, controller_or_view = nil, redis: self.redis)
|
|
19
17
|
new(feature, controller_or_view: controller_or_view, redis: redis).on?
|
|
@@ -23,17 +21,9 @@ module BarsoomUtils
|
|
|
23
21
|
new(feature, controller_or_view: controller_or_view, redis: redis).off?
|
|
24
22
|
end
|
|
25
23
|
|
|
26
|
-
def self.turn_on(feature, redis: self.redis)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def self.turn_off(feature, redis: self.redis)
|
|
31
|
-
new(feature, redis: redis).turn_off
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def self.list
|
|
35
|
-
redis.smembers(REDIS_KEY).sort
|
|
36
|
-
end
|
|
24
|
+
def self.turn_on(feature, redis: self.redis) = new(feature, redis: redis).turn_on
|
|
25
|
+
def self.turn_off(feature, redis: self.redis) = new(feature, redis: redis).turn_off
|
|
26
|
+
def self.list = redis.smembers(REDIS_KEY).sort
|
|
37
27
|
|
|
38
28
|
pattr_initialize :feature_name, [ :controller_or_view, :redis ]
|
|
39
29
|
|
|
@@ -45,9 +35,7 @@ module BarsoomUtils
|
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
37
|
|
|
48
|
-
def off?
|
|
49
|
-
not on?
|
|
50
|
-
end
|
|
38
|
+
def off? = not on?
|
|
51
39
|
|
|
52
40
|
def turn_off
|
|
53
41
|
if redis.respond_to?(:sadd?)
|
|
@@ -76,16 +64,8 @@ module BarsoomUtils
|
|
|
76
64
|
value == "true"
|
|
77
65
|
end
|
|
78
66
|
|
|
79
|
-
def on_according_to_redis?
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def redis
|
|
84
|
-
@redis || self.class.redis
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def feature_name
|
|
88
|
-
@feature_name.to_s
|
|
89
|
-
end
|
|
67
|
+
def on_according_to_redis? = not redis.sismember(REDIS_KEY, feature_name)
|
|
68
|
+
def redis = @redis || self.class.redis
|
|
69
|
+
def feature_name = @feature_name.to_s
|
|
90
70
|
end
|
|
91
71
|
end
|
data/shared_rubocop.yml
CHANGED
|
@@ -275,7 +275,11 @@ Layout/IndentationConsistency:
|
|
|
275
275
|
Layout/MultilineAssignmentLayout:
|
|
276
276
|
Enabled: true
|
|
277
277
|
SupportedTypes:
|
|
278
|
+
- case
|
|
279
|
+
- class
|
|
278
280
|
- if
|
|
281
|
+
- kwbegin
|
|
282
|
+
- module
|
|
279
283
|
|
|
280
284
|
# Indent the first line of a multiline assignment (i.e. the line directly after the =) one step
|
|
281
285
|
# https://docs.rubocop.org/rubocop/cops_layout.html#layoutassignmentindentation
|
|
@@ -292,6 +296,12 @@ Layout/ElseAlignment:
|
|
|
292
296
|
Layout/EndAlignment:
|
|
293
297
|
Enabled: true
|
|
294
298
|
|
|
299
|
+
Layout/BeginEndAlignment:
|
|
300
|
+
Enabled: true
|
|
301
|
+
|
|
302
|
+
Layout/RescueEnsureAlignment:
|
|
303
|
+
Enabled: true
|
|
304
|
+
|
|
295
305
|
# https://docs.rubocop.org/rubocop/cops_layout.html#layoutclassstructure
|
|
296
306
|
# https://github.com/barsoom/devbook/tree/master/styleguide#use-a-consistent-class-layout
|
|
297
307
|
# AutoCorrect: false because it has a tendency to make private delegates public, and it messes up whitespace
|