flipper 1.3.0 → 1.3.2
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 +19 -5
- data/.github/workflows/examples.yml +19 -5
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/flipper/adapter_builder.rb +1 -1
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/adapters/strict_spec.rb +2 -2
- data/spec/flipper/cli_spec.rb +4 -2
- data/spec/flipper/engine_spec.rb +7 -7
- data/spec/flipper/middleware/memoizer_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- data/spec/support/fail_on_output.rb +1 -1
- data/spec/support/spec_helpers.rb +13 -2
- data/test_rails/system/test_help_test.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cec73aaf335a08edc58718f2ab05e7ab51e3796a2c8426763a179ffed031a09f
|
4
|
+
data.tar.gz: 666c50ae76807729db78b0d04d27f3fe4fd4f9c8499befeea9c4c58134897ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58fa61222b6d56458b8f7855969a0d55ef96058b4a6bc2a0b570ecbcacec191478677fbd7aee954e70cfca6eb64286477fb707c9b7dd9662497f16c31383a256
|
7
|
+
data.tar.gz: 310657db11afe2233674afbe0ce07f029a991977e77813bcd88d49993e232e0937dc3258828ebbd6bdbbceb1910e2af64776ca3353e81381cd6d95ccb7e8c551
|
data/.github/workflows/ci.yml
CHANGED
@@ -7,7 +7,7 @@ jobs:
|
|
7
7
|
services:
|
8
8
|
redis:
|
9
9
|
image: redis
|
10
|
-
ports: [
|
10
|
+
ports: ["6379:6379"]
|
11
11
|
options: >-
|
12
12
|
--health-cmd "redis-cli ping"
|
13
13
|
--health-interval 10s
|
@@ -28,21 +28,35 @@ jobs:
|
|
28
28
|
strategy:
|
29
29
|
fail-fast: false
|
30
30
|
matrix:
|
31
|
-
ruby: [
|
32
|
-
rails: [
|
31
|
+
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
|
32
|
+
rails: ["5.2", "6.0.0", "6.1.0", "7.0.0", "7.1.0", "7.2.0", "8.0.0"]
|
33
33
|
exclude:
|
34
34
|
- ruby: "2.6"
|
35
35
|
rails: "7.1.0"
|
36
36
|
- ruby: "2.6"
|
37
37
|
rails: "7.0.0"
|
38
|
+
- ruby: "2.6"
|
39
|
+
rails: "7.2.0"
|
40
|
+
- ruby: "2.6"
|
41
|
+
rails: "8.0.0"
|
38
42
|
- ruby: "2.7"
|
39
43
|
rails: "7.1.0"
|
44
|
+
- ruby: "2.7"
|
45
|
+
rails: "7.2.0"
|
46
|
+
- ruby: "2.7"
|
47
|
+
rails: "8.0.0"
|
40
48
|
- ruby: "3.0"
|
41
49
|
rails: "5.2"
|
50
|
+
- ruby: "3.0"
|
51
|
+
rails: "7.2.0"
|
52
|
+
- ruby: "3.0"
|
53
|
+
rails: "8.0.0"
|
42
54
|
- ruby: "3.1"
|
43
55
|
rails: "5.2"
|
44
56
|
- ruby: "3.1"
|
45
57
|
rails: "6.0.0"
|
58
|
+
- ruby: "3.1"
|
59
|
+
rails: "8.0.0"
|
46
60
|
- ruby: "3.2"
|
47
61
|
rails: "5.2"
|
48
62
|
- ruby: "3.2"
|
@@ -56,7 +70,7 @@ jobs:
|
|
56
70
|
- ruby: "3.3"
|
57
71
|
rails: "6.1.0"
|
58
72
|
env:
|
59
|
-
SQLITE3_VERSION: 1.4.1
|
73
|
+
SQLITE3_VERSION: ${{ matrix.rails == '8.0.0' && '2.1.0' || '1.4.1' }}
|
60
74
|
REDIS_URL: redis://localhost:6379/0
|
61
75
|
CI: true
|
62
76
|
RAILS_VERSION: ${{ matrix.rails }}
|
@@ -70,7 +84,7 @@ jobs:
|
|
70
84
|
- name: Setup memcached
|
71
85
|
uses: KeisukeYamashita/memcached-actions@v1
|
72
86
|
- name: Start MongoDB
|
73
|
-
uses: supercharge/mongodb-github-action@
|
87
|
+
uses: supercharge/mongodb-github-action@1.11.0
|
74
88
|
with:
|
75
89
|
mongodb-version: 4.0
|
76
90
|
- name: Check out repository code
|
@@ -8,7 +8,7 @@ jobs:
|
|
8
8
|
services:
|
9
9
|
redis:
|
10
10
|
image: redis
|
11
|
-
ports: [
|
11
|
+
ports: ["6379:6379"]
|
12
12
|
options: >-
|
13
13
|
--health-cmd "redis-cli ping"
|
14
14
|
--health-interval 10s
|
@@ -16,21 +16,35 @@ jobs:
|
|
16
16
|
--health-retries 5
|
17
17
|
strategy:
|
18
18
|
matrix:
|
19
|
-
ruby: [
|
20
|
-
rails: [
|
19
|
+
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
|
20
|
+
rails: ["5.2", "6.0.0", "6.1.0", "7.0.0", "7.1.0", "7.2.0", "8.0.0"]
|
21
21
|
exclude:
|
22
22
|
- ruby: "2.6"
|
23
23
|
rails: "7.1.0"
|
24
24
|
- ruby: "2.6"
|
25
25
|
rails: "7.0.0"
|
26
|
+
- ruby: "2.6"
|
27
|
+
rails: "7.2.0"
|
28
|
+
- ruby: "2.6"
|
29
|
+
rails: "8.0.0"
|
26
30
|
- ruby: "2.7"
|
27
31
|
rails: "7.1.0"
|
32
|
+
- ruby: "2.7"
|
33
|
+
rails: "7.2.0"
|
34
|
+
- ruby: "2.7"
|
35
|
+
rails: "8.0.0"
|
28
36
|
- ruby: "3.0"
|
29
37
|
rails: "5.2"
|
38
|
+
- ruby: "3.0"
|
39
|
+
rails: "7.2.0"
|
40
|
+
- ruby: "3.0"
|
41
|
+
rails: "8.0.0"
|
30
42
|
- ruby: "3.1"
|
31
43
|
rails: "5.2"
|
32
44
|
- ruby: "3.1"
|
33
45
|
rails: "6.0.0"
|
46
|
+
- ruby: "3.1"
|
47
|
+
rails: "8.0.0"
|
34
48
|
- ruby: "3.2"
|
35
49
|
rails: "5.2"
|
36
50
|
- ruby: "3.2"
|
@@ -44,7 +58,7 @@ jobs:
|
|
44
58
|
- ruby: "3.3"
|
45
59
|
rails: "6.1.0"
|
46
60
|
env:
|
47
|
-
SQLITE3_VERSION: 1.4.1
|
61
|
+
SQLITE3_VERSION: ${{ matrix.rails == '8.0.0' && '2.1.0' || '1.4.1' }}
|
48
62
|
REDIS_URL: redis://localhost:6379/0
|
49
63
|
CI: true
|
50
64
|
RAILS_VERSION: ${{ matrix.rails }}
|
@@ -52,7 +66,7 @@ jobs:
|
|
52
66
|
- name: Setup memcached
|
53
67
|
uses: KeisukeYamashita/memcached-actions@v1
|
54
68
|
- name: Start MongoDB
|
55
|
-
uses: supercharge/mongodb-github-action@
|
69
|
+
uses: supercharge/mongodb-github-action@1.11.0
|
56
70
|
with:
|
57
71
|
mongodb-version: 4.0
|
58
72
|
- name: Check out repository code
|
data/Gemfile
CHANGED
@@ -11,7 +11,7 @@ gem 'rake'
|
|
11
11
|
gem 'statsd-ruby', '~> 1.2.1'
|
12
12
|
gem 'rspec', '~> 3.0'
|
13
13
|
gem 'rack-test'
|
14
|
-
gem 'rackup'
|
14
|
+
gem 'rackup', '= 1.0.0'
|
15
15
|
gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.4.1'}"
|
16
16
|
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '7.1'}"
|
17
17
|
gem 'minitest', '~> 5.18'
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[](https://www.flippercloud.io)
|
2
2
|
|
3
|
-
[Website](https://flippercloud.io?utm_source=oss&utm_medium=readme&utm_campaign=website_link) | [Documentation](https://flippercloud.io/docs?utm_source=oss&utm_medium=readme&utm_campaign=docs_link) | [Examples](examples) | [Twitter](https://twitter.com/flipper_cloud) | [Ruby.social](https://ruby.social/@flipper)
|
3
|
+
[Website](https://flippercloud.io?utm_source=oss&utm_medium=readme&utm_campaign=website_link) | [Documentation](https://flippercloud.io/docs?utm_source=oss&utm_medium=readme&utm_campaign=docs_link) | [Examples](examples) | [Chat](https://chat.flippercloud.io/join/xjHq-aJsA-BeZH) | [Twitter](https://twitter.com/flipper_cloud) | [Ruby.social](https://ruby.social/@flipper)
|
4
4
|
|
5
5
|
# Flipper
|
6
6
|
|
data/lib/flipper/version.rb
CHANGED
@@ -29,13 +29,13 @@ RSpec.describe Flipper::Adapters::Strict do
|
|
29
29
|
|
30
30
|
context "#get" do
|
31
31
|
it "raises an error for unknown feature" do
|
32
|
-
expect(
|
32
|
+
expect(capture_output { subject.get(feature) }).to match(/Could not find feature "unknown"/)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context "#get_multi" do
|
37
37
|
it "raises an error for unknown feature" do
|
38
|
-
expect(
|
38
|
+
expect(capture_output { subject.get_multi([feature]) }).to match(/Could not find feature "unknown"/)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/spec/flipper/cli_spec.rb
CHANGED
@@ -5,6 +5,8 @@ RSpec.describe Flipper::CLI do
|
|
5
5
|
let(:stderr) { StringIO.new }
|
6
6
|
let(:cli) { Flipper::CLI.new(stdout: stdout, stderr: stderr) }
|
7
7
|
|
8
|
+
Result = Struct.new(:status, :stdout, :stderr, keyword_init: true)
|
9
|
+
|
8
10
|
before do
|
9
11
|
# Prentend stdout/stderr a TTY to test colorization
|
10
12
|
allow(stdout).to receive(:tty?).and_return(true)
|
@@ -12,7 +14,7 @@ RSpec.describe Flipper::CLI do
|
|
12
14
|
end
|
13
15
|
|
14
16
|
# Infer the command from the description
|
15
|
-
|
17
|
+
let(:argv) do
|
16
18
|
descriptions = self.class.parent_groups.map {|g| g.metadata[:description_args] }.reverse.flatten.drop(1)
|
17
19
|
descriptions.map { |arg| Shellwords.split(arg) }.flatten
|
18
20
|
end
|
@@ -26,7 +28,7 @@ RSpec.describe Flipper::CLI do
|
|
26
28
|
status = e.status
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
Result.new(status: status, stdout: stdout.string, stderr: stderr.string)
|
30
32
|
end
|
31
33
|
|
32
34
|
before do
|
data/spec/flipper/engine_spec.rb
CHANGED
@@ -29,7 +29,7 @@ RSpec.describe Flipper::Engine do
|
|
29
29
|
|
30
30
|
let(:config) { application.config.flipper }
|
31
31
|
|
32
|
-
subject { application.initialize! }
|
32
|
+
subject { SpecHelpers.silence { application.initialize! } }
|
33
33
|
|
34
34
|
shared_examples 'config.strict' do
|
35
35
|
let(:adapter) { Flipper.adapter.adapter }
|
@@ -233,7 +233,7 @@ RSpec.describe Flipper::Engine do
|
|
233
233
|
it "initializes cloud configuration" do
|
234
234
|
stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")
|
235
235
|
|
236
|
-
application.initialize!
|
236
|
+
silence { application.initialize! }
|
237
237
|
|
238
238
|
expect(Flipper.instance).to be_a(Flipper::Cloud::DSL)
|
239
239
|
expect(Flipper.instance.instrumenter).to be_a(Flipper::Cloud::Telemetry::Instrumenter)
|
@@ -263,7 +263,7 @@ RSpec.describe Flipper::Engine do
|
|
263
263
|
}
|
264
264
|
|
265
265
|
it "configures webhook app" do
|
266
|
-
application.initialize!
|
266
|
+
silence { application.initialize! }
|
267
267
|
|
268
268
|
stub = stub_request(:get, "https://www.flippercloud.io/adapter/features?exclude_gate_names=true").with({
|
269
269
|
headers: { "flipper-cloud-token" => ENV["FLIPPER_CLOUD_TOKEN"] },
|
@@ -278,7 +278,7 @@ RSpec.describe Flipper::Engine do
|
|
278
278
|
|
279
279
|
context "without CLOUD_SYNC_SECRET" do
|
280
280
|
it "does not configure webhook app" do
|
281
|
-
application.initialize!
|
281
|
+
silence { application.initialize! }
|
282
282
|
|
283
283
|
post "/_flipper"
|
284
284
|
expect(last_response.status).to eq(404)
|
@@ -288,7 +288,7 @@ RSpec.describe Flipper::Engine do
|
|
288
288
|
context "without FLIPPER_CLOUD_TOKEN" do
|
289
289
|
it "gracefully skips configuring webhook app" do
|
290
290
|
ENV["FLIPPER_CLOUD_TOKEN"] = nil
|
291
|
-
application.initialize!
|
291
|
+
silence { application.initialize! }
|
292
292
|
expect(Flipper.instance).to be_a(Flipper::DSL)
|
293
293
|
|
294
294
|
post "/_flipper"
|
@@ -324,7 +324,7 @@ RSpec.describe Flipper::Engine do
|
|
324
324
|
end
|
325
325
|
|
326
326
|
it "enables cloud" do
|
327
|
-
application.initialize!
|
327
|
+
silence { application.initialize! }
|
328
328
|
expect(ENV["FLIPPER_CLOUD_TOKEN"]).to eq("credentials-token")
|
329
329
|
expect(ENV["FLIPPER_CLOUD_SYNC_SECRET"]).to eq("credentials-secret")
|
330
330
|
expect(Flipper.instance).to be_a(Flipper::Cloud::DSL)
|
@@ -339,7 +339,7 @@ RSpec.describe Flipper::Engine do
|
|
339
339
|
|
340
340
|
describe "config.actor_limit" do
|
341
341
|
let(:adapter) do
|
342
|
-
application.initialize!
|
342
|
+
silence { application.initialize! }
|
343
343
|
Flipper.adapter.adapter.adapter
|
344
344
|
end
|
345
345
|
|
@@ -285,7 +285,7 @@ RSpec.describe Flipper::Middleware::Memoizer do
|
|
285
285
|
end
|
286
286
|
|
287
287
|
def get(uri, params = {}, env = {}, &block)
|
288
|
-
|
288
|
+
capture_output { super(uri, params, env, &block) }
|
289
289
|
end
|
290
290
|
|
291
291
|
include_examples 'flipper middleware'
|
data/spec/spec_helper.rb
CHANGED
@@ -27,6 +27,9 @@ ENV["FLIPPER_CLOUD_LOGGING_ENABLED"] = "false"
|
|
27
27
|
|
28
28
|
RSpec.configure do |config|
|
29
29
|
config.before(:example) do
|
30
|
+
# default stub for telemetry
|
31
|
+
stub_request(:post, "https://www.flippercloud.io/adapter/telemetry").
|
32
|
+
to_return(status: 200, body: "", headers: {})
|
30
33
|
Flipper::Cloud::Telemetry.reset if defined?(Flipper::Cloud::Telemetry) && Flipper::Cloud::Telemetry.respond_to?(:reset)
|
31
34
|
Flipper::Poller.reset if defined?(Flipper::Poller)
|
32
35
|
Flipper.unregister_groups
|
@@ -1,7 +1,7 @@
|
|
1
1
|
if ENV["CI"] || ENV["FAIL_ON_OUTPUT"]
|
2
2
|
RSpec.configure do |config|
|
3
3
|
config.around do |example|
|
4
|
-
output =
|
4
|
+
output = capture_output { example.run }
|
5
5
|
fail "Use `silence { }` to avoid printing to STDOUT/STDERR\n#{output}" unless output.empty?
|
6
6
|
end
|
7
7
|
end
|
@@ -79,11 +79,22 @@ module SpecHelpers
|
|
79
79
|
original_stdout = $stdout
|
80
80
|
|
81
81
|
# Redirect stderr and stdout
|
82
|
-
|
82
|
+
$stderr = $stdout = StringIO.new
|
83
|
+
|
84
|
+
yield
|
85
|
+
ensure
|
86
|
+
$stderr = original_stderr
|
87
|
+
$stdout = original_stdout
|
88
|
+
end
|
89
|
+
|
90
|
+
def capture_output
|
91
|
+
original_stderr = $stderr
|
92
|
+
original_stdout = $stdout
|
93
|
+
|
94
|
+
output = $stdout = $stderr = StringIO.new
|
83
95
|
|
84
96
|
yield
|
85
97
|
|
86
|
-
# Return output
|
87
98
|
output.string
|
88
99
|
ensure
|
89
100
|
$stderr = original_stderr
|
@@ -6,6 +6,7 @@ return unless Rails::VERSION::MAJOR >= 7
|
|
6
6
|
require "capybara/cuprite"
|
7
7
|
require "flipper"
|
8
8
|
require "flipper/test_help"
|
9
|
+
require "action_controller/railtie"
|
9
10
|
|
10
11
|
require 'action_dispatch/system_testing/server'
|
11
12
|
ActionDispatch::SystemTesting::Server.silence_puma = true
|
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: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -314,7 +314,7 @@ metadata:
|
|
314
314
|
homepage_uri: https://www.flippercloud.io
|
315
315
|
source_code_uri: https://github.com/flippercloud/flipper
|
316
316
|
bug_tracker_uri: https://github.com/flippercloud/flipper/issues
|
317
|
-
changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.3.
|
317
|
+
changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.3.2
|
318
318
|
post_install_message:
|
319
319
|
rdoc_options: []
|
320
320
|
require_paths:
|
@@ -330,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
330
|
- !ruby/object:Gem::Version
|
331
331
|
version: '0'
|
332
332
|
requirements: []
|
333
|
-
rubygems_version: 3.5.
|
333
|
+
rubygems_version: 3.5.23
|
334
334
|
signing_key:
|
335
335
|
specification_version: 4
|
336
336
|
summary: Beautiful, performant feature flags for Ruby and Rails.
|