flipper-sequel 0.17.1 → 0.17.2

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: 8572027a4d492f0195bfb859807cf01f1db5f27039808513a61784819fe830b9
4
- data.tar.gz: 89a75746d43949b3bc7c1ead22cf61454ab56e41a11509037a2cd177bd1f1c3a
3
+ metadata.gz: a1afcc212e2af0dbe0889170d98cb7b7a4f32c89646b875817c7d0cbad43f0f1
4
+ data.tar.gz: 0ea532c1a2180acff9eed0dae1ab49266382002862b496a223e3f27d4d37573e
5
5
  SHA512:
6
- metadata.gz: 1c191dcfeab56b3831a6a48f2e74aa4b901c40925be27eb47278503d353ab04252f26432c1429ac9af435bf117c10de7c2bd9f9f358b5c2075a3a7059c96bd77
7
- data.tar.gz: 5673707e05b9081b44692842a08b726fdf386573f855fe871a30e907e45289e86dafd7bc084c90e2a9bdb2214dd1838b76e32cfc5cab062a8f268b6b6083e201
6
+ metadata.gz: abf28df5354ac273b3e4da0481f464226ae07cb0874c530f86d12891cdb848610e34b127a2d19f1f36aea6109210b7c52338898b2a500465075202c43c1754c4
7
+ data.tar.gz: c85807a5f39d681fad45867678abcfc6ee34e1c2c299305ebaa18afd2061ecf70cb1a570489ff907cfa6f2946adc664d0584783a647d377ea9d6c4f2a2c8a9b2
@@ -15,8 +15,8 @@ Gem::Specification.new do |gem|
15
15
  extra_files = [
16
16
  'lib/flipper/version.rb',
17
17
  ]
18
- gem.files = `git ls-files`.split("\n").select(&flipper_sequel_files) + extra_files # rubocop:disable Metrics/LineLength
19
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_sequel_files) # rubocop:disable Metrics/LineLength
18
+ gem.files = `git ls-files`.split("\n").select(&flipper_sequel_files) + extra_files
19
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_sequel_files) # rubocop:disable Layout/LineLength
20
20
  gem.name = 'flipper-sequel'
21
21
  gem.require_paths = ['lib']
22
22
  gem.version = Flipper::VERSION
@@ -120,15 +120,10 @@ module Flipper
120
120
  # Returns true.
121
121
  def enable(feature, gate, thing)
122
122
  case gate.data_type
123
- when :boolean, :integer
124
- @gate_class.db.transaction do
125
- args = {
126
- feature_key: feature.key,
127
- key: gate.key.to_s,
128
- }
129
- @gate_class.where(args).delete
130
- @gate_class.create(gate_attrs(feature, gate, thing))
131
- end
123
+ when :boolean
124
+ set(feature, gate, thing, clear: true)
125
+ when :integer
126
+ set(feature, gate, thing)
132
127
  when :set
133
128
  begin
134
129
  @gate_class.create(gate_attrs(feature, gate, thing))
@@ -153,15 +148,7 @@ module Flipper
153
148
  when :boolean
154
149
  clear(feature)
155
150
  when :integer
156
- @gate_class.db.transaction do
157
- args = {
158
- feature_key: feature.key.to_s,
159
- key: gate.key.to_s,
160
- }
161
- @gate_class.where(args).delete
162
-
163
- @gate_class.create(gate_attrs(feature, gate, thing))
164
- end
151
+ set(feature, gate, thing)
165
152
  when :set
166
153
  @gate_class.where(gate_attrs(feature, gate, thing))
167
154
  .delete
@@ -178,6 +165,20 @@ module Flipper
178
165
  raise "#{data_type} is not supported by this adapter"
179
166
  end
180
167
 
168
+ def set(feature, gate, thing, options = {})
169
+ clear_feature = options.fetch(:clear, false)
170
+ args = {
171
+ feature_key: feature.key,
172
+ key: gate.key.to_s,
173
+ }
174
+
175
+ @gate_class.db.transaction do
176
+ clear(feature) if clear_feature
177
+ @gate_class.where(args).delete
178
+ @gate_class.create(gate_attrs(feature, gate, thing))
179
+ end
180
+ end
181
+
181
182
  def gate_attrs(feature, gate, thing)
182
183
  {
183
184
  feature_key: feature.key.to_s,
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.17.1'.freeze
2
+ VERSION = '0.17.2'.freeze
3
3
  end
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.17.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-14 00:00:00.000000000 Z
11
+ date: 2020-01-04 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.17.1
19
+ version: 0.17.2
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.17.1
26
+ version: 0.17.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sequel
29
29
  requirement: !ruby/object:Gem::Requirement