flipper 0.16.2 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +5 -8
- data/.rubocop_todo.yml +452 -89
- data/Changelog.md +25 -2
- data/Gemfile +15 -17
- data/README.md +1 -1
- data/Rakefile +13 -2
- data/docs/Caveats.md +1 -1
- data/docs/api/README.md +3 -3
- data/flipper.gemspec +4 -4
- data/lib/flipper/adapters/http/client.rb +12 -0
- data/lib/flipper/adapters/instrumented.rb +20 -18
- data/lib/flipper/adapters/memory.rb +1 -1
- data/lib/flipper/feature.rb +1 -2
- data/lib/flipper/spec/shared_adapter_specs.rb +10 -1
- data/lib/flipper/test/shared_adapter_test.rb +11 -1
- data/lib/flipper/types/group.rb +1 -1
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/adapters/http_spec.rb +1 -0
- data/spec/flipper/adapters/instrumented_spec.rb +2 -0
- data/spec/flipper/feature_check_context_spec.rb +2 -2
- data/spec/flipper/feature_spec.rb +3 -3
- data/spec/flipper/types/group_spec.rb +22 -0
- data/{test → test_rails}/helper.rb +1 -1
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: df515c2e52128d5b5508b4aa16799850313e11cc519d5a21894f2d968d5de19c
|
4
|
+
data.tar.gz: 5747f267aad32feb4a7b63207905f74096fd4f2a2b7037bed5909b4b37446586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eef86eef8bcd970d5f4e96daa3f7c4296a74cec026ba94a1d8c9679ef50cb9515c490d0b3bd1479a780f3c98f115c1023f2c5ed9f216230ebba1c0ca402e89f6
|
7
|
+
data.tar.gz: 6fa04470cdf9e5c3b53b7489dff534780e6a8855ffb8fb6fdd74017caf392c7955fe45d18f209054eca7f26d35747d34719fee895e35a8877485adc6edd6083b
|
data/.rubocop.yml
CHANGED
@@ -11,8 +11,7 @@ AllCops:
|
|
11
11
|
- 'tmp/**/*'
|
12
12
|
- 'bin/**/*'
|
13
13
|
- 'vendor/bundle/**/*'
|
14
|
-
TargetRubyVersion: 2.
|
15
|
-
# DefaultFormatter: fuubar
|
14
|
+
TargetRubyVersion: 2.6
|
16
15
|
Style/Alias:
|
17
16
|
Enabled: false
|
18
17
|
|
@@ -36,19 +35,17 @@ Style/IfUnlessModifier:
|
|
36
35
|
|
37
36
|
Metrics/LineLength:
|
38
37
|
Max: 100
|
39
|
-
Exclude:
|
40
|
-
- '*.gemspec'
|
41
38
|
|
42
39
|
Style/RegexpLiteral:
|
43
40
|
EnforcedStyle: mixed
|
44
41
|
|
45
|
-
Style/
|
42
|
+
Style/TrailingCommaInArrayLiteral:
|
46
43
|
EnforcedStyleForMultiline: consistent_comma
|
47
44
|
|
48
|
-
|
49
|
-
|
45
|
+
Style/TrailingCommaInHashLiteral:
|
46
|
+
EnforcedStyleForMultiline: consistent_comma
|
50
47
|
|
51
|
-
|
48
|
+
RSpec/InstanceVariable:
|
52
49
|
Enabled: false
|
53
50
|
|
54
51
|
Lint/HandleExceptions:
|
data/.rubocop_todo.yml
CHANGED
@@ -1,17 +1,100 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2019-09-13 08:34:35 -0400 using RuboCop version 0.74.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
|
9
|
+
# Offense count: 6
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
12
|
+
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
13
|
+
Bundler/OrderedGems:
|
14
|
+
Exclude:
|
15
|
+
- 'Gemfile'
|
16
|
+
|
17
|
+
# Offense count: 6
|
18
|
+
# Cop supports --auto-correct.
|
19
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
20
|
+
# Include: **/*.gemspec
|
21
|
+
Gemspec/OrderedDependencies:
|
22
|
+
Exclude:
|
23
|
+
- 'flipper-active_record.gemspec'
|
24
|
+
- 'flipper-active_support_cache_store.gemspec'
|
25
|
+
- 'flipper-api.gemspec'
|
26
|
+
- 'flipper-dalli.gemspec'
|
27
|
+
- 'flipper-ui.gemspec'
|
28
|
+
|
29
|
+
# Offense count: 4
|
30
|
+
# Cop supports --auto-correct.
|
31
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
32
|
+
# SupportedHashRocketStyles: key, separator, table
|
33
|
+
# SupportedColonStyles: key, separator, table
|
34
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
35
|
+
Layout/AlignHash:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/flipper/typecast.rb'
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
# Cop supports --auto-correct.
|
41
|
+
Layout/ClosingHeredocIndentation:
|
42
|
+
Exclude:
|
43
|
+
- 'test/generators/flipper/active_record_generator_test.rb'
|
44
|
+
|
45
|
+
# Offense count: 8
|
46
|
+
# Cop supports --auto-correct.
|
47
|
+
Layout/EmptyLineAfterGuardClause:
|
48
|
+
Exclude:
|
49
|
+
- 'lib/flipper/adapters/sync/feature_synchronizer.rb'
|
50
|
+
- 'lib/flipper/api/json_params.rb'
|
51
|
+
- 'lib/flipper/api/v1/actions/feature.rb'
|
52
|
+
- 'lib/flipper/type.rb'
|
53
|
+
- 'lib/flipper/types/actor.rb'
|
54
|
+
- 'lib/flipper/types/group.rb'
|
55
|
+
- 'lib/flipper/ui/action.rb'
|
56
|
+
|
57
|
+
# Offense count: 12
|
58
|
+
# Cop supports --auto-correct.
|
59
|
+
Layout/EmptyLineAfterMagicComment:
|
60
|
+
Exclude:
|
61
|
+
- 'flipper-active_record.gemspec'
|
62
|
+
- 'flipper-active_support_cache_store.gemspec'
|
63
|
+
- 'flipper-api.gemspec'
|
64
|
+
- 'flipper-cloud.gemspec'
|
65
|
+
- 'flipper-dalli.gemspec'
|
66
|
+
- 'flipper-moneta.gemspec'
|
67
|
+
- 'flipper-mongo.gemspec'
|
68
|
+
- 'flipper-redis.gemspec'
|
69
|
+
- 'flipper-rollout.gemspec'
|
70
|
+
- 'flipper-sequel.gemspec'
|
71
|
+
- 'flipper-ui.gemspec'
|
72
|
+
- 'flipper.gemspec'
|
73
|
+
|
74
|
+
# Offense count: 1
|
75
|
+
# Cop supports --auto-correct.
|
76
|
+
Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
77
|
+
Exclude:
|
78
|
+
- 'test/adapters/active_record_test.rb'
|
79
|
+
|
80
|
+
# Offense count: 1
|
81
|
+
# Cop supports --auto-correct.
|
82
|
+
# Configuration parameters: EnforcedStyle.
|
83
|
+
# SupportedStyles: squiggly, active_support, powerpack, unindent
|
84
|
+
Layout/IndentHeredoc:
|
85
|
+
Exclude:
|
86
|
+
- 'test/generators/flipper/active_record_generator_test.rb'
|
10
87
|
|
11
88
|
# Offense count: 2
|
89
|
+
# Cop supports --auto-correct.
|
90
|
+
Layout/RescueEnsureAlignment:
|
91
|
+
Exclude:
|
92
|
+
- 'lib/flipper/api/v1/actions/percentage_of_actors_gate.rb'
|
93
|
+
- 'lib/flipper/api/v1/actions/percentage_of_time_gate.rb'
|
94
|
+
|
95
|
+
# Offense count: 1
|
12
96
|
Lint/AmbiguousRegexpLiteral:
|
13
97
|
Exclude:
|
14
|
-
- 'lib/flipper/instrumentation/metriks.rb'
|
15
98
|
- 'lib/flipper/instrumentation/statsd.rb'
|
16
99
|
|
17
100
|
# Offense count: 6
|
@@ -23,24 +106,29 @@ Lint/AssignmentInCondition:
|
|
23
106
|
- 'lib/flipper/feature.rb'
|
24
107
|
- 'lib/flipper/gate_values.rb'
|
25
108
|
|
26
|
-
# Offense count:
|
27
|
-
Lint/
|
109
|
+
# Offense count: 2
|
110
|
+
Lint/DuplicateMethods:
|
28
111
|
Exclude:
|
29
|
-
- 'flipper.
|
112
|
+
- 'lib/flipper/ui.rb'
|
113
|
+
- 'lib/flipper/ui/configuration.rb'
|
30
114
|
|
31
115
|
# Offense count: 3
|
32
|
-
|
116
|
+
# Configuration parameters: MaximumRangeSize.
|
117
|
+
Lint/MissingCopEnableDirective:
|
118
|
+
Exclude:
|
119
|
+
- 'lib/flipper/feature.rb'
|
120
|
+
- 'lib/flipper/spec/shared_adapter_specs.rb'
|
121
|
+
- 'lib/flipper/test/shared_adapter_test.rb'
|
122
|
+
|
123
|
+
# Offense count: 1
|
124
|
+
# Cop supports --auto-correct.
|
125
|
+
Lint/ScriptPermission:
|
33
126
|
Exclude:
|
34
|
-
- '
|
35
|
-
- 'test/adapters/mongo_test.rb'
|
36
|
-
- 'test/helper.rb'
|
127
|
+
- 'Rakefile'
|
37
128
|
|
38
|
-
# Offense count:
|
129
|
+
# Offense count: 21
|
39
130
|
Lint/ShadowingOuterLocalVariable:
|
40
131
|
Exclude:
|
41
|
-
- 'lib/flipper/adapters/active_record.rb'
|
42
|
-
- 'lib/flipper/adapters/instrumented.rb'
|
43
|
-
- 'lib/flipper/adapters/sequel.rb'
|
44
132
|
- 'spec/flipper/api/v1/actions/actors_gate_spec.rb'
|
45
133
|
- 'spec/flipper/api/v1/actions/percentage_of_actors_gate_spec.rb'
|
46
134
|
- 'spec/flipper/api/v1/actions/percentage_of_time_gate_spec.rb'
|
@@ -48,70 +136,259 @@ Lint/ShadowingOuterLocalVariable:
|
|
48
136
|
- 'spec/flipper/feature_spec.rb'
|
49
137
|
- 'spec/flipper/types/group_spec.rb'
|
50
138
|
|
51
|
-
# Offense count:
|
139
|
+
# Offense count: 2
|
140
|
+
# Cop supports --auto-correct.
|
141
|
+
Lint/UnneededCopDisableDirective:
|
142
|
+
Exclude:
|
143
|
+
- 'spec/flipper/adapter_spec.rb'
|
144
|
+
|
145
|
+
# Offense count: 1
|
146
|
+
# Cop supports --auto-correct.
|
147
|
+
Lint/UnneededRequireStatement:
|
148
|
+
Exclude:
|
149
|
+
- 'lib/flipper/registry.rb'
|
150
|
+
|
151
|
+
# Offense count: 27
|
52
152
|
Lint/UselessAssignment:
|
53
153
|
Exclude:
|
54
154
|
- 'lib/flipper/instrumentation/log_subscriber.rb'
|
55
155
|
- 'lib/flipper/instrumentation/subscriber.rb'
|
56
|
-
- 'lib/flipper/ui/actions/groups_gate.rb'
|
57
156
|
- 'spec/flipper/api/action_spec.rb'
|
58
157
|
- 'spec/flipper/dsl_spec.rb'
|
59
158
|
- 'spec/flipper/feature_spec.rb'
|
60
159
|
- 'spec/flipper/gates/group_spec.rb'
|
61
|
-
- 'spec/flipper/instrumentation/metriks_subscriber_spec.rb'
|
62
160
|
- 'spec/flipper/instrumentation/statsd_subscriber_spec.rb'
|
63
|
-
- 'spec/flipper_spec.rb'
|
64
161
|
- 'spec/flipper/middleware/memoizer_spec.rb'
|
65
|
-
- '
|
162
|
+
- 'spec/flipper_spec.rb'
|
66
163
|
|
67
|
-
# Offense count:
|
164
|
+
# Offense count: 35
|
68
165
|
Metrics/AbcSize:
|
69
|
-
Max:
|
166
|
+
Max: 29
|
70
167
|
|
71
|
-
# Offense count:
|
72
|
-
# Configuration parameters: CountComments.
|
168
|
+
# Offense count: 136
|
169
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
170
|
+
# ExcludedMethods: refine
|
73
171
|
Metrics/BlockLength:
|
74
|
-
Max:
|
172
|
+
Max: 683
|
75
173
|
|
76
|
-
# Offense count:
|
174
|
+
# Offense count: 11
|
77
175
|
# Configuration parameters: CountComments.
|
78
176
|
Metrics/ClassLength:
|
79
|
-
Max:
|
177
|
+
Max: 150
|
80
178
|
|
81
|
-
# Offense count:
|
82
|
-
#
|
179
|
+
# Offense count: 20
|
180
|
+
# Cop supports --auto-correct.
|
181
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
182
|
+
# URISchemes: http, https
|
183
|
+
Metrics/LineLength:
|
184
|
+
Max: 251
|
185
|
+
|
186
|
+
# Offense count: 59
|
187
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
83
188
|
Metrics/MethodLength:
|
84
189
|
Max: 23
|
85
190
|
|
86
|
-
# Offense count:
|
191
|
+
# Offense count: 18
|
192
|
+
Naming/AccessorMethodName:
|
193
|
+
Enabled: false
|
194
|
+
|
195
|
+
# Offense count: 25
|
196
|
+
Naming/ConstantName:
|
197
|
+
Exclude:
|
198
|
+
- 'lib/flipper.rb'
|
199
|
+
- 'lib/flipper/adapters/active_support_cache_store.rb'
|
200
|
+
- 'lib/flipper/adapters/dalli.rb'
|
201
|
+
- 'lib/flipper/adapters/instrumented.rb'
|
202
|
+
- 'lib/flipper/adapters/memoizable.rb'
|
203
|
+
- 'lib/flipper/adapters/memory.rb'
|
204
|
+
- 'lib/flipper/adapters/mongo.rb'
|
205
|
+
- 'lib/flipper/adapters/operation_logger.rb'
|
206
|
+
- 'lib/flipper/adapters/pstore.rb'
|
207
|
+
- 'lib/flipper/adapters/redis.rb'
|
208
|
+
- 'lib/flipper/adapters/redis_cache.rb'
|
209
|
+
- 'lib/flipper/feature.rb'
|
210
|
+
- 'lib/flipper/gate_values.rb'
|
211
|
+
- 'lib/flipper/typecast.rb'
|
212
|
+
- 'lib/flipper/ui/decorators/feature.rb'
|
213
|
+
|
214
|
+
# Offense count: 9
|
215
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
216
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
217
|
+
Naming/FileName:
|
218
|
+
Exclude:
|
219
|
+
- 'lib/flipper-active_record.rb'
|
220
|
+
- 'lib/flipper-active_support_cache_store.rb'
|
221
|
+
- 'lib/flipper-api.rb'
|
222
|
+
- 'lib/flipper-cloud.rb'
|
223
|
+
- 'lib/flipper-dalli.rb'
|
224
|
+
- 'lib/flipper-mongo.rb'
|
225
|
+
- 'lib/flipper-redis.rb'
|
226
|
+
- 'lib/flipper-sequel.rb'
|
227
|
+
- 'lib/flipper-ui.rb'
|
228
|
+
|
229
|
+
# Offense count: 1
|
230
|
+
# Configuration parameters: Blacklist.
|
231
|
+
# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
232
|
+
Naming/HeredocDelimiterNaming:
|
233
|
+
Exclude:
|
234
|
+
- 'test/generators/flipper/active_record_generator_test.rb'
|
235
|
+
|
236
|
+
# Offense count: 4
|
237
|
+
# Cop supports --auto-correct.
|
238
|
+
# Configuration parameters: PreferredName.
|
239
|
+
Naming/RescuedExceptionsVariableName:
|
240
|
+
Exclude:
|
241
|
+
- 'lib/flipper/adapters/active_record.rb'
|
242
|
+
- 'lib/flipper/adapters/sync/synchronizer.rb'
|
243
|
+
- 'lib/flipper/ui/actions/percentage_of_actors_gate.rb'
|
244
|
+
- 'lib/flipper/ui/actions/percentage_of_time_gate.rb'
|
245
|
+
|
246
|
+
# Offense count: 3
|
247
|
+
RSpec/BeforeAfterAll:
|
248
|
+
Exclude:
|
249
|
+
- 'spec/spec_helper.rb'
|
250
|
+
- 'spec/rails_helper.rb'
|
251
|
+
- 'spec/support/**/*.rb'
|
252
|
+
- 'spec/flipper/adapters/active_record_spec.rb'
|
253
|
+
- 'spec/flipper/adapters/http_spec.rb'
|
254
|
+
|
255
|
+
# Offense count: 76
|
256
|
+
# Configuration parameters: Prefixes.
|
257
|
+
# Prefixes: when, with, without
|
258
|
+
RSpec/ContextWording:
|
259
|
+
Enabled: false
|
260
|
+
|
261
|
+
# Offense count: 1
|
262
|
+
# Configuration parameters: CustomIncludeMethods.
|
263
|
+
RSpec/EmptyExampleGroup:
|
264
|
+
Exclude:
|
265
|
+
- 'spec/flipper/gates/actor_spec.rb'
|
266
|
+
|
267
|
+
# Offense count: 3
|
268
|
+
# Cop supports --auto-correct.
|
269
|
+
RSpec/EmptyLineAfterFinalLet:
|
270
|
+
Exclude:
|
271
|
+
- 'spec/flipper/adapters/moneta_spec.rb'
|
272
|
+
- 'spec/flipper/ui/actions/features_spec.rb'
|
273
|
+
|
274
|
+
# Offense count: 2
|
275
|
+
# Cop supports --auto-correct.
|
276
|
+
RSpec/EmptyLineAfterSubject:
|
277
|
+
Exclude:
|
278
|
+
- 'spec/flipper/adapters/http_spec.rb'
|
279
|
+
- 'spec/flipper/types/percentage_spec.rb'
|
280
|
+
|
281
|
+
# Offense count: 138
|
87
282
|
# Configuration parameters: Max.
|
88
283
|
RSpec/ExampleLength:
|
89
284
|
Enabled: false
|
90
285
|
|
91
|
-
# Offense count:
|
92
|
-
# Configuration parameters: CustomTransform.
|
286
|
+
# Offense count: 1
|
287
|
+
# Configuration parameters: CustomTransform, IgnoreMethods.
|
93
288
|
RSpec/FilePath:
|
94
289
|
Exclude:
|
95
290
|
- 'spec/flipper/adapters/pstore_spec.rb'
|
96
|
-
- 'spec/integration_spec.rb'
|
97
291
|
|
98
|
-
# Offense count:
|
99
|
-
|
292
|
+
# Offense count: 6
|
293
|
+
# Cop supports --auto-correct.
|
294
|
+
# Configuration parameters: EnforcedStyle.
|
295
|
+
# SupportedStyles: implicit, each, example
|
296
|
+
RSpec/HookArgument:
|
297
|
+
Exclude:
|
298
|
+
- 'spec/flipper/adapters/active_record_spec.rb'
|
299
|
+
- 'spec/flipper/adapters/http_spec.rb'
|
300
|
+
- 'spec/flipper/adapters/sequel_spec.rb'
|
301
|
+
- 'spec/helper.rb'
|
302
|
+
|
303
|
+
# Offense count: 4
|
304
|
+
# Cop supports --auto-correct.
|
305
|
+
RSpec/HooksBeforeExamples:
|
306
|
+
Exclude:
|
307
|
+
- 'spec/flipper/ui_spec.rb'
|
308
|
+
|
309
|
+
# Offense count: 22
|
310
|
+
# Cop supports --auto-correct.
|
311
|
+
# Configuration parameters: EnforcedStyle.
|
312
|
+
# SupportedStyles: it_behaves_like, it_should_behave_like
|
313
|
+
RSpec/ItBehavesLike:
|
314
|
+
Enabled: false
|
315
|
+
|
316
|
+
# Offense count: 4
|
317
|
+
RSpec/IteratedExpectation:
|
100
318
|
Exclude:
|
101
|
-
- 'spec/flipper/adapters/operation_logger_spec.rb'
|
102
319
|
- 'spec/flipper/dsl_spec.rb'
|
103
320
|
- 'spec/flipper/feature_spec.rb'
|
104
|
-
- 'spec/flipper/
|
105
|
-
- 'spec/flipper/
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
321
|
+
- 'spec/flipper/gates/percentage_of_actors_spec.rb'
|
322
|
+
- 'spec/flipper/registry_spec.rb'
|
323
|
+
|
324
|
+
# Offense count: 26
|
325
|
+
# Cop supports --auto-correct.
|
326
|
+
RSpec/LeadingSubject:
|
327
|
+
Enabled: false
|
328
|
+
|
329
|
+
# Offense count: 17
|
330
|
+
# Configuration parameters: .
|
331
|
+
# SupportedStyles: have_received, receive
|
332
|
+
RSpec/MessageSpies:
|
333
|
+
EnforcedStyle: receive
|
334
|
+
|
335
|
+
# Offense count: 233
|
336
|
+
# Configuration parameters: AggregateFailuresByDefault.
|
337
|
+
RSpec/MultipleExpectations:
|
338
|
+
Max: 20
|
339
|
+
|
340
|
+
# Offense count: 449
|
341
|
+
# Configuration parameters: IgnoreSharedExamples.
|
342
|
+
RSpec/NamedSubject:
|
343
|
+
Enabled: false
|
344
|
+
|
345
|
+
# Offense count: 25
|
346
|
+
RSpec/NestedGroups:
|
347
|
+
Max: 5
|
348
|
+
|
349
|
+
# Offense count: 19
|
350
|
+
# Cop supports --auto-correct.
|
351
|
+
# Configuration parameters: Strict, EnforcedStyle.
|
352
|
+
# SupportedStyles: inflected, explicit
|
353
|
+
RSpec/PredicateMatcher:
|
354
|
+
Exclude:
|
355
|
+
- 'spec/flipper/api/v1/actions/actors_gate_spec.rb'
|
356
|
+
- 'spec/flipper/api/v1/actions/boolean_gate_spec.rb'
|
357
|
+
- 'spec/flipper/api/v1/actions/clear_feature_spec.rb'
|
358
|
+
- 'spec/flipper/api/v1/actions/features_spec.rb'
|
359
|
+
- 'spec/flipper/api/v1/actions/groups_gate_spec.rb'
|
360
|
+
- 'spec/flipper/types/group_spec.rb'
|
361
|
+
|
362
|
+
# Offense count: 1
|
363
|
+
# Cop supports --auto-correct.
|
364
|
+
RSpec/ReceiveNever:
|
365
|
+
Exclude:
|
366
|
+
- 'spec/flipper/middleware/memoizer_spec.rb'
|
367
|
+
|
368
|
+
# Offense count: 2
|
369
|
+
RSpec/RepeatedDescription:
|
370
|
+
Exclude:
|
371
|
+
- 'spec/flipper/gates/boolean_spec.rb'
|
372
|
+
|
373
|
+
# Offense count: 4
|
374
|
+
RSpec/RepeatedExample:
|
375
|
+
Exclude:
|
376
|
+
- 'spec/flipper/cloud_spec.rb'
|
111
377
|
- 'spec/integration_spec.rb'
|
112
378
|
|
113
|
-
# Offense count:
|
114
|
-
|
379
|
+
# Offense count: 2
|
380
|
+
RSpec/ScatteredLet:
|
381
|
+
Exclude:
|
382
|
+
- 'spec/flipper/adapters/http_spec.rb'
|
383
|
+
- 'spec/flipper/instrumentation/log_subscriber_spec.rb'
|
384
|
+
|
385
|
+
# Offense count: 4
|
386
|
+
RSpec/SubjectStub:
|
387
|
+
Exclude:
|
388
|
+
- 'spec/flipper/adapters/sync_spec.rb'
|
389
|
+
|
390
|
+
# Offense count: 17
|
391
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
115
392
|
RSpec/VerifiedDoubles:
|
116
393
|
Exclude:
|
117
394
|
- 'spec/flipper/api/v1/actions/features_spec.rb'
|
@@ -121,22 +398,24 @@ RSpec/VerifiedDoubles:
|
|
121
398
|
- 'spec/flipper_spec.rb'
|
122
399
|
- 'spec/integration_spec.rb'
|
123
400
|
|
124
|
-
# Offense count:
|
125
|
-
|
401
|
+
# Offense count: 1
|
402
|
+
Security/Eval:
|
126
403
|
Exclude:
|
127
|
-
- '
|
128
|
-
- 'lib/flipper/adapters/pstore.rb'
|
404
|
+
- 'flipper.gemspec'
|
129
405
|
|
130
|
-
# Offense count:
|
131
|
-
|
406
|
+
# Offense count: 5
|
407
|
+
Security/MarshalLoad:
|
132
408
|
Exclude:
|
133
|
-
- 'lib/flipper.rb'
|
134
|
-
- '
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
409
|
+
- 'lib/flipper/adapters/redis_cache.rb'
|
410
|
+
- 'spec/flipper/adapters/redis_cache_spec.rb'
|
411
|
+
|
412
|
+
# Offense count: 2
|
413
|
+
# Configuration parameters: EnforcedStyle.
|
414
|
+
# SupportedStyles: inline, group
|
415
|
+
Style/AccessModifierDeclarations:
|
416
|
+
Exclude:
|
417
|
+
- 'lib/flipper/api/action.rb'
|
418
|
+
- 'lib/flipper/ui/action.rb'
|
140
419
|
|
141
420
|
# Offense count: 3
|
142
421
|
Style/DoubleNegation:
|
@@ -145,55 +424,139 @@ Style/DoubleNegation:
|
|
145
424
|
- 'lib/flipper/gates/boolean.rb'
|
146
425
|
- 'lib/flipper/typecast.rb'
|
147
426
|
|
148
|
-
# Offense count:
|
149
|
-
#
|
150
|
-
Style/
|
427
|
+
# Offense count: 1
|
428
|
+
# Cop supports --auto-correct.
|
429
|
+
Style/EmptyLambdaParameter:
|
151
430
|
Exclude:
|
152
|
-
- 'lib/flipper
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
- 'lib/flipper
|
431
|
+
- 'lib/flipper/ui.rb'
|
432
|
+
|
433
|
+
# Offense count: 1
|
434
|
+
# Cop supports --auto-correct.
|
435
|
+
# Configuration parameters: EnforcedStyle.
|
436
|
+
# SupportedStyles: compact, expanded
|
437
|
+
Style/EmptyMethod:
|
438
|
+
Exclude:
|
439
|
+
- 'lib/flipper/gate.rb'
|
440
|
+
|
441
|
+
# Offense count: 27
|
442
|
+
# Cop supports --auto-correct.
|
443
|
+
Style/ExpandPathArguments:
|
444
|
+
Enabled: false
|
161
445
|
|
162
446
|
# Offense count: 2
|
163
|
-
#
|
447
|
+
# Cop supports --auto-correct.
|
448
|
+
# Configuration parameters: EnforcedStyle.
|
164
449
|
# SupportedStyles: format, sprintf, percent
|
165
450
|
Style/FormatString:
|
166
451
|
Exclude:
|
167
452
|
- 'lib/flipper/instrumentation/log_subscriber.rb'
|
168
453
|
|
169
|
-
# Offense count:
|
170
|
-
# Configuration parameters:
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
454
|
+
# Offense count: 2
|
455
|
+
# Configuration parameters: .
|
456
|
+
# SupportedStyles: annotated, template, unannotated
|
457
|
+
Style/FormatStringToken:
|
458
|
+
EnforcedStyle: unannotated
|
459
|
+
|
460
|
+
# Offense count: 219
|
461
|
+
# Cop supports --auto-correct.
|
462
|
+
# Configuration parameters: EnforcedStyle.
|
463
|
+
# SupportedStyles: always, never
|
464
|
+
Style/FrozenStringLiteralComment:
|
465
|
+
Enabled: false
|
180
466
|
|
181
467
|
# Offense count: 1
|
468
|
+
# Configuration parameters: AllowIfModifier.
|
182
469
|
Style/IfInsideElse:
|
183
470
|
Exclude:
|
184
471
|
- 'lib/flipper/gates/actor.rb'
|
185
472
|
|
186
473
|
# Offense count: 1
|
187
|
-
Style/
|
474
|
+
Style/MethodMissingSuper:
|
188
475
|
Exclude:
|
189
476
|
- 'lib/flipper/types/actor.rb'
|
190
477
|
|
191
|
-
|
478
|
+
# Offense count: 1
|
479
|
+
Style/MissingRespondToMissing:
|
192
480
|
Exclude:
|
193
|
-
- 'lib/flipper/
|
194
|
-
|
195
|
-
|
196
|
-
|
481
|
+
- 'lib/flipper/types/actor.rb'
|
482
|
+
|
483
|
+
# Offense count: 1
|
484
|
+
# Cop supports --auto-correct.
|
485
|
+
# Configuration parameters: EnforcedStyle.
|
486
|
+
# SupportedStyles: literals, strict
|
487
|
+
Style/MutableConstant:
|
488
|
+
Exclude:
|
489
|
+
- 'lib/flipper/ui/util.rb'
|
490
|
+
|
491
|
+
# Offense count: 5
|
492
|
+
# Cop supports --auto-correct.
|
493
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
494
|
+
# SupportedStyles: predicate, comparison
|
495
|
+
Style/NumericPredicate:
|
496
|
+
Exclude:
|
497
|
+
- 'spec/**/*'
|
498
|
+
- 'lib/flipper/api/v1/actions/percentage_of_actors_gate.rb'
|
499
|
+
- 'lib/flipper/api/v1/actions/percentage_of_time_gate.rb'
|
500
|
+
- 'lib/flipper/gates/percentage_of_actors.rb'
|
501
|
+
- 'lib/flipper/gates/percentage_of_time.rb'
|
502
|
+
- 'lib/flipper/types/percentage.rb'
|
503
|
+
|
504
|
+
# Offense count: 34
|
505
|
+
# Cop supports --auto-correct.
|
506
|
+
# Configuration parameters: PreferredDelimiters.
|
507
|
+
Style/PercentLiteralDelimiters:
|
508
|
+
Exclude:
|
509
|
+
- 'Rakefile'
|
510
|
+
- 'lib/flipper/spec/shared_adapter_specs.rb'
|
511
|
+
- 'lib/flipper/test/shared_adapter_test.rb'
|
512
|
+
- 'lib/flipper/ui.rb'
|
513
|
+
- 'lib/flipper/ui/configuration.rb'
|
514
|
+
- 'spec/flipper/adapter_spec.rb'
|
515
|
+
- 'spec/flipper/adapters/http_spec.rb'
|
516
|
+
- 'spec/flipper/adapters/memoizable_spec.rb'
|
517
|
+
- 'spec/flipper/adapters/sync/synchronizer_spec.rb'
|
518
|
+
- 'spec/flipper/adapters/sync_spec.rb'
|
519
|
+
- 'spec/flipper/api/v1/actions/features_spec.rb'
|
520
|
+
- 'spec/flipper/api_spec.rb'
|
521
|
+
- 'spec/flipper/dsl_spec.rb'
|
522
|
+
- 'spec/flipper/middleware/memoizer_spec.rb'
|
523
|
+
- 'spec/flipper/registry_spec.rb'
|
524
|
+
|
525
|
+
# Offense count: 3
|
526
|
+
# Cop supports --auto-correct.
|
527
|
+
Style/RedundantBegin:
|
528
|
+
Exclude:
|
529
|
+
- 'spec/flipper/middleware/memoizer_spec.rb'
|
530
|
+
- 'spec/flipper/ui/actions/feature_spec.rb'
|
531
|
+
- 'spec/flipper/ui_spec.rb'
|
532
|
+
|
533
|
+
# Offense count: 2
|
534
|
+
# Cop supports --auto-correct.
|
535
|
+
# Configuration parameters: EnforcedStyle.
|
536
|
+
# SupportedStyles: implicit, explicit
|
537
|
+
Style/RescueStandardError:
|
538
|
+
Exclude:
|
539
|
+
- 'lib/flipper/adapters/sync/synchronizer.rb'
|
540
|
+
- 'spec/flipper/middleware/memoizer_spec.rb'
|
541
|
+
|
542
|
+
# Offense count: 4
|
543
|
+
# Cop supports --auto-correct.
|
544
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
|
545
|
+
# Whitelist: present?, blank?, presence, try, try!
|
546
|
+
Style/SafeNavigation:
|
547
|
+
Exclude:
|
548
|
+
- 'lib/flipper/instrumentation/statsd_subscriber.rb'
|
549
|
+
- 'lib/flipper/middleware/memoizer.rb'
|
550
|
+
- 'spec/flipper/adapters/http_spec.rb'
|
551
|
+
|
552
|
+
# Offense count: 8
|
553
|
+
# Cop supports --auto-correct.
|
554
|
+
# Configuration parameters: EnforcedStyle, MinSize.
|
555
|
+
# SupportedStyles: percent, brackets
|
556
|
+
Style/SymbolArray:
|
557
|
+
Exclude:
|
558
|
+
- 'Rakefile'
|
197
559
|
- 'lib/flipper/adapters/operation_logger.rb'
|
198
|
-
- 'lib/flipper/
|
199
|
-
- '
|
560
|
+
- 'lib/generators/flipper/templates/sequel_migration.rb'
|
561
|
+
- 'spec/flipper/adapters/rollout_spec.rb'
|
562
|
+
- 'spec/flipper/gate_values_spec.rb'
|
data/Changelog.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
## 0.17.1
|
2
|
+
|
3
|
+
* Fix require in flipper-active_record (https://github.com/jnunemaker/flipper/pull/437)
|
4
|
+
|
5
|
+
## 0.17.0
|
6
|
+
|
7
|
+
### Additions/Changes
|
8
|
+
|
9
|
+
* Allow shorthand block notation on group types (https://github.com/jnunemaker/flipper/pull/406)
|
10
|
+
* Relax active record/support constraints to support Rails 6 (https://github.com/jnunemaker/flipper/pull/409)
|
11
|
+
* Allow disabling fun (https://github.com/jnunemaker/flipper/pull/413)
|
12
|
+
* Include thing_value in payload of Instrumented#enable and #disable (https://github.com/jnunemaker/flipper/pull/417)
|
13
|
+
* Replace Erubis with Erubi (https://github.com/jnunemaker/flipper/pull/407)
|
14
|
+
* Allow customizing Rack::Protection middleware list (https://github.com/jnunemaker/flipper/pull/385)
|
15
|
+
* Allow setting write_timeout for ruby 2.6+ (https://github.com/jnunemaker/flipper/pull/433)
|
16
|
+
* Drop support for Ruby 2.1, 2.2, and 2.3 (https://github.com/jnunemaker/flipper/commit/cf58982e70de5e6963b018ceced4f36a275f5b5d)
|
17
|
+
* Add support for Ruby 2.6 (https://github.com/jnunemaker/flipper/commit/57888311449ec81184d3d47ba9ae5cb1ad4a2f45)
|
18
|
+
* Remove support for Rails 3.2 (https://github.com/jnunemaker/flipper/commit/177c48c4edf51d4e411e7c673e30e06d1c66fb40)
|
19
|
+
* Add write_timeout for flipper http adapter for ruby 2.6+ (https://github.com/jnunemaker/flipper/pull/433)
|
20
|
+
* Relax moneta version to allow for < 1.2 (https://github.com/jnunemaker/flipper/pull/434).
|
21
|
+
* Improve active record idempotency (https://github.com/jnunemaker/flipper/pull/436).
|
22
|
+
* Allow customizing add actor placeholder text (https://github.com/jnunemaker/flipper/commit/5faa1e9cf66b68f8227d2f8408fb448a14676c45)
|
23
|
+
|
1
24
|
## 0.16.2
|
2
25
|
|
3
26
|
### Additions/Changes
|
@@ -192,8 +215,8 @@
|
|
192
215
|
|
193
216
|
* Added Flipper.groups and Flipper.group_names
|
194
217
|
* Changed percentage_of_random to percentage_of_time
|
195
|
-
* Added enable/disable convenience methods for all gates (
|
196
|
-
* Added value convenience methods (
|
218
|
+
* Added enable/disable convenience methods for all gates (enable_group, enable_actor, enable_percentage_of_actors, enable_percentage_of_time)
|
219
|
+
* Added value convenience methods (boolean_value, groups_value, actors_value, etc.)
|
197
220
|
* Added Feature#gate_values for getting typecast adapter gate values
|
198
221
|
* Added Feature#enabled_gates and #disabled_gates for getting the gates that are enabled/disabled for the feature
|
199
222
|
* Remove Feature#description
|
data/Gemfile
CHANGED
@@ -7,27 +7,25 @@ Dir['flipper-*.gemspec'].each do |gemspec|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
gem 'pry'
|
10
|
-
gem 'rake', '~>
|
10
|
+
gem 'rake', '~> 12.3.3'
|
11
11
|
gem 'shotgun', '~> 0.9'
|
12
12
|
gem 'statsd-ruby', '~> 1.2.1'
|
13
13
|
gem 'rspec', '~> 3.0'
|
14
14
|
gem 'rack-test', '~> 0.6.3'
|
15
|
-
gem 'sqlite3',
|
16
|
-
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '
|
17
|
-
gem 'minitest', '~> 5.8
|
18
|
-
gem '
|
19
|
-
gem 'rubocop
|
20
|
-
gem '
|
21
|
-
|
22
|
-
# for active support tests in test/ and only needed for ruby 2.2.x
|
23
|
-
gem 'test-unit', '~> 3.0'
|
15
|
+
gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.3.11'}"
|
16
|
+
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '6.0.0'}"
|
17
|
+
gem 'minitest', '~> 5.8'
|
18
|
+
gem 'minitest-documentation'
|
19
|
+
gem 'rubocop'
|
20
|
+
gem 'rubocop-rspec'
|
21
|
+
gem 'webmock', '~> 3.0'
|
24
22
|
|
25
23
|
group(:guard) do
|
26
|
-
gem 'guard', '~> 2.
|
27
|
-
gem 'guard-rubocop', '~> 1.3
|
28
|
-
gem 'guard-rspec', '~> 4.5
|
29
|
-
gem 'guard-bundler', '~> 2.
|
30
|
-
gem 'guard-coffeescript', '~> 2.0
|
31
|
-
gem 'guard-sass', '~> 1.6
|
32
|
-
gem 'rb-fsevent', '~> 0.9
|
24
|
+
gem 'guard', '~> 2.15'
|
25
|
+
gem 'guard-rubocop', '~> 1.3'
|
26
|
+
gem 'guard-rspec', '~> 4.5'
|
27
|
+
gem 'guard-bundler', '~> 2.2'
|
28
|
+
gem 'guard-coffeescript', '~> 2.0'
|
29
|
+
gem 'guard-sass', '~> 1.6'
|
30
|
+
gem 'rb-fsevent', '~> 0.9'
|
33
31
|
end
|
data/README.md
CHANGED
@@ -85,7 +85,7 @@ Of course there are more [examples for you to peruse](examples/). You could also
|
|
85
85
|
|
86
86
|
1. Fork it
|
87
87
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
88
|
-
3.
|
88
|
+
3. Run the tests (`bundle exec rake`)
|
89
89
|
4. Commit your changes (`git commit -am 'Added some feature'`)
|
90
90
|
5. Push to the branch (`git push origin my-new-feature`)
|
91
91
|
6. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
3
|
require 'rake/testtask'
|
4
|
+
require 'rubocop/rake_task'
|
4
5
|
require 'flipper/version'
|
5
6
|
|
6
7
|
# gem install pkg/*.gem
|
@@ -25,7 +26,7 @@ end
|
|
25
26
|
|
26
27
|
require 'rspec/core/rake_task'
|
27
28
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
28
|
-
t.rspec_opts = %w(--color)
|
29
|
+
t.rspec_opts = %w(--color --format documentation)
|
29
30
|
end
|
30
31
|
|
31
32
|
namespace :spec do
|
@@ -39,6 +40,16 @@ end
|
|
39
40
|
Rake::TestTask.new do |t|
|
40
41
|
t.libs = %w(lib test)
|
41
42
|
t.pattern = 'test/**/*_test.rb'
|
43
|
+
t.options = '--documentation'
|
44
|
+
t.warning = false
|
42
45
|
end
|
43
46
|
|
44
|
-
|
47
|
+
Rake::TestTask.new(:test_rails) do |t|
|
48
|
+
t.libs = %w(lib test_rails)
|
49
|
+
t.pattern = 'test_rails/**/*_test.rb'
|
50
|
+
t.warning = false
|
51
|
+
end
|
52
|
+
|
53
|
+
RuboCop::RakeTask.new
|
54
|
+
|
55
|
+
task default: [:spec, :test, :test_rails, :rubocop]
|
data/docs/Caveats.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
# Caveats
|
2
2
|
|
3
|
-
1. The [individual actor gate](https://github.com/jnunemaker/flipper/blob/master/docs/Gates.md#
|
3
|
+
1. The [individual actor gate](https://github.com/jnunemaker/flipper/blob/master/docs/Gates.md#2-individual-actor) is typically not designed for hundreds or thousands of actors to be enabled. This is an explicit choice to make it easier to batch load data from the adapters instead of performing individual checks for actors over and over. If you need to enable something for more than 20 individual people, I would recommend using a [group](https://github.com/jnunemaker/flipper/blob/master/docs/Gates.md#5-group).
|
4
4
|
2. The disable method exists only to clear something that is enabled. If the thing you are disabling is not enabled, the disable is pointless. This means that if you enable one group an actor is in and disable another group, the feature will be enabled for the actor. ([related issue](https://github.com/jnunemaker/flipper/issues/71))
|
data/docs/api/README.md
CHANGED
@@ -527,7 +527,7 @@ Successful enabling of the actor will return a 200 HTTP status and the feature o
|
|
527
527
|
{
|
528
528
|
"key": "actors",
|
529
529
|
"name": "actor",
|
530
|
-
"value": ["User
|
530
|
+
"value": ["User;1"]
|
531
531
|
},
|
532
532
|
{
|
533
533
|
"key": "percentage_of_actors",
|
@@ -828,7 +828,7 @@ Successful disabling of a percentage of time will set the percentage to 0 and re
|
|
828
828
|
**Request**
|
829
829
|
|
830
830
|
```
|
831
|
-
curl -X GET http://example.com/flipper/api/actors/
|
831
|
+
curl -X GET http://example.com/flipper/api/actors/User;1?keys=my_feature_1,my_feature_2
|
832
832
|
```
|
833
833
|
|
834
834
|
**Response**
|
@@ -838,7 +838,7 @@ If no keys are specified all features are returned.
|
|
838
838
|
|
839
839
|
```json
|
840
840
|
{
|
841
|
-
"flipper_id": "
|
841
|
+
"flipper_id": "User;1",
|
842
842
|
"features": {
|
843
843
|
"my_feature_1": {
|
844
844
|
"enabled": true,
|
data/flipper.gemspec
CHANGED
@@ -25,13 +25,13 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.authors = ['John Nunemaker']
|
26
26
|
gem.email = ['nunemaker@gmail.com']
|
27
27
|
gem.summary = 'Feature flipper for ANYTHING'
|
28
|
-
gem.description = 'Feature flipper is the act of enabling/disabling features in your application, ideally without re-deploying or changing anything in your code base. Flipper makes this extremely easy to do with any backend you would like to use.'
|
28
|
+
gem.description = 'Feature flipper is the act of enabling/disabling features in your application, ideally without re-deploying or changing anything in your code base. Flipper makes this extremely easy to do with any backend you would like to use.' # rubocop:disable Metrics/LineLength
|
29
29
|
gem.homepage = 'https://github.com/jnunemaker/flipper'
|
30
30
|
gem.license = 'MIT'
|
31
31
|
|
32
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
33
|
-
gem.files = `git ls-files`.split("\n") - ignored_files + ['lib/flipper/version.rb']
|
34
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - ignored_test_files
|
32
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } # rubocop:disable Metrics/LineLength
|
33
|
+
gem.files = `git ls-files`.split("\n") - ignored_files + ['lib/flipper/version.rb'] # rubocop:disable Metrics/LineLength
|
34
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - ignored_test_files # rubocop:disable Metrics/LineLength
|
35
35
|
gem.name = 'flipper'
|
36
36
|
gem.require_paths = ['lib']
|
37
37
|
gem.version = Flipper::VERSION
|
@@ -21,6 +21,7 @@ module Flipper
|
|
21
21
|
@basic_auth_password = options[:basic_auth_password]
|
22
22
|
@read_timeout = options[:read_timeout]
|
23
23
|
@open_timeout = options[:open_timeout]
|
24
|
+
@write_timeout = options[:write_timeout]
|
24
25
|
@debug_output = options[:debug_output]
|
25
26
|
end
|
26
27
|
|
@@ -57,6 +58,7 @@ module Flipper
|
|
57
58
|
http = Net::HTTP.new(uri.host, uri.port)
|
58
59
|
http.read_timeout = @read_timeout if @read_timeout
|
59
60
|
http.open_timeout = @open_timeout if @open_timeout
|
61
|
+
apply_write_timeout(http)
|
60
62
|
http.set_debug_output(@debug_output) if @debug_output
|
61
63
|
|
62
64
|
if uri.scheme == HTTPS_SCHEME
|
@@ -79,6 +81,16 @@ module Flipper
|
|
79
81
|
|
80
82
|
request
|
81
83
|
end
|
84
|
+
|
85
|
+
def apply_write_timeout(http)
|
86
|
+
if @write_timeout
|
87
|
+
if RUBY_VERSION >= '2.6.0'
|
88
|
+
http.write_timeout = @write_timeout
|
89
|
+
else
|
90
|
+
Kernel.warn("Warning: option :write_timeout requires Ruby version 2.6.0 or later")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
82
94
|
end
|
83
95
|
end
|
84
96
|
end
|
@@ -32,115 +32,117 @@ module Flipper
|
|
32
32
|
|
33
33
|
# Public
|
34
34
|
def features
|
35
|
-
|
35
|
+
default_payload = {
|
36
36
|
operation: :features,
|
37
37
|
adapter_name: @adapter.name,
|
38
38
|
}
|
39
39
|
|
40
|
-
@instrumenter.instrument(InstrumentationName,
|
40
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
41
41
|
payload[:result] = @adapter.features
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
# Public
|
46
46
|
def add(feature)
|
47
|
-
|
47
|
+
default_payload = {
|
48
48
|
operation: :add,
|
49
49
|
adapter_name: @adapter.name,
|
50
50
|
feature_name: feature.name,
|
51
51
|
}
|
52
52
|
|
53
|
-
@instrumenter.instrument(InstrumentationName,
|
53
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
54
54
|
payload[:result] = @adapter.add(feature)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
# Public
|
59
59
|
def remove(feature)
|
60
|
-
|
60
|
+
default_payload = {
|
61
61
|
operation: :remove,
|
62
62
|
adapter_name: @adapter.name,
|
63
63
|
feature_name: feature.name,
|
64
64
|
}
|
65
65
|
|
66
|
-
@instrumenter.instrument(InstrumentationName,
|
66
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
67
67
|
payload[:result] = @adapter.remove(feature)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
# Public
|
72
72
|
def clear(feature)
|
73
|
-
|
73
|
+
default_payload = {
|
74
74
|
operation: :clear,
|
75
75
|
adapter_name: @adapter.name,
|
76
76
|
feature_name: feature.name,
|
77
77
|
}
|
78
78
|
|
79
|
-
@instrumenter.instrument(InstrumentationName,
|
79
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
80
80
|
payload[:result] = @adapter.clear(feature)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
# Public
|
85
85
|
def get(feature)
|
86
|
-
|
86
|
+
default_payload = {
|
87
87
|
operation: :get,
|
88
88
|
adapter_name: @adapter.name,
|
89
89
|
feature_name: feature.name,
|
90
90
|
}
|
91
91
|
|
92
|
-
@instrumenter.instrument(InstrumentationName,
|
92
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
93
93
|
payload[:result] = @adapter.get(feature)
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
97
|
def get_multi(features)
|
98
|
-
|
98
|
+
default_payload = {
|
99
99
|
operation: :get_multi,
|
100
100
|
adapter_name: @adapter.name,
|
101
101
|
feature_names: features.map(&:name),
|
102
102
|
}
|
103
103
|
|
104
|
-
@instrumenter.instrument(InstrumentationName,
|
104
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
105
105
|
payload[:result] = @adapter.get_multi(features)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
def get_all
|
110
|
-
|
110
|
+
default_payload = {
|
111
111
|
operation: :get_all,
|
112
112
|
adapter_name: @adapter.name,
|
113
113
|
}
|
114
114
|
|
115
|
-
@instrumenter.instrument(InstrumentationName,
|
115
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
116
116
|
payload[:result] = @adapter.get_all
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
# Public
|
121
121
|
def enable(feature, gate, thing)
|
122
|
-
|
122
|
+
default_payload = {
|
123
123
|
operation: :enable,
|
124
124
|
adapter_name: @adapter.name,
|
125
125
|
feature_name: feature.name,
|
126
126
|
gate_name: gate.name,
|
127
|
+
thing_value: thing.value,
|
127
128
|
}
|
128
129
|
|
129
|
-
@instrumenter.instrument(InstrumentationName,
|
130
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
130
131
|
payload[:result] = @adapter.enable(feature, gate, thing)
|
131
132
|
end
|
132
133
|
end
|
133
134
|
|
134
135
|
# Public
|
135
136
|
def disable(feature, gate, thing)
|
136
|
-
|
137
|
+
default_payload = {
|
137
138
|
operation: :disable,
|
138
139
|
adapter_name: @adapter.name,
|
139
140
|
feature_name: feature.name,
|
140
141
|
gate_name: gate.name,
|
142
|
+
thing_value: thing.value,
|
141
143
|
}
|
142
144
|
|
143
|
-
@instrumenter.instrument(InstrumentationName,
|
145
|
+
@instrumenter.instrument(InstrumentationName, default_payload) do |payload|
|
144
146
|
payload[:result] = @adapter.disable(feature, gate, thing)
|
145
147
|
end
|
146
148
|
end
|
data/lib/flipper/feature.rb
CHANGED
@@ -5,8 +5,7 @@ require 'flipper/feature_check_context'
|
|
5
5
|
require 'flipper/gate_values'
|
6
6
|
|
7
7
|
module Flipper
|
8
|
-
# rubocop:disable Metrics/ClassLength
|
9
|
-
class Feature
|
8
|
+
class Feature # rubocop:disable Metrics/ClassLength
|
10
9
|
# Private: The name of feature instrumentation events.
|
11
10
|
InstrumentationName = "feature_operation.#{InstrumentationNamespace}".freeze
|
12
11
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# Requires the following methods:
|
2
2
|
# * subject - The instance of the adapter
|
3
|
-
# rubocop:disable Metrics/BlockLength
|
4
3
|
RSpec.shared_examples_for 'a flipper adapter' do
|
5
4
|
let(:flipper) { Flipper.new(subject) }
|
6
5
|
let(:feature) { flipper[:stats] }
|
@@ -280,4 +279,14 @@ RSpec.shared_examples_for 'a flipper adapter' do
|
|
280
279
|
expect(subject.enable(feature, group_gate, flipper.group(:admins))).to eq(true)
|
281
280
|
expect(subject.get(feature).fetch(:groups)).to eq(Set['admins'])
|
282
281
|
end
|
282
|
+
|
283
|
+
it 'can double enable percentage without error' do
|
284
|
+
expect(subject.enable(feature, actors_gate, flipper.actors(25))).to eq(true)
|
285
|
+
expect(subject.enable(feature, actors_gate, flipper.actors(25))).to eq(true)
|
286
|
+
end
|
287
|
+
|
288
|
+
it 'can double enable without error' do
|
289
|
+
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
290
|
+
expect(subject.enable(feature, boolean_gate, flipper.boolean)).to eq(true)
|
291
|
+
end
|
283
292
|
end
|
@@ -43,7 +43,7 @@ module Flipper
|
|
43
43
|
assert_equal true, @adapter.enable(@feature, @boolean_gate, @flipper.boolean)
|
44
44
|
assert_equal 'true', @adapter.get(@feature)[:boolean]
|
45
45
|
assert_equal true, @adapter.disable(@feature, @boolean_gate, @flipper.boolean(false))
|
46
|
-
|
46
|
+
assert_nil @adapter.get(@feature)[:boolean]
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_fully_disables_all_enabled_things_when_boolean_gate_disabled
|
@@ -275,6 +275,16 @@ module Flipper
|
|
275
275
|
assert_equal true, @adapter.enable(@feature, @group_gate, @flipper.group(:admins))
|
276
276
|
assert_equal Set['admins'], @adapter.get(@feature).fetch(:groups)
|
277
277
|
end
|
278
|
+
|
279
|
+
def test_can_double_enable_percentage_without_error
|
280
|
+
assert_equal true, @adapter.enable(@feature, @actors_gate, @flipper.actors(25))
|
281
|
+
assert_equal true, @adapter.enable(@feature, @actors_gate, @flipper.actors(25))
|
282
|
+
end
|
283
|
+
|
284
|
+
def test_can_double_enable_without_error
|
285
|
+
assert_equal true, @adapter.enable(@feature, @boolean_gate, @flipper.boolean)
|
286
|
+
assert_equal true, @adapter.enable(@feature, @boolean_gate, @flipper.boolean)
|
287
|
+
end
|
278
288
|
end
|
279
289
|
end
|
280
290
|
end
|
data/lib/flipper/types/group.rb
CHANGED
data/lib/flipper/version.rb
CHANGED
@@ -73,6 +73,7 @@ RSpec.describe Flipper::Adapters::Instrumented do
|
|
73
73
|
expect(event.payload[:adapter_name]).to eq(:memory)
|
74
74
|
expect(event.payload[:feature_name]).to eq(:stats)
|
75
75
|
expect(event.payload[:gate_name]).to eq(:percentage_of_actors)
|
76
|
+
expect(event.payload[:thing_value]).to eq(22)
|
76
77
|
expect(event.payload[:result]).to be(result)
|
77
78
|
end
|
78
79
|
end
|
@@ -88,6 +89,7 @@ RSpec.describe Flipper::Adapters::Instrumented do
|
|
88
89
|
expect(event.payload[:adapter_name]).to eq(:memory)
|
89
90
|
expect(event.payload[:feature_name]).to eq(:stats)
|
90
91
|
expect(event.payload[:gate_name]).to eq(:percentage_of_actors)
|
92
|
+
expect(event.payload[:thing_value]).to eq(22)
|
91
93
|
expect(event.payload[:result]).to be(result)
|
92
94
|
end
|
93
95
|
end
|
@@ -41,8 +41,8 @@ RSpec.describe Flipper::FeatureCheckContext do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'knows actors_value' do
|
44
|
-
args = options.merge(values: Flipper::GateValues.new(actors: Set['User
|
45
|
-
expect(described_class.new(args).actors_value).to eq(Set['User
|
44
|
+
args = options.merge(values: Flipper::GateValues.new(actors: Set['User;1']))
|
45
|
+
expect(described_class.new(args).actors_value).to eq(Set['User;1'])
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'knows groups_value' do
|
@@ -530,12 +530,12 @@ RSpec.describe Flipper::Feature do
|
|
530
530
|
|
531
531
|
context 'when one or more actors are enabled' do
|
532
532
|
before do
|
533
|
-
subject.enable Flipper::Types::Actor.new(Flipper::Actor.new('User
|
534
|
-
subject.enable Flipper::Types::Actor.new(Flipper::Actor.new('User
|
533
|
+
subject.enable Flipper::Types::Actor.new(Flipper::Actor.new('User;5'))
|
534
|
+
subject.enable Flipper::Types::Actor.new(Flipper::Actor.new('User;22'))
|
535
535
|
end
|
536
536
|
|
537
537
|
it 'returns set of actor ids' do
|
538
|
-
expect(subject.actors_value).to eq(Set.new(['User
|
538
|
+
expect(subject.actors_value).to eq(Set.new(['User;5', 'User;22']))
|
539
539
|
end
|
540
540
|
end
|
541
541
|
end
|
@@ -65,6 +65,28 @@ RSpec.describe Flipper::Types::Group do
|
|
65
65
|
expect(group.match?(double('Actor'), fake_context)).to be_falsey
|
66
66
|
end
|
67
67
|
|
68
|
+
it 'returns true for truthy shortand block results' do
|
69
|
+
actor = Class.new do
|
70
|
+
def admin?
|
71
|
+
true
|
72
|
+
end
|
73
|
+
end.new
|
74
|
+
|
75
|
+
group = described_class.new(:admin, &:admin?)
|
76
|
+
expect(group.match?(actor, fake_context)).to be_truthy
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'returns false for falsy shortand block results' do
|
80
|
+
actor = Class.new do
|
81
|
+
def admin?
|
82
|
+
false
|
83
|
+
end
|
84
|
+
end.new
|
85
|
+
|
86
|
+
group = described_class.new(:admin, &:admin?)
|
87
|
+
expect(group.match?(actor, fake_context)).to be_falsey
|
88
|
+
end
|
89
|
+
|
68
90
|
it 'can yield without context as block argument' do
|
69
91
|
context = Flipper::FeatureCheckContext.new(
|
70
92
|
feature_name: :my_feature,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Feature flipper is the act of enabling/disabling features in your application,
|
14
14
|
ideally without re-deploying or changing anything in your code base. Flipper makes
|
@@ -150,8 +150,8 @@ files:
|
|
150
150
|
- spec/support/spec_helpers.rb
|
151
151
|
- test/adapters/memory_test.rb
|
152
152
|
- test/adapters/pstore_test.rb
|
153
|
-
- test/helper.rb
|
154
153
|
- test/test_helper.rb
|
154
|
+
- test_rails/helper.rb
|
155
155
|
homepage: https://github.com/jnunemaker/flipper
|
156
156
|
licenses:
|
157
157
|
- MIT
|
@@ -172,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
|
-
|
176
|
-
rubygems_version: 2.4.5.4
|
175
|
+
rubygems_version: 3.0.3
|
177
176
|
signing_key:
|
178
177
|
specification_version: 4
|
179
178
|
summary: Feature flipper for ANYTHING
|
@@ -224,5 +223,4 @@ test_files:
|
|
224
223
|
- spec/support/spec_helpers.rb
|
225
224
|
- test/adapters/memory_test.rb
|
226
225
|
- test/adapters/pstore_test.rb
|
227
|
-
- test/helper.rb
|
228
226
|
- test/test_helper.rb
|