simple_feature_flags 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +74 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +14 -60
- data/.ruby-version +1 -1
- data/.vscode/settings.json +5 -1
- data/Gemfile +11 -1
- data/Gemfile.lock +79 -69
- data/Rakefile +5 -5
- data/bin/tapioca +27 -0
- data/bin/test +8 -0
- data/lib/example_files/config/initializers/simple_feature_flags.rb +4 -3
- data/lib/simple_feature_flags/base_storage.rb +296 -0
- data/lib/simple_feature_flags/cli/command/generate.rb +33 -6
- data/lib/simple_feature_flags/cli/command.rb +3 -1
- data/lib/simple_feature_flags/cli/options.rb +19 -3
- data/lib/simple_feature_flags/cli/runner.rb +13 -5
- data/lib/simple_feature_flags/cli.rb +3 -1
- data/lib/simple_feature_flags/configuration.rb +6 -0
- data/lib/simple_feature_flags/ram_storage.rb +253 -79
- data/lib/simple_feature_flags/redis_storage.rb +243 -62
- data/lib/simple_feature_flags/test_ram_storage.rb +7 -1
- data/lib/simple_feature_flags/version.rb +1 -1
- data/lib/simple_feature_flags.rb +22 -9
- data/simple_feature_flags.gemspec +17 -22
- metadata +19 -125
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a84d6f21fb85142181cf9396572ffb07ba4cb6d1573064c3ea984ab339371ddc
|
4
|
+
data.tar.gz: ca84facde85a613ceb6ecd54a88139a5ff9996838d8463d607e2e8ef93a1ce8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f74fb3b884d0523845038311ce962c5d41e24715f78f7580d1e45889c74eba9df1acd02ce37a6d6ac4e51208fb1d0b6dca0d76a097d90ebf8b367dbb46296996
|
7
|
+
data.tar.gz: e554a51da1a596189a62857ac4a4bf18ffac37578fece7680f5455222380763e4d1c55a952107b262955533cdfac8ebc7a0211f2c2378dad49d8768c7170da23
|
@@ -0,0 +1,74 @@
|
|
1
|
+
name: CI Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ 'main', 'develop' ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ 'main', 'develop' ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
services:
|
13
|
+
# Label used to access the service container
|
14
|
+
redis:
|
15
|
+
# Docker Hub image
|
16
|
+
image: redis
|
17
|
+
# Set health checks to wait until redis has started
|
18
|
+
options: >-
|
19
|
+
--health-cmd "redis-cli ping"
|
20
|
+
--health-interval 10s
|
21
|
+
--health-timeout 5s
|
22
|
+
--health-retries 5
|
23
|
+
ports:
|
24
|
+
# Maps port 6379 on service container to the host
|
25
|
+
- 6379:6379
|
26
|
+
env:
|
27
|
+
CI: true
|
28
|
+
# The hostname used to communicate with the Redis service container
|
29
|
+
REDIS_HOST: localhost
|
30
|
+
# The default Redis port
|
31
|
+
REDIS_PORT: 6379
|
32
|
+
strategy:
|
33
|
+
matrix:
|
34
|
+
ruby-version: ['3.1', '3.2', '3.3']
|
35
|
+
steps:
|
36
|
+
- name: Checkout code
|
37
|
+
uses: actions/checkout@v3
|
38
|
+
- name: Install Ruby and gems
|
39
|
+
uses: ruby/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
ruby-version: ${{ matrix.ruby-version }}
|
42
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
43
|
+
- name: Run unit tests
|
44
|
+
run: bundle exec rake test
|
45
|
+
|
46
|
+
lint:
|
47
|
+
runs-on: ubuntu-latest
|
48
|
+
env:
|
49
|
+
CI: true
|
50
|
+
steps:
|
51
|
+
- name: Checkout code
|
52
|
+
uses: actions/checkout@v3
|
53
|
+
- name: Install Ruby and gems
|
54
|
+
uses: ruby/setup-ruby@v1
|
55
|
+
with:
|
56
|
+
ruby-version: '3.3'
|
57
|
+
bundler-cache: true
|
58
|
+
- name: Lint Ruby files
|
59
|
+
run: bundle exec rubocop --parallel
|
60
|
+
|
61
|
+
typecheck:
|
62
|
+
runs-on: ubuntu-latest
|
63
|
+
env:
|
64
|
+
CI: true
|
65
|
+
steps:
|
66
|
+
- name: Checkout code
|
67
|
+
uses: actions/checkout@v3
|
68
|
+
- name: Install Ruby and gems
|
69
|
+
uses: ruby/setup-ruby@v1
|
70
|
+
with:
|
71
|
+
ruby-version: '3.3'
|
72
|
+
bundler-cache: true
|
73
|
+
- name: Typecheck Ruby files
|
74
|
+
run: bundle exec srb tc
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,78 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Style/SingleArgumentDig:
|
5
|
-
Enabled: false
|
6
|
-
|
7
|
-
Layout/LineLength:
|
8
|
-
Enabled: false
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-espago: sorbet.yml
|
9
3
|
|
10
|
-
|
4
|
+
Metrics/MethodLength:
|
11
5
|
Enabled: false
|
12
6
|
|
13
|
-
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Style/MethodCallWithArgsParentheses:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/ModuleFunction:
|
20
|
-
EnforcedStyle: 'extend_self'
|
21
|
-
|
22
|
-
Style/MissingElse:
|
7
|
+
Sorbet/RedundantExtendTSig:
|
23
8
|
Enabled: false
|
24
9
|
|
25
|
-
|
10
|
+
Sorbet/HasSigil:
|
26
11
|
Enabled: false
|
27
12
|
|
28
|
-
|
13
|
+
Metrics/ClassLength:
|
29
14
|
Enabled: false
|
30
15
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
Enabled: false
|
36
|
-
|
37
|
-
Style/FormatString:
|
38
|
-
Enabled: false
|
39
|
-
|
40
|
-
Style/DocumentationMethod:
|
41
|
-
Enabled: false
|
42
|
-
|
43
|
-
Style/Copyright:
|
44
|
-
Enabled: false
|
45
|
-
|
46
|
-
Style/StringHashKeys:
|
47
|
-
Enabled: false
|
48
|
-
|
49
|
-
Style/InlineComment:
|
50
|
-
Enabled: false
|
51
|
-
|
52
|
-
Layout/FirstHashElementLineBreak:
|
53
|
-
Enabled: false
|
54
|
-
|
55
|
-
Layout/FirstMethodArgumentLineBreak:
|
56
|
-
Enabled: false
|
57
|
-
|
58
|
-
Style/ConstantVisibility:
|
59
|
-
Enabled: false
|
60
|
-
|
61
|
-
Layout/FirstArrayElementLineBreak:
|
62
|
-
Enabled: false
|
63
|
-
|
64
|
-
Layout/MultilineMethodArgumentLineBreaks:
|
65
|
-
Enabled: false
|
16
|
+
Sorbet/EnforceSignatures:
|
17
|
+
Exclude:
|
18
|
+
- 'bin/*'
|
19
|
+
- 'test/**/*'
|
66
20
|
|
67
|
-
|
21
|
+
Sorbet/ForbidTUnsafe:
|
68
22
|
Enabled: false
|
69
23
|
|
70
|
-
|
24
|
+
Naming/BlockForwarding:
|
71
25
|
Enabled: false
|
72
26
|
|
73
27
|
AllCops:
|
28
|
+
TargetRubyVersion: 3.1.0
|
74
29
|
EnabledByDefault: true
|
75
30
|
Exclude:
|
76
31
|
- 'bin/*'
|
77
|
-
- '
|
78
|
-
- 'test/**/*'
|
32
|
+
- 'sorbet/**/*'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.6
|
data/.vscode/settings.json
CHANGED
data/Gemfile
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in simple_feature_flags.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
gem 'byebug', '~> 11.1' # debugger
|
9
|
+
gem 'minitest', '~> 5.0' # test library
|
10
|
+
gem 'rake', '~> 13.0' # automation tasks
|
11
|
+
gem 'redis', '~> 5.3' # redis client
|
12
|
+
gem 'redis-namespace', '~> 1.11' # namespaces for redis
|
13
|
+
gem 'rubocop-espago', '~> 1.0' # ruby linter
|
14
|
+
gem 'rubocop-sorbet', '~> 0.8' # rubocop for sorbet
|
15
|
+
gem 'sorbet', '>= 0.5' # static typechecker
|
16
|
+
gem 'tapioca', '> 0.13' # RBI generator for sorbet
|
data/Gemfile.lock
CHANGED
@@ -1,91 +1,101 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_feature_flags (1.
|
4
|
+
simple_feature_flags (1.3.0)
|
5
|
+
sorbet-runtime (> 0.5)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
9
10
|
ast (2.4.2)
|
10
|
-
backport (1.2.0)
|
11
|
-
benchmark (0.2.0)
|
12
|
-
bundler-audit (0.9.0.1)
|
13
|
-
bundler (>= 1.2.0, < 3)
|
14
|
-
thor (~> 1.0)
|
15
11
|
byebug (11.1.3)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
minitest (5.15.0)
|
25
|
-
nokogiri (1.13.1)
|
26
|
-
mini_portile2 (~> 2.7.0)
|
27
|
-
racc (~> 1.4)
|
28
|
-
parallel (1.21.0)
|
29
|
-
parser (3.1.0.0)
|
12
|
+
connection_pool (2.4.1)
|
13
|
+
erubi (1.13.0)
|
14
|
+
json (2.8.2)
|
15
|
+
language_server-protocol (3.17.0.3)
|
16
|
+
minitest (5.25.1)
|
17
|
+
netrc (0.11.0)
|
18
|
+
parallel (1.26.3)
|
19
|
+
parser (3.3.6.0)
|
30
20
|
ast (~> 2.4.1)
|
31
|
-
|
21
|
+
racc
|
22
|
+
prism (1.2.0)
|
23
|
+
racc (1.8.1)
|
32
24
|
rainbow (3.1.1)
|
33
|
-
rake (
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
25
|
+
rake (13.2.1)
|
26
|
+
rbi (0.2.1)
|
27
|
+
prism (~> 1.0)
|
28
|
+
sorbet-runtime (>= 0.5.9204)
|
29
|
+
redis (5.3.0)
|
30
|
+
redis-client (>= 0.22.0)
|
31
|
+
redis-client (0.22.2)
|
32
|
+
connection_pool
|
33
|
+
redis-namespace (1.11.0)
|
34
|
+
redis (>= 4)
|
35
|
+
regexp_parser (2.9.2)
|
36
|
+
rubocop (1.68.0)
|
37
|
+
json (~> 2.3)
|
38
|
+
language_server-protocol (>= 3.17.0)
|
42
39
|
parallel (~> 1.10)
|
43
|
-
parser (>= 3.
|
40
|
+
parser (>= 3.3.0.2)
|
44
41
|
rainbow (>= 2.2.2, < 4.0)
|
45
|
-
regexp_parser (>=
|
46
|
-
|
47
|
-
rubocop-ast (>= 1.15.1, < 2.0)
|
42
|
+
regexp_parser (>= 2.4, < 3.0)
|
43
|
+
rubocop-ast (>= 1.32.2, < 2.0)
|
48
44
|
ruby-progressbar (~> 1.7)
|
49
|
-
unicode-display_width (>=
|
50
|
-
rubocop-ast (1.
|
51
|
-
parser (>= 3.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
45
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
46
|
+
rubocop-ast (1.36.1)
|
47
|
+
parser (>= 3.3.1.0)
|
48
|
+
rubocop-espago (1.1.5)
|
49
|
+
rubocop
|
50
|
+
rubocop-sorbet (0.8.7)
|
51
|
+
rubocop (>= 1)
|
52
|
+
ruby-progressbar (1.13.0)
|
53
|
+
sorbet (0.5.11647)
|
54
|
+
sorbet-static (= 0.5.11647)
|
55
|
+
sorbet-runtime (0.5.11647)
|
56
|
+
sorbet-static (0.5.11647-aarch64-linux)
|
57
|
+
sorbet-static (0.5.11647-universal-darwin)
|
58
|
+
sorbet-static (0.5.11647-x86_64-linux)
|
59
|
+
sorbet-static-and-runtime (0.5.11647)
|
60
|
+
sorbet (= 0.5.11647)
|
61
|
+
sorbet-runtime (= 0.5.11647)
|
62
|
+
spoom (1.5.0)
|
63
|
+
erubi (>= 1.10.0)
|
64
|
+
prism (>= 0.28.0)
|
65
|
+
sorbet-static-and-runtime (>= 0.5.10187)
|
66
|
+
thor (>= 0.19.2)
|
67
|
+
tapioca (0.16.4)
|
68
|
+
bundler (>= 2.2.25)
|
69
|
+
netrc (>= 0.11.0)
|
70
|
+
parallel (>= 1.21.0)
|
71
|
+
rbi (~> 0.2)
|
72
|
+
sorbet-static-and-runtime (>= 0.5.11087)
|
73
|
+
spoom (>= 1.2.0)
|
74
|
+
thor (>= 1.2.0)
|
75
|
+
yard-sorbet
|
76
|
+
thor (1.3.2)
|
77
|
+
unicode-display_width (2.6.0)
|
78
|
+
yard (0.9.37)
|
79
|
+
yard-sorbet (0.9.0)
|
80
|
+
sorbet-runtime
|
81
|
+
yard
|
74
82
|
|
75
83
|
PLATFORMS
|
76
|
-
|
84
|
+
aarch64-linux
|
85
|
+
universal-darwin
|
86
|
+
x86_64-linux
|
77
87
|
|
78
88
|
DEPENDENCIES
|
79
|
-
|
80
|
-
bundler-audit
|
81
|
-
byebug
|
89
|
+
byebug (~> 11.1)
|
82
90
|
minitest (~> 5.0)
|
83
|
-
rake (~>
|
84
|
-
redis
|
85
|
-
redis-namespace
|
86
|
-
rubocop
|
91
|
+
rake (~> 13.0)
|
92
|
+
redis (~> 5.3)
|
93
|
+
redis-namespace (~> 1.11)
|
94
|
+
rubocop-espago (~> 1.0)
|
95
|
+
rubocop-sorbet (~> 0.8)
|
87
96
|
simple_feature_flags!
|
88
|
-
|
97
|
+
sorbet (>= 0.5)
|
98
|
+
tapioca (> 0.13)
|
89
99
|
|
90
100
|
BUNDLED WITH
|
91
|
-
2.
|
101
|
+
2.5.22
|
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
5
5
|
|
6
6
|
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs <<
|
8
|
-
t.libs <<
|
9
|
-
t.test_files = FileList[
|
7
|
+
t.libs << 'test'
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
10
10
|
end
|
11
11
|
|
12
12
|
task default: :test
|
data/bin/tapioca
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'tapioca' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("tapioca", "tapioca")
|
data/bin/test
ADDED
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# Redis has 16 DBs (0 to 15)
|
3
4
|
|
4
5
|
FEATURE_FLAGS = if ::Rails.env.test?
|
5
6
|
# Use RamStorage in tests to make them faster
|
6
|
-
::SimpleFeatureFlags::RamStorage.new("#{::Rails.root
|
7
|
+
::SimpleFeatureFlags::RamStorage.new("#{::Rails.root}/config/simple_feature_flags.yml")
|
7
8
|
else
|
8
|
-
redis = ::Redis.new(host: '127.0.0.1', port: 6379, db: 0)
|
9
|
+
redis = ::Redis.new(host: '127.0.0.1', port: 6379, db: 0) # rubocop:disable Style/IpAddresses
|
9
10
|
# We recommend using the `redis-namespace` gem to avoid key conflicts with Sidekiq or Resque
|
10
11
|
# redis = ::Redis::Namespace.new(:simple_feature_flags, redis: redis)
|
11
12
|
|
12
|
-
::SimpleFeatureFlags::RedisStorage.new(redis, "#{::Rails.root
|
13
|
+
::SimpleFeatureFlags::RedisStorage.new(redis, "#{::Rails.root}/config/simple_feature_flags.yml")
|
13
14
|
end
|