flipper 0.10.2 → 0.11.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +42 -0
- data/.rubocop_todo.yml +188 -0
- data/Changelog.md +10 -0
- data/Gemfile +6 -3
- data/README.md +4 -3
- data/Rakefile +13 -13
- data/docs/Adapters.md +2 -1
- data/docs/DockerCompose.md +6 -3
- data/docs/Gates.md +25 -3
- data/docs/Optimization.md +27 -5
- data/docs/api/README.md +73 -32
- data/docs/http/README.md +34 -0
- data/docs/read-only/README.md +22 -0
- data/examples/percentage_of_actors_group.rb +49 -0
- data/flipper.gemspec +15 -15
- data/lib/flipper.rb +2 -5
- data/lib/flipper/adapter.rb +10 -0
- data/lib/flipper/adapters/http.rb +147 -0
- data/lib/flipper/adapters/http/client.rb +83 -0
- data/lib/flipper/adapters/http/error.rb +14 -0
- data/lib/flipper/adapters/instrumented.rb +36 -36
- data/lib/flipper/adapters/memoizable.rb +2 -6
- data/lib/flipper/adapters/memory.rb +10 -9
- data/lib/flipper/adapters/operation_logger.rb +1 -1
- data/lib/flipper/adapters/pstore.rb +12 -11
- data/lib/flipper/adapters/read_only.rb +6 -6
- data/lib/flipper/dsl.rb +1 -3
- data/lib/flipper/feature.rb +11 -16
- data/lib/flipper/gate.rb +3 -3
- data/lib/flipper/gate_values.rb +6 -6
- data/lib/flipper/gates/group.rb +2 -2
- data/lib/flipper/gates/percentage_of_actors.rb +2 -2
- data/lib/flipper/instrumentation/log_subscriber.rb +2 -4
- data/lib/flipper/instrumentation/metriks.rb +1 -1
- data/lib/flipper/instrumentation/statsd.rb +1 -1
- data/lib/flipper/instrumentation/statsd_subscriber.rb +1 -3
- data/lib/flipper/instrumentation/subscriber.rb +11 -10
- data/lib/flipper/instrumenters/memory.rb +1 -5
- data/lib/flipper/instrumenters/noop.rb +1 -1
- data/lib/flipper/middleware/memoizer.rb +11 -27
- data/lib/flipper/middleware/setup_env.rb +44 -0
- data/lib/flipper/registry.rb +8 -10
- data/lib/flipper/spec/shared_adapter_specs.rb +45 -67
- data/lib/flipper/test/shared_adapter_test.rb +25 -31
- data/lib/flipper/typecast.rb +2 -2
- data/lib/flipper/types/actor.rb +2 -4
- data/lib/flipper/types/group.rb +1 -1
- data/lib/flipper/types/percentage.rb +2 -1
- data/lib/flipper/version.rb +1 -1
- data/spec/fixtures/feature.json +31 -0
- data/spec/flipper/adapters/http_spec.rb +148 -0
- data/spec/flipper/adapters/instrumented_spec.rb +20 -20
- data/spec/flipper/adapters/memoizable_spec.rb +59 -59
- data/spec/flipper/adapters/operation_logger_spec.rb +16 -16
- data/spec/flipper/adapters/pstore_spec.rb +6 -6
- data/spec/flipper/adapters/read_only_spec.rb +28 -34
- data/spec/flipper/dsl_spec.rb +73 -84
- data/spec/flipper/feature_check_context_spec.rb +27 -27
- data/spec/flipper/feature_spec.rb +186 -196
- data/spec/flipper/gate_spec.rb +11 -11
- data/spec/flipper/gate_values_spec.rb +46 -45
- data/spec/flipper/gates/actor_spec.rb +2 -2
- data/spec/flipper/gates/boolean_spec.rb +24 -23
- data/spec/flipper/gates/group_spec.rb +19 -19
- data/spec/flipper/gates/percentage_of_actors_spec.rb +10 -10
- data/spec/flipper/gates/percentage_of_time_spec.rb +2 -2
- data/spec/flipper/instrumentation/log_subscriber_spec.rb +20 -20
- data/spec/flipper/instrumentation/metriks_subscriber_spec.rb +20 -20
- data/spec/flipper/instrumentation/statsd_subscriber_spec.rb +11 -11
- data/spec/flipper/instrumenters/memory_spec.rb +5 -5
- data/spec/flipper/instrumenters/noop_spec.rb +6 -6
- data/spec/flipper/middleware/memoizer_spec.rb +83 -100
- data/spec/flipper/middleware/setup_env_spec.rb +76 -0
- data/spec/flipper/registry_spec.rb +35 -39
- data/spec/flipper/typecast_spec.rb +18 -18
- data/spec/flipper/types/actor_spec.rb +30 -29
- data/spec/flipper/types/boolean_spec.rb +8 -8
- data/spec/flipper/types/group_spec.rb +28 -28
- data/spec/flipper/types/percentage_spec.rb +14 -14
- data/spec/flipper_spec.rb +61 -54
- data/spec/helper.rb +26 -21
- data/spec/integration_spec.rb +121 -113
- data/spec/support/fake_udp_socket.rb +1 -1
- data/spec/support/spec_helpers.rb +32 -4
- data/test/adapters/pstore_test.rb +3 -3
- data/test/test_helper.rb +1 -1
- metadata +20 -5
@@ -9,9 +9,9 @@ module SpecHelpers
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def build_app(flipper)
|
12
|
-
Flipper::UI.app(flipper)
|
13
|
-
builder.use Rack::Session::Cookie, secret:
|
14
|
-
|
12
|
+
Flipper::UI.app(flipper) do |builder|
|
13
|
+
builder.use Rack::Session::Cookie, secret: 'test'
|
14
|
+
end
|
15
15
|
end
|
16
16
|
|
17
17
|
def build_api(flipper)
|
@@ -27,7 +27,35 @@ module SpecHelpers
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def json_response
|
30
|
-
JSON.
|
30
|
+
JSON.parse(last_response.body)
|
31
|
+
end
|
32
|
+
|
33
|
+
def api_error_code_reference_url
|
34
|
+
'https://github.com/jnunemaker/flipper/tree/master/docs/api#error-code-reference'
|
35
|
+
end
|
36
|
+
|
37
|
+
def api_not_found_response
|
38
|
+
{
|
39
|
+
'code' => 1,
|
40
|
+
'message' => 'Feature not found.',
|
41
|
+
'more_info' => api_error_code_reference_url,
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def api_flipper_id_is_missing_response
|
46
|
+
{
|
47
|
+
'code' => 4,
|
48
|
+
'message' => 'Required parameter flipper_id is missing.',
|
49
|
+
'more_info' => api_error_code_reference_url,
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def api_positive_percentage_error_response
|
54
|
+
{
|
55
|
+
'code' => 3,
|
56
|
+
'message' => 'Percentage must be a positive number less than or equal to 100.',
|
57
|
+
'more_info' => api_error_code_reference_url,
|
58
|
+
}
|
31
59
|
end
|
32
60
|
end
|
33
61
|
|
@@ -5,13 +5,13 @@ class PstoreTest < MiniTest::Test
|
|
5
5
|
prepend Flipper::Test::SharedAdapterTests
|
6
6
|
|
7
7
|
def setup
|
8
|
-
dir = FlipperRoot.join(
|
9
|
-
pstore_file = dir.join(
|
8
|
+
dir = FlipperRoot.join('tmp').tap(&:mkpath)
|
9
|
+
pstore_file = dir.join('flipper.pstore')
|
10
10
|
pstore_file.unlink if pstore_file.exist?
|
11
11
|
@adapter = Flipper::Adapters::PStore.new(pstore_file)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_defaults_path_to_flipper_pstore
|
15
|
-
assert_equal Flipper::Adapters::PStore.new.path,
|
15
|
+
assert_equal Flipper::Adapters::PStore.new.path, 'flipper.pstore'
|
16
16
|
end
|
17
17
|
end
|
data/test/test_helper.rb
CHANGED
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.11.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-02 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
|
@@ -19,6 +19,8 @@ executables: []
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
+
- ".rubocop.yml"
|
23
|
+
- ".rubocop_todo.yml"
|
22
24
|
- Changelog.md
|
23
25
|
- Dockerfile
|
24
26
|
- Gemfile
|
@@ -33,6 +35,8 @@ files:
|
|
33
35
|
- docs/Instrumentation.md
|
34
36
|
- docs/Optimization.md
|
35
37
|
- docs/api/README.md
|
38
|
+
- docs/http/README.md
|
39
|
+
- docs/read-only/README.md
|
36
40
|
- examples/basic.rb
|
37
41
|
- examples/dsl.rb
|
38
42
|
- examples/enabled_for_actor.rb
|
@@ -44,10 +48,14 @@ files:
|
|
44
48
|
- examples/instrumentation.rb
|
45
49
|
- examples/percentage_of_actors.rb
|
46
50
|
- examples/percentage_of_actors_enabled_check.rb
|
51
|
+
- examples/percentage_of_actors_group.rb
|
47
52
|
- examples/percentage_of_time.rb
|
48
53
|
- flipper.gemspec
|
49
54
|
- lib/flipper.rb
|
50
55
|
- lib/flipper/adapter.rb
|
56
|
+
- lib/flipper/adapters/http.rb
|
57
|
+
- lib/flipper/adapters/http/client.rb
|
58
|
+
- lib/flipper/adapters/http/error.rb
|
51
59
|
- lib/flipper/adapters/instrumented.rb
|
52
60
|
- lib/flipper/adapters/memoizable.rb
|
53
61
|
- lib/flipper/adapters/memory.rb
|
@@ -74,6 +82,7 @@ files:
|
|
74
82
|
- lib/flipper/instrumenters/memory.rb
|
75
83
|
- lib/flipper/instrumenters/noop.rb
|
76
84
|
- lib/flipper/middleware/memoizer.rb
|
85
|
+
- lib/flipper/middleware/setup_env.rb
|
77
86
|
- lib/flipper/registry.rb
|
78
87
|
- lib/flipper/spec/shared_adapter_specs.rb
|
79
88
|
- lib/flipper/test/shared_adapter_test.rb
|
@@ -86,6 +95,8 @@ files:
|
|
86
95
|
- lib/flipper/types/percentage_of_actors.rb
|
87
96
|
- lib/flipper/types/percentage_of_time.rb
|
88
97
|
- lib/flipper/version.rb
|
98
|
+
- spec/fixtures/feature.json
|
99
|
+
- spec/flipper/adapters/http_spec.rb
|
89
100
|
- spec/flipper/adapters/instrumented_spec.rb
|
90
101
|
- spec/flipper/adapters/memoizable_spec.rb
|
91
102
|
- spec/flipper/adapters/memory_spec.rb
|
@@ -108,6 +119,7 @@ files:
|
|
108
119
|
- spec/flipper/instrumenters/memory_spec.rb
|
109
120
|
- spec/flipper/instrumenters/noop_spec.rb
|
110
121
|
- spec/flipper/middleware/memoizer_spec.rb
|
122
|
+
- spec/flipper/middleware/setup_env_spec.rb
|
111
123
|
- spec/flipper/registry_spec.rb
|
112
124
|
- spec/flipper/typecast_spec.rb
|
113
125
|
- spec/flipper/types/actor_spec.rb
|
@@ -140,16 +152,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
152
|
version: '0'
|
141
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
154
|
requirements:
|
143
|
-
- - "
|
155
|
+
- - ">"
|
144
156
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
157
|
+
version: 1.3.1
|
146
158
|
requirements: []
|
147
159
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.5.2
|
149
161
|
signing_key:
|
150
162
|
specification_version: 4
|
151
163
|
summary: Feature flipper for ANYTHING
|
152
164
|
test_files:
|
165
|
+
- spec/fixtures/feature.json
|
166
|
+
- spec/flipper/adapters/http_spec.rb
|
153
167
|
- spec/flipper/adapters/instrumented_spec.rb
|
154
168
|
- spec/flipper/adapters/memoizable_spec.rb
|
155
169
|
- spec/flipper/adapters/memory_spec.rb
|
@@ -172,6 +186,7 @@ test_files:
|
|
172
186
|
- spec/flipper/instrumenters/memory_spec.rb
|
173
187
|
- spec/flipper/instrumenters/noop_spec.rb
|
174
188
|
- spec/flipper/middleware/memoizer_spec.rb
|
189
|
+
- spec/flipper/middleware/setup_env_spec.rb
|
175
190
|
- spec/flipper/registry_spec.rb
|
176
191
|
- spec/flipper/typecast_spec.rb
|
177
192
|
- spec/flipper/types/actor_spec.rb
|