flipper-active_record 0.22.2 → 0.23.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: 912bdcd897f28bba90d89b435bb107e5b120291d1a5640f52281c95b642e7219
4
- data.tar.gz: 9a82dad8ea4bf325bf4c81406090653ce1930a1c1cd9901351c67d9c255be60e
3
+ metadata.gz: 2e230d47ea0260497feb15587a8d67b2820a3f43845aca3f07137c0d9003413a
4
+ data.tar.gz: 682c323dfc39cf85f11ef7ebf2887d2d44ba0abc904194cf88f319c7d9ce65b9
5
5
  SHA512:
6
- metadata.gz: 54a974e2666d2afb8bea885b775004ba84ea84d947a6b47b68136171442c4d4daf623979d816eeafb7844008d6c2df71daa16cf42b6b7d3be4979802055a2527
7
- data.tar.gz: 3d06634017bd951b9ec1cd9ac5e5f3186d31c85391fca1f4119fbf651a182ad1d61eb2d66f86709ba091c657f18b65399004c20f36edc1361676763881a7837c
6
+ metadata.gz: ed98478b3622f3af55513f0597f8e3e4d932e274ea53d9ac4e5202aaa86743f37246ce933beda9739feeb77254a6dd547b8c4b21cfc1e6bb9d7a295def3132c8
7
+ data.tar.gz: cd915699d669fb083a4603086b96698f08681e6fdab1ba378afb440c267b819c6040ff400d1ffded79e5d4d8637af0ac3e106729e4ad040b6f53be31e4b5ba1d
@@ -25,5 +25,5 @@ Gem::Specification.new do |gem|
25
25
  gem.metadata = Flipper::METADATA
26
26
 
27
27
  gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
28
- gem.add_dependency 'activerecord', '>= 4.2', '< 7'
28
+ gem.add_dependency 'activerecord', '>= 4.2', '< 8'
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.22.2'.freeze
2
+ VERSION = '0.23.0'.freeze
3
3
  end
@@ -1,6 +1,4 @@
1
- require 'helper'
2
1
  require 'flipper/adapters/active_record'
3
- require 'flipper/spec/shared_adapter_specs'
4
2
 
5
3
  # Turn off migration logging for specs
6
4
  ActiveRecord::Migration.verbose = false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.2
4
+ version: 0.23.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-10-06 00:00:00.000000000 Z
11
+ date: 2021-12-24 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.2
19
+ version: 0.23.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.2
26
+ version: 0.23.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '4.2'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '7'
36
+ version: '8'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '4.2'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '7'
46
+ version: '8'
47
47
  description:
48
48
  email:
49
49
  - nunemaker@gmail.com
@@ -51,7 +51,6 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
- - docs/active_record/README.md
55
54
  - examples/active_record/ar_setup.rb
56
55
  - examples/active_record/basic.rb
57
56
  - examples/active_record/internals.rb
@@ -84,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
83
  - !ruby/object:Gem::Version
85
84
  version: '0'
86
85
  requirements: []
87
- rubygems_version: 3.0.3
86
+ rubygems_version: 3.1.2
88
87
  signing_key:
89
88
  specification_version: 4
90
89
  summary: ActiveRecord adapter for Flipper
@@ -1,156 +0,0 @@
1
- # Flipper ActiveRecord
2
-
3
- An ActiveRecord adapter for [Flipper](https://github.com/jnunemaker/flipper).
4
-
5
- Supported Active Record versions:
6
-
7
- * 5.0.x
8
- * 6.0.x
9
-
10
- ## Installation
11
-
12
- Add this line to your application's Gemfile:
13
-
14
- gem 'flipper-active_record'
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself with:
21
-
22
- $ gem install flipper-active_record
23
-
24
- ## Usage
25
-
26
- For your convenience a migration generator is provided to create the necessary migrations for using the active record adapter. By default this generates a migration that will create two database tables - `flipper_features` and `flipper_gates`.
27
-
28
- $ rails g flipper:active_record
29
-
30
- Note that the active record adapter requires the database tables to be created in order to work; failure to run the migration first will cause an exception to be raised when attempting to initialize the active record adapter.
31
-
32
- Flipper will be configured to use the ActiveRecord adapter when `flipper-active_record` is loaded. But **if you need to customize the adapter**, you can add this to an initializer:
33
-
34
- ```ruby
35
- require 'flipper/adapters/active_record'
36
- Flipper.configure do |config|
37
- config.adapter { Flipper::Adapters::ActiveRecord.new }
38
- end
39
- ```
40
-
41
- ## Internals
42
-
43
- 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.
44
-
45
- ```ruby
46
- # Register a few groups.
47
- Flipper.register(:admins) { |thing| thing.admin? }
48
- Flipper.register(:early_access) { |thing| thing.early_access? }
49
-
50
- # Create a user class that has flipper_id instance method.
51
- User = Struct.new(:flipper_id)
52
-
53
- Flipper.enable :stats
54
- Flipper.enable_group :stats, :admins
55
- Flipper.enable_group :stats, :early_access
56
- Flipper.enable_actor :stats, User.new('25')
57
- Flipper.enable_actor :stats, User.new('90')
58
- Flipper.enable_actor :stats, User.new('180')
59
- Flipper.enable_percentage_of_time :stats, 15
60
- Flipper.enable_percentage_of_actors :stats, 45
61
-
62
- Flipper.enable :search
63
-
64
- puts 'all rows in features table'
65
- pp Flipper::Adapters::ActiveRecord::Feature.all
66
- # [#<Flipper::Adapters::ActiveRecord::Feature:0x007fd259b47110
67
- # id: 1,
68
- # key: "stats",
69
- # created_at: 2015-12-21 16:26:29 UTC,
70
- # updated_at: 2015-12-21 16:26:29 UTC>,
71
- # #<Flipper::Adapters::ActiveRecord::Feature:0x007fd259b46cd8
72
- # id: 2,
73
- # key: "search",
74
- # created_at: 2015-12-21 16:26:29 UTC,
75
- # updated_at: 2015-12-21 16:26:29 UTC>]
76
- puts
77
-
78
- puts 'all rows in gates table'
79
- pp Flipper::Adapters::ActiveRecord::Gate.all
80
- # [#<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0f0f8
81
- # id: 1,
82
- # feature_key: "stats",
83
- # key: "boolean",
84
- # value: "true",
85
- # created_at: 2015-12-21 16:26:29 UTC,
86
- # updated_at: 2015-12-21 16:26:29 UTC>,
87
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0ebd0
88
- # id: 2,
89
- # feature_key: "stats",
90
- # key: "groups",
91
- # value: "admins",
92
- # created_at: 2015-12-21 16:26:29 UTC,
93
- # updated_at: 2015-12-21 16:26:29 UTC>,
94
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0e748
95
- # id: 3,
96
- # feature_key: "stats",
97
- # key: "groups",
98
- # value: "early_access",
99
- # created_at: 2015-12-21 16:26:29 UTC,
100
- # updated_at: 2015-12-21 16:26:29 UTC>,
101
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0e568
102
- # id: 4,
103
- # feature_key: "stats",
104
- # key: "actors",
105
- # value: "25",
106
- # created_at: 2015-12-21 16:26:29 UTC,
107
- # updated_at: 2015-12-21 16:26:29 UTC>,
108
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0e0b8
109
- # id: 5,
110
- # feature_key: "stats",
111
- # key: "actors",
112
- # value: "90",
113
- # created_at: 2015-12-21 16:26:29 UTC,
114
- # updated_at: 2015-12-21 16:26:29 UTC>,
115
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0da50
116
- # id: 6,
117
- # feature_key: "stats",
118
- # key: "actors",
119
- # value: "180",
120
- # created_at: 2015-12-21 16:26:29 UTC,
121
- # updated_at: 2015-12-21 16:26:29 UTC>,
122
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0d3c0
123
- # id: 7,
124
- # feature_key: "stats",
125
- # key: "percentage_of_time",
126
- # value: "15",
127
- # created_at: 2015-12-21 16:26:29 UTC,
128
- # updated_at: 2015-12-21 16:26:29 UTC>,
129
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0cdf8
130
- # id: 8,
131
- # feature_key: "stats",
132
- # key: "percentage_of_actors",
133
- # value: "45",
134
- # created_at: 2015-12-21 16:26:29 UTC,
135
- # updated_at: 2015-12-21 16:26:29 UTC>,
136
- # #<Flipper::Adapters::ActiveRecord::Gate:0x007fd259b0cbf0
137
- # id: 9,
138
- # feature_key: "search",
139
- # key: "boolean",
140
- # value: "true",
141
- # created_at: 2015-12-21 16:26:29 UTC,
142
- # updated_at: 2015-12-21 16:26:29 UTC>]
143
- puts
144
-
145
- puts 'flipper get of feature'
146
- pp adapter.get(flipper[:stats])
147
- # flipper get of feature
148
- ```
149
-
150
- ## Contributing
151
-
152
- 1. Fork it
153
- 2. Create your feature branch (`git checkout -b my-new-feature`)
154
- 3. Commit your changes (`git commit -am 'Added some feature'`)
155
- 4. Push to the branch (`git push origin my-new-feature`)
156
- 5. Create new Pull Request