flipper-sequel 0.16.1 → 0.19.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 +5 -5
 - data/flipper-sequel.gemspec +1 -2
 - data/lib/flipper/adapters/sequel.rb +23 -22
 - data/lib/flipper/version.rb +1 -1
 - metadata +8 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b01b6ce0ee41581085f4805be64beeb4cd7d20b5bba27f739af4aa1703b7fb19
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5e2e9f8156dd96bc05757f9882ff6e10c323f4b5fc8fd45291088dfc729e3a24
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4ad140f4c0360ade92d4d05b6f9fb26166ad142592d3480d8356d233071022d827d1e81f78dbfb6f65029981726984ff5bcf4fc91d5f6b8d3dda91392d08d468
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c7bf8fe1820ff42ece9742d76096c505a4f181b7ac663fa9cb3fb714dfc7b393222e4433dddf5653d6ec5b0c2767d59ba687a5693097e979ffc23c17166461a3
         
     | 
    
        data/flipper-sequel.gemspec
    CHANGED
    
    | 
         @@ -8,7 +8,6 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       8 
8 
     | 
    
         
             
              gem.authors       = ['John Nunemaker']
         
     | 
| 
       9 
9 
     | 
    
         
             
              gem.email         = ['nunemaker@gmail.com']
         
     | 
| 
       10 
10 
     | 
    
         
             
              gem.summary       = 'Sequel adapter for Flipper'
         
     | 
| 
       11 
     | 
    
         
            -
              gem.description   = 'Sequel adapter for Flipper'
         
     | 
| 
       12 
11 
     | 
    
         
             
              gem.license       = 'MIT'
         
     | 
| 
       13 
12 
     | 
    
         
             
              gem.homepage      = 'https://github.com/jnunemaker/flipper'
         
     | 
| 
       14 
13 
     | 
    
         | 
| 
         @@ -23,5 +22,5 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       23 
22 
     | 
    
         
             
              gem.metadata      = Flipper::METADATA
         
     | 
| 
       24 
23 
     | 
    
         | 
| 
       25 
24 
     | 
    
         
             
              gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
         
     | 
| 
       26 
     | 
    
         
            -
              gem.add_dependency 'sequel', '>= 4.0.0', '<  
     | 
| 
      
 25 
     | 
    
         
            +
              gem.add_dependency 'sequel', '>= 4.0.0', '< 6'
         
     | 
| 
       27 
26 
     | 
    
         
             
            end
         
     | 
| 
         @@ -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 
     | 
| 
       124 
     | 
    
         
            -
                       
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            -
                       
     | 
| 
       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,
         
     | 
| 
         @@ -192,12 +193,12 @@ module Flipper 
     | 
|
| 
       192 
193 
     | 
    
         
             
                      result[gate.key] =
         
     | 
| 
       193 
194 
     | 
    
         
             
                        case gate.data_type
         
     | 
| 
       194 
195 
     | 
    
         
             
                        when :boolean
         
     | 
| 
       195 
     | 
    
         
            -
                          if  
     | 
| 
       196 
     | 
    
         
            -
                             
     | 
| 
      
 196 
     | 
    
         
            +
                          if detected_db_gate = db_gates.detect { |db_gate| db_gate.key == gate.key.to_s }
         
     | 
| 
      
 197 
     | 
    
         
            +
                            detected_db_gate.value
         
     | 
| 
       197 
198 
     | 
    
         
             
                          end
         
     | 
| 
       198 
199 
     | 
    
         
             
                        when :integer
         
     | 
| 
       199 
     | 
    
         
            -
                          if  
     | 
| 
       200 
     | 
    
         
            -
                             
     | 
| 
      
 200 
     | 
    
         
            +
                          if detected_db_gate = db_gates.detect { |db_gate| db_gate.key == gate.key.to_s }
         
     | 
| 
      
 201 
     | 
    
         
            +
                            detected_db_gate.value
         
     | 
| 
       201 
202 
     | 
    
         
             
                          end
         
     | 
| 
       202 
203 
     | 
    
         
             
                        when :set
         
     | 
| 
       203 
204 
     | 
    
         
             
                          db_gates.select { |db_gate| db_gate.key == gate.key.to_s }.map(&:value).to_set
         
     | 
    
        data/lib/flipper/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.19.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:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-09-25 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. 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 0.19.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. 
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 0.19.0
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: sequel
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -33,7 +33,7 @@ dependencies: 
     | 
|
| 
       33 
33 
     | 
    
         
             
                    version: 4.0.0
         
     | 
| 
       34 
34 
     | 
    
         
             
                - - "<"
         
     | 
| 
       35 
35 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       36 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 36 
     | 
    
         
            +
                    version: '6'
         
     | 
| 
       37 
37 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       38 
38 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       39 
39 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -43,8 +43,8 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    version: 4.0.0
         
     | 
| 
       44 
44 
     | 
    
         
             
                - - "<"
         
     | 
| 
       45 
45 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       46 
     | 
    
         
            -
                    version: ' 
     | 
| 
       47 
     | 
    
         
            -
            description:  
     | 
| 
      
 46 
     | 
    
         
            +
                    version: '6'
         
     | 
| 
      
 47 
     | 
    
         
            +
            description: 
         
     | 
| 
       48 
48 
     | 
    
         
             
            email:
         
     | 
| 
       49 
49 
     | 
    
         
             
            - nunemaker@gmail.com
         
     | 
| 
       50 
50 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -81,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       81 
81 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       82 
82 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       83 
83 
     | 
    
         
             
            requirements: []
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            rubygems_version: 2.4.5.4
         
     | 
| 
      
 84 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       86 
85 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       87 
86 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       88 
87 
     | 
    
         
             
            summary: Sequel adapter for Flipper
         
     |