simple_feature_flags 1.2.0 → 1.4.0
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 +74 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +15 -58
- data/.ruby-version +1 -1
- data/.vscode/settings.json +5 -1
- data/Gemfile +11 -1
- data/Gemfile.lock +84 -70
- 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 +332 -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 +292 -80
- data/lib/simple_feature_flags/redis_storage.rb +282 -63
- 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 +23 -6
- data/simple_feature_flags.gemspec +17 -22
- metadata +19 -128
- 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: 4ec2b8373585148b5a35440da4b652b80939c9a206e8fcd9a77d352d4c73a291
|
4
|
+
data.tar.gz: 62ee0f5e72b494c7d9e8af4edace2d46bc7345bcc1dc7988e4f576b0b7d16e8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1df864803d24acba2331e3dc1d8da16dca764c3d321208f712cc9d34291be9f1742ec200d7ab4f4e87b7a0e2d035a79573189319b34867053c98332c1b1df0
|
7
|
+
data.tar.gz: 92400c60aef05bf3ad039123dd830af4e3b0c00a34e01d7d8ef72b905f67dc7fa0fd8e30b215c563a656a7ac545b0df0be0ea59233c3d6d3373677a72f5ae7d0
|
@@ -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.2', '3.3', '3.4']
|
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,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Style/SingleArgumentDig:
|
5
|
-
Enabled: false
|
6
|
-
|
7
|
-
Layout/LineLength:
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
Style/Documentation:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
Style/ClassAndModuleChildren:
|
14
|
-
Enabled: false
|
15
|
-
|
16
|
-
Style/MethodCallWithArgsParentheses:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/ModuleFunction:
|
20
|
-
EnforcedStyle: 'extend_self'
|
21
|
-
|
22
|
-
Style/MissingElse:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Lint/NumberConversion:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Lint/ConstantResolution:
|
29
|
-
Enabled: false
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-espago: sorbet.yml
|
30
3
|
|
31
|
-
|
4
|
+
Metrics/MethodLength:
|
32
5
|
Enabled: false
|
33
6
|
|
34
|
-
|
7
|
+
Sorbet/RedundantExtendTSig:
|
35
8
|
Enabled: false
|
36
9
|
|
37
|
-
|
10
|
+
Sorbet/HasSigil:
|
38
11
|
Enabled: false
|
39
12
|
|
40
|
-
|
13
|
+
Metrics/ClassLength:
|
41
14
|
Enabled: false
|
42
15
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
16
|
+
Sorbet/EnforceSignatures:
|
17
|
+
Exclude:
|
18
|
+
- 'bin/*'
|
19
|
+
- 'test/**/*'
|
63
20
|
|
64
|
-
|
21
|
+
Sorbet/ForbidTUnsafe:
|
65
22
|
Enabled: false
|
66
23
|
|
67
|
-
|
24
|
+
Naming/BlockForwarding:
|
68
25
|
Enabled: false
|
69
26
|
|
70
|
-
|
27
|
+
Sorbet/ForbidSig:
|
71
28
|
Enabled: false
|
72
29
|
|
73
30
|
AllCops:
|
31
|
+
TargetRubyVersion: 3.2.0
|
74
32
|
EnabledByDefault: true
|
75
33
|
Exclude:
|
76
34
|
- 'bin/*'
|
77
|
-
- '
|
78
|
-
- 'test/**/*'
|
35
|
+
- 'sorbet/**/*'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.4.3
|
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.1' # ruby linter
|
14
|
+
gem 'rubocop-sorbet', '~> 0.10' # 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,105 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_feature_flags (1.
|
4
|
+
simple_feature_flags (1.4.0)
|
5
|
+
sorbet-runtime (> 0.5)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
9
|
-
ast (2.4.
|
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)
|
10
|
+
ast (2.4.3)
|
15
11
|
byebug (11.1.3)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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.10.2)
|
15
|
+
language_server-protocol (3.17.0.4)
|
16
|
+
lint_roller (1.1.0)
|
17
|
+
minitest (5.25.1)
|
18
|
+
netrc (0.11.0)
|
19
|
+
parallel (1.27.0)
|
20
|
+
parser (3.3.8.0)
|
30
21
|
ast (~> 2.4.1)
|
31
|
-
|
22
|
+
racc
|
23
|
+
prism (1.2.0)
|
24
|
+
racc (1.8.1)
|
32
25
|
rainbow (3.1.1)
|
33
|
-
rake (
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
26
|
+
rake (13.2.1)
|
27
|
+
rbi (0.2.1)
|
28
|
+
prism (~> 1.0)
|
29
|
+
sorbet-runtime (>= 0.5.9204)
|
30
|
+
redis (5.3.0)
|
31
|
+
redis-client (>= 0.22.0)
|
32
|
+
redis-client (0.22.2)
|
33
|
+
connection_pool
|
34
|
+
redis-namespace (1.11.0)
|
35
|
+
redis (>= 4)
|
36
|
+
regexp_parser (2.10.0)
|
37
|
+
rubocop (1.74.0)
|
38
|
+
json (~> 2.3)
|
39
|
+
language_server-protocol (~> 3.17.0.2)
|
40
|
+
lint_roller (~> 1.1.0)
|
42
41
|
parallel (~> 1.10)
|
43
|
-
parser (>= 3.
|
42
|
+
parser (>= 3.3.0.2)
|
44
43
|
rainbow (>= 2.2.2, < 4.0)
|
45
|
-
regexp_parser (>=
|
46
|
-
|
47
|
-
rubocop-ast (>= 1.15.1, < 2.0)
|
44
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
45
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
48
46
|
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
|
-
|
47
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
48
|
+
rubocop-ast (1.42.0)
|
49
|
+
parser (>= 3.3.7.2)
|
50
|
+
rubocop-espago (1.1.8)
|
51
|
+
rubocop
|
52
|
+
rubocop-sorbet (0.10.0)
|
53
|
+
rubocop (>= 1)
|
54
|
+
ruby-progressbar (1.13.0)
|
55
|
+
sorbet (0.5.11647)
|
56
|
+
sorbet-static (= 0.5.11647)
|
57
|
+
sorbet-runtime (0.5.11647)
|
58
|
+
sorbet-static (0.5.11647-aarch64-linux)
|
59
|
+
sorbet-static (0.5.11647-universal-darwin)
|
60
|
+
sorbet-static (0.5.11647-x86_64-linux)
|
61
|
+
sorbet-static-and-runtime (0.5.11647)
|
62
|
+
sorbet (= 0.5.11647)
|
63
|
+
sorbet-runtime (= 0.5.11647)
|
64
|
+
spoom (1.5.0)
|
65
|
+
erubi (>= 1.10.0)
|
66
|
+
prism (>= 0.28.0)
|
67
|
+
sorbet-static-and-runtime (>= 0.5.10187)
|
68
|
+
thor (>= 0.19.2)
|
69
|
+
tapioca (0.16.4)
|
70
|
+
bundler (>= 2.2.25)
|
71
|
+
netrc (>= 0.11.0)
|
72
|
+
parallel (>= 1.21.0)
|
73
|
+
rbi (~> 0.2)
|
74
|
+
sorbet-static-and-runtime (>= 0.5.11087)
|
75
|
+
spoom (>= 1.2.0)
|
76
|
+
thor (>= 1.2.0)
|
77
|
+
yard-sorbet
|
78
|
+
thor (1.3.2)
|
79
|
+
unicode-display_width (3.1.4)
|
80
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
81
|
+
unicode-emoji (4.0.4)
|
82
|
+
yard (0.9.37)
|
83
|
+
yard-sorbet (0.9.0)
|
84
|
+
sorbet-runtime
|
85
|
+
yard
|
74
86
|
|
75
87
|
PLATFORMS
|
76
|
-
|
88
|
+
aarch64-linux
|
89
|
+
universal-darwin
|
90
|
+
x86_64-linux
|
77
91
|
|
78
92
|
DEPENDENCIES
|
79
|
-
|
80
|
-
bundler-audit
|
81
|
-
byebug
|
93
|
+
byebug (~> 11.1)
|
82
94
|
minitest (~> 5.0)
|
83
|
-
rake (~>
|
84
|
-
redis
|
85
|
-
redis-namespace
|
86
|
-
rubocop
|
95
|
+
rake (~> 13.0)
|
96
|
+
redis (~> 5.3)
|
97
|
+
redis-namespace (~> 1.11)
|
98
|
+
rubocop-espago (~> 1.1)
|
99
|
+
rubocop-sorbet (~> 0.10)
|
87
100
|
simple_feature_flags!
|
88
|
-
|
101
|
+
sorbet (>= 0.5)
|
102
|
+
tapioca (> 0.13)
|
89
103
|
|
90
104
|
BUNDLED WITH
|
91
|
-
2.
|
105
|
+
2.6.8
|
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
|