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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27f8966e824b5b17fd9c76095203e7bb4999d7332e64dcc32c43dcc8784541b2
4
- data.tar.gz: 907626c29e851f93aeddd9e1be8d63dac9c85f7fb13ad0424bddbf83fe1e58d1
3
+ metadata.gz: 4ec2b8373585148b5a35440da4b652b80939c9a206e8fcd9a77d352d4c73a291
4
+ data.tar.gz: 62ee0f5e72b494c7d9e8af4edace2d46bc7345bcc1dc7988e4f576b0b7d16e8a
5
5
  SHA512:
6
- metadata.gz: 420763922a049e720412d3dff1a9461c953ab4be1e7d4991b5b0b15f96d22d162c2a169071a31bd528fc3f87dc8f59bfc2c95ae21c6e0751a34b0a7187d8c4e4
7
- data.tar.gz: 6403704ba929bfa87268e30676f1b15d520796be973485457ddf55ddccd81f6cbb922c4015decfd8dd95fa009c3305e0030e3881471989784dbabc53d33f9a10
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
@@ -6,5 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /.vscode
9
10
  .byebug_history
10
11
  my_examples
data/.rubocop.yml CHANGED
@@ -1,78 +1,35 @@
1
- Style/StringLiterals:
2
- Enabled: false
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
- Style/RescueStandardError:
4
+ Metrics/MethodLength:
32
5
  Enabled: false
33
6
 
34
- Style/FormatStringToken:
7
+ Sorbet/RedundantExtendTSig:
35
8
  Enabled: false
36
9
 
37
- Style/FormatString:
10
+ Sorbet/HasSigil:
38
11
  Enabled: false
39
12
 
40
- Style/DocumentationMethod:
13
+ Metrics/ClassLength:
41
14
  Enabled: false
42
15
 
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
16
+ Sorbet/EnforceSignatures:
17
+ Exclude:
18
+ - 'bin/*'
19
+ - 'test/**/*'
63
20
 
64
- Layout/MultilineMethodArgumentLineBreaks:
21
+ Sorbet/ForbidTUnsafe:
65
22
  Enabled: false
66
23
 
67
- Layout/MultilineAssignmentLayout:
24
+ Naming/BlockForwarding:
68
25
  Enabled: false
69
26
 
70
- Bundler/GemComment:
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
- - 'spec/**/*'
78
- - 'test/**/*'
35
+ - 'sorbet/**/*'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.4
1
+ 3.4.3
@@ -13,5 +13,9 @@
13
13
  "optparse",
14
14
  "solargraph",
15
15
  "testtask"
16
- ]
16
+ ],
17
+ "sorbet.enabled": true,
18
+ "[ruby]": {
19
+ "editor.defaultFormatter": "Shopify.ruby-lsp"
20
+ }
17
21
  }
data/Gemfile CHANGED
@@ -1,6 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
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.2.0)
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.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)
10
+ ast (2.4.3)
15
11
  byebug (11.1.3)
16
- diff-lcs (1.5.0)
17
- e2mmap (0.1.0)
18
- jaro_winkler (1.5.4)
19
- kramdown (2.3.1)
20
- rexml
21
- kramdown-parser-gfm (1.1.0)
22
- kramdown (~> 2.0)
23
- mini_portile2 (2.7.1)
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.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
- racc (1.6.0)
22
+ racc
23
+ prism (1.2.0)
24
+ racc (1.8.1)
32
25
  rainbow (3.1.1)
33
- rake (12.3.3)
34
- redis (4.6.0)
35
- redis-namespace (1.8.1)
36
- redis (>= 3.0.4)
37
- regexp_parser (2.2.1)
38
- reverse_markdown (2.1.1)
39
- nokogiri
40
- rexml (3.2.5)
41
- rubocop (1.25.1)
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.1.0.0)
42
+ parser (>= 3.3.0.2)
44
43
  rainbow (>= 2.2.2, < 4.0)
45
- regexp_parser (>= 1.8, < 3.0)
46
- rexml
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 (>= 1.4.0, < 3.0)
50
- rubocop-ast (1.15.2)
51
- parser (>= 3.0.1.1)
52
- ruby-progressbar (1.11.0)
53
- solargraph (0.44.3)
54
- backport (~> 1.2)
55
- benchmark
56
- bundler (>= 1.17.2)
57
- diff-lcs (~> 1.4)
58
- e2mmap
59
- jaro_winkler (~> 1.5)
60
- kramdown (~> 2.3)
61
- kramdown-parser-gfm (~> 1.1)
62
- parser (~> 3.0)
63
- reverse_markdown (>= 1.0.5, < 3)
64
- rubocop (>= 0.52)
65
- thor (~> 1.0)
66
- tilt (~> 2.0)
67
- yard (~> 0.9, >= 0.9.24)
68
- thor (1.2.1)
69
- tilt (2.0.10)
70
- unicode-display_width (2.1.0)
71
- webrick (1.7.0)
72
- yard (0.9.27)
73
- webrick (~> 1.7.0)
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
- ruby
88
+ aarch64-linux
89
+ universal-darwin
90
+ x86_64-linux
77
91
 
78
92
  DEPENDENCIES
79
- bundler
80
- bundler-audit
81
- byebug
93
+ byebug (~> 11.1)
82
94
  minitest (~> 5.0)
83
- rake (~> 12.0)
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
- solargraph
101
+ sorbet (>= 0.5)
102
+ tapioca (> 0.13)
89
103
 
90
104
  BUNDLED WITH
91
- 2.1.4
105
+ 2.6.8
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rake/testtask"
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
5
 
6
6
  Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb"]
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle exec rubocop --parallel --color
7
+ bundle exec srb tc
8
+ bundle exec rake test
@@ -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.to_s}/config/simple_feature_flags.yml")
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.to_s}/config/simple_feature_flags.yml")
13
+ ::SimpleFeatureFlags::RedisStorage.new(redis, "#{::Rails.root}/config/simple_feature_flags.yml")
13
14
  end