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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27f8966e824b5b17fd9c76095203e7bb4999d7332e64dcc32c43dcc8784541b2
4
- data.tar.gz: 907626c29e851f93aeddd9e1be8d63dac9c85f7fb13ad0424bddbf83fe1e58d1
3
+ metadata.gz: a84d6f21fb85142181cf9396572ffb07ba4cb6d1573064c3ea984ab339371ddc
4
+ data.tar.gz: ca84facde85a613ceb6ecd54a88139a5ff9996838d8463d607e2e8ef93a1ce8e
5
5
  SHA512:
6
- metadata.gz: 420763922a049e720412d3dff1a9461c953ab4be1e7d4991b5b0b15f96d22d162c2a169071a31bd528fc3f87dc8f59bfc2c95ae21c6e0751a34b0a7187d8c4e4
7
- data.tar.gz: 6403704ba929bfa87268e30676f1b15d520796be973485457ddf55ddccd81f6cbb922c4015decfd8dd95fa009c3305e0030e3881471989784dbabc53d33f9a10
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
@@ -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,32 @@
1
- Style/StringLiterals:
2
- Enabled: false
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
- Style/Documentation:
4
+ Metrics/MethodLength:
11
5
  Enabled: false
12
6
 
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:
7
+ Sorbet/RedundantExtendTSig:
23
8
  Enabled: false
24
9
 
25
- Lint/NumberConversion:
10
+ Sorbet/HasSigil:
26
11
  Enabled: false
27
12
 
28
- Lint/ConstantResolution:
13
+ Metrics/ClassLength:
29
14
  Enabled: false
30
15
 
31
- Style/RescueStandardError:
32
- Enabled: false
33
-
34
- Style/FormatStringToken:
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
- Layout/MultilineAssignmentLayout:
21
+ Sorbet/ForbidTUnsafe:
68
22
  Enabled: false
69
23
 
70
- Bundler/GemComment:
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
- - 'spec/**/*'
78
- - 'test/**/*'
32
+ - 'sorbet/**/*'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.4
1
+ 3.3.6
@@ -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.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.2.0)
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
- 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.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
- racc (1.6.0)
21
+ racc
22
+ prism (1.2.0)
23
+ racc (1.8.1)
32
24
  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)
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.1.0.0)
40
+ parser (>= 3.3.0.2)
44
41
  rainbow (>= 2.2.2, < 4.0)
45
- regexp_parser (>= 1.8, < 3.0)
46
- rexml
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 (>= 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)
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
- ruby
84
+ aarch64-linux
85
+ universal-darwin
86
+ x86_64-linux
77
87
 
78
88
  DEPENDENCIES
79
- bundler
80
- bundler-audit
81
- byebug
89
+ byebug (~> 11.1)
82
90
  minitest (~> 5.0)
83
- rake (~> 12.0)
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
- solargraph
97
+ sorbet (>= 0.5)
98
+ tapioca (> 0.13)
89
99
 
90
100
  BUNDLED WITH
91
- 2.1.4
101
+ 2.5.22
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