flipper-sequel 0.22.1 → 0.24.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: 5ce2ffdf3cf436c77fb8ba03a3c029d29de3fb4f9c957432802d44b1eaf8da9e
4
- data.tar.gz: 9326d3430684b8b0b6be6f01548d7cbbf392a8f3ed12715c12fb4ea00ce36174
3
+ metadata.gz: 7183c4a2d7addd2208904c326515f7948ab8f30145e7aed0eac64e090ab51a21
4
+ data.tar.gz: f3da7794f3e85b8cd42e375e7df3e156405b61d9d82c6f6193b65792e2970dd5
5
5
  SHA512:
6
- metadata.gz: 5d1031cbbdcabe73ef9feac30dd00d7ccfcb955abb24283f615bf19d70265c86cd0f2bc6eeeea96abb0028eee1a8848ea15699dceeb421a927a725156f03d7fb
7
- data.tar.gz: 9acf7c0ea2ec149ea78334f305c2ff704d95207b0dc63fe708038fb94a92422917546b9f95c9a338316c2eb8da5792f4ae7ba7c2cd23e533532299a730441766
6
+ metadata.gz: 979bdab0c6e6d013d385ce6a27c1240cb1dac679f1fd3c999688e4296ed4a0959bc115718372e393149df86cca1b1424d1c597505a8ac6619028d329373f3780
7
+ data.tar.gz: 442dd7163e264895ec4bfc19e02719d7f792f8e06ff69fba8749afa2d279fee6cfbed40e4759e36b7a7d62146a8991d456f546881e20fd1849d65141a868d781
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.22.1'.freeze
2
+ VERSION = '0.24.0'.freeze
3
3
  end
@@ -1,4 +1,3 @@
1
- require 'helper'
2
1
  require 'sequel'
3
2
 
4
3
  Sequel::Model.db = Sequel.sqlite(':memory:')
@@ -6,7 +5,6 @@ Sequel.extension :migration, :core_extensions
6
5
 
7
6
  require 'flipper/adapters/sequel'
8
7
  require 'generators/flipper/templates/sequel_migration'
9
- require 'flipper/spec/shared_adapter_specs'
10
8
 
11
9
  RSpec.describe Flipper::Adapters::Sequel do
12
10
  subject do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flipper
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.22.1
19
+ version: 0.24.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.22.1
26
+ version: 0.24.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sequel
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -51,7 +51,6 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
- - docs/sequel/README.md
55
54
  - examples/sequel/basic.rb
56
55
  - examples/sequel/internals.rb
57
56
  - flipper-sequel.gemspec
@@ -81,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
80
  - !ruby/object:Gem::Version
82
81
  version: '0'
83
82
  requirements: []
84
- rubygems_version: 3.0.3
83
+ rubygems_version: 3.1.2
85
84
  signing_key:
86
85
  specification_version: 4
87
86
  summary: Sequel adapter for Flipper
@@ -1,103 +0,0 @@
1
- # Flipper Sequel
2
-
3
- A [Sequel](https://github.com/jeremyevans/sequel) adapter for [Flipper](https://github.com/jnunemaker/flipper).
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'flipper-sequel'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself with:
16
-
17
- $ gem install flipper-sequel
18
-
19
- ## Usage
20
-
21
- For your convenience, a sequel migration is provided to create the necessary tables. This migration will create two database tables - flipper_features and flipper_gates.
22
-
23
- ```ruby
24
- require 'generators/flipper/templates/sequel_migration'
25
- CreateFlipperTablesSequel.new(Sequel::Model.db).up
26
- ```
27
-
28
- Once you have created and executed the migration, you can use the sequel adapter by simply requiring it:
29
-
30
- ```ruby
31
- require 'flipper-sequel`
32
- ```
33
-
34
- **If you need to customize the adapter**, you can add this to an initializer:
35
-
36
- ```ruby
37
- Flipper.configure do |config|
38
- config.adapter { Flipper::Adapters::Sequel.new }
39
- end
40
- ```
41
-
42
- ## Internals
43
-
44
- Each feature is stored as a row in a features table. Each gate is stored as a row in a gates table, related to the feature by the feature's key.
45
-
46
- ```ruby
47
- require 'flipper/adapters/sequel'
48
- adapter = Flipper::Adapters::Sequel.new
49
- flipper = Flipper.new(adapter)
50
-
51
- # Register a few groups.
52
- Flipper.register(:admins) { |thing| thing.admin? }
53
- Flipper.register(:early_access) { |thing| thing.early_access? }
54
-
55
- # Create a user class that has flipper_id instance method.
56
- User = Struct.new(:flipper_id)
57
-
58
- flipper[:stats].enable
59
- flipper[:stats].enable_group :admins
60
- flipper[:stats].enable_group :early_access
61
- flipper[:stats].enable_actor User.new('25')
62
- flipper[:stats].enable_actor User.new('90')
63
- flipper[:stats].enable_actor User.new('180')
64
- flipper[:stats].enable_percentage_of_time 15
65
- flipper[:stats].enable_percentage_of_actors 45
66
-
67
- flipper[:search].enable
68
-
69
- puts 'all rows in features table'
70
- pp Flipper::Adapters::Sequel::Feature.all
71
- #[#<Flipper::Adapters::Sequel::Feature @values={:key=>"stats", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
72
- # #<Flipper::Adapters::Sequel::Feature @values={:key=>"search", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>]
73
- puts
74
-
75
- puts 'all rows in gates table'
76
- pp Flipper::Adapters::Sequel::Gate.all
77
- # [#<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"boolean", :value=>"true", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
78
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"groups", :value=>"admins", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
79
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"groups", :value=>"early_access", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
80
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"actors", :value=>"25", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
81
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"actors", :value=>"90", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
82
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"actors", :value=>"180", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
83
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"percentage_of_time", :value=>"15", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
84
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"stats", :key=>"percentage_of_actors", :value=>"45", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>,
85
- # #<Flipper::Adapters::Sequel::Gate @values={:feature_key=>"search", :key=>"boolean", :value=>"true", :created_at=>2016-11-19 13:57:48 -0500, :updated_at=>2016-11-19 13:57:48 -0500}>]
86
- puts
87
-
88
- puts 'flipper get of feature'
89
- pp adapter.get(flipper[:stats])
90
- # {:boolean=>"true",
91
- # :groups=>#<Set: {"admins", "early_access"}>,
92
- # :actors=>#<Set: {"180", "25", "90"}>,
93
- # :percentage_of_actors=>"45",
94
- # :percentage_of_time=>"15"}
95
- ```
96
-
97
- ## Contributing
98
-
99
- 1. Fork it
100
- 2. Create your feature branch (`git checkout -b my-new-feature`)
101
- 3. Commit your changes (`git commit -am 'Added some feature'`)
102
- 4. Push to the branch (`git push origin my-new-feature`)
103
- 5. Create new Pull Request