flipper-redis 0.22.0 → 0.23.1
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 +4 -4
 - data/lib/flipper/version.rb +1 -1
 - data/spec/flipper/adapters/redis_cache_spec.rb +0 -2
 - data/spec/flipper/adapters/redis_spec.rb +0 -2
 - metadata +5 -6
 - data/docs/redis/README.md +0 -109
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 469aee19d09ded043a929075fecf9c67b7e1ea61097da6509c4fd6470489f60b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: be637c1663eedca518817c0e08c3ee437edf668f316ebd3b4de38edfb6090f75
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d508d33094dcdd514dade5bde05e3cd1903d5d485b9fdc548863b50fbea53c0c92d32fefc202d0a73b3f50ce8d8c86b637a811e90aff5295382e008adb3945ac
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ea9c330b820bf500990e0602d2077a34fde1a25fba31b9ab7b10f9378387aad6f8ab6882a0871711b7dd6db2cf051ff96d490125be6cd6592d8270849ecfada1
         
     | 
    
        data/lib/flipper/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: flipper-redis
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.23.1
         
     | 
| 
       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: 2022-01-19 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.23.1
         
     | 
| 
       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.23.1
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: redis
         
     | 
| 
       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/redis/README.md
         
     | 
| 
       55 
54 
     | 
    
         
             
            - examples/redis/basic.rb
         
     | 
| 
       56 
55 
     | 
    
         
             
            - examples/redis/internals.rb
         
     | 
| 
       57 
56 
     | 
    
         
             
            - examples/redis/namespaced.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. 
     | 
| 
      
 86 
     | 
    
         
            +
            rubygems_version: 3.1.2
         
     | 
| 
       88 
87 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       89 
88 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       90 
89 
     | 
    
         
             
            summary: Redis adapter for Flipper
         
     | 
    
        data/docs/redis/README.md
    DELETED
    
    | 
         @@ -1,109 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Flipper Redis
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            A [Redis](https://github.com/redis/redis-rb) 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-redis'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            And then execute:
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                $ bundle
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            Or install it yourself with:
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                $ gem install flipper-redis
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            ## Usage
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            In most cases, all you need to do is require the adapter. It will connect to the Redis instance specified in the `REDIS_URL` or `FLIPPER_REDIS_URL` environment vairable, or localhost by default.
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       24 
     | 
    
         
            -
            require 'flipper/adapters/redis'
         
     | 
| 
       25 
     | 
    
         
            -
            ```
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            **If you need to customize the adapter**, you can add this to an initializer:
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       30 
     | 
    
         
            -
            Flipper.configure do |config|
         
     | 
| 
       31 
     | 
    
         
            -
              config.adapter { Flipper::Adapters::Redis.new(Redis.new) }
         
     | 
| 
       32 
     | 
    
         
            -
            end
         
     | 
| 
       33 
     | 
    
         
            -
            ```
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            ## Internals
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            Each feature is stored in a redis hash, which means getting a feature is single query.
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       40 
     | 
    
         
            -
            require 'flipper/adapters/redis'
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            client = Redis.new
         
     | 
| 
       43 
     | 
    
         
            -
            adapter = Flipper::Adapters::Redis.new(client)
         
     | 
| 
       44 
     | 
    
         
            -
            flipper = Flipper.new(adapter)
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       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[:stats].enable
         
     | 
| 
       54 
     | 
    
         
            -
            flipper[:stats].enable_group :admins
         
     | 
| 
       55 
     | 
    
         
            -
            flipper[:stats].enable_group :early_access
         
     | 
| 
       56 
     | 
    
         
            -
            flipper[:stats].enable_actor User.new('25')
         
     | 
| 
       57 
     | 
    
         
            -
            flipper[:stats].enable_actor User.new('90')
         
     | 
| 
       58 
     | 
    
         
            -
            flipper[:stats].enable_actor User.new('180')
         
     | 
| 
       59 
     | 
    
         
            -
            flipper[:stats].enable_percentage_of_time 15
         
     | 
| 
       60 
     | 
    
         
            -
            flipper[:stats].enable_percentage_of_actors 45
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            flipper[:search].enable
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
            print 'all keys: '
         
     | 
| 
       65 
     | 
    
         
            -
            pp client.keys
         
     | 
| 
       66 
     | 
    
         
            -
            # all keys: ["stats", "flipper_features", "search"]
         
     | 
| 
       67 
     | 
    
         
            -
            puts
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
            print "known flipper features: "
         
     | 
| 
       70 
     | 
    
         
            -
            pp client.smembers("flipper_features")
         
     | 
| 
       71 
     | 
    
         
            -
            # known flipper features: ["stats", "search"]
         
     | 
| 
       72 
     | 
    
         
            -
            puts
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
            puts 'stats keys'
         
     | 
| 
       75 
     | 
    
         
            -
            pp client.hgetall('stats')
         
     | 
| 
       76 
     | 
    
         
            -
            # stats keys
         
     | 
| 
       77 
     | 
    
         
            -
            # {"boolean"=>"true",
         
     | 
| 
       78 
     | 
    
         
            -
            #  "groups/admins"=>"1",
         
     | 
| 
       79 
     | 
    
         
            -
            #  "actors/25"=>"1",
         
     | 
| 
       80 
     | 
    
         
            -
            #  "percentage_of_time"=>"15",
         
     | 
| 
       81 
     | 
    
         
            -
            #  "percentage_of_actors"=>"45",
         
     | 
| 
       82 
     | 
    
         
            -
            #  "groups/early_access"=>"1",
         
     | 
| 
       83 
     | 
    
         
            -
            #  "actors/90"=>"1",
         
     | 
| 
       84 
     | 
    
         
            -
            #  "actors/180"=>"1"}
         
     | 
| 
       85 
     | 
    
         
            -
            puts
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
            puts 'search keys'
         
     | 
| 
       88 
     | 
    
         
            -
            pp client.hgetall('search')
         
     | 
| 
       89 
     | 
    
         
            -
            # search keys
         
     | 
| 
       90 
     | 
    
         
            -
            # {"boolean"=>"true"}
         
     | 
| 
       91 
     | 
    
         
            -
            puts
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
            puts 'flipper get of feature'
         
     | 
| 
       94 
     | 
    
         
            -
            pp adapter.get(flipper[:stats])
         
     | 
| 
       95 
     | 
    
         
            -
            # flipper get of feature
         
     | 
| 
       96 
     | 
    
         
            -
            # {:boolean=>"true",
         
     | 
| 
       97 
     | 
    
         
            -
            #  :groups=>#<Set: {"admins", "early_access"}>,
         
     | 
| 
       98 
     | 
    
         
            -
            #  :actors=>#<Set: {"25", "90", "180"}>,
         
     | 
| 
       99 
     | 
    
         
            -
            #  :percentage_of_actors=>"45",
         
     | 
| 
       100 
     | 
    
         
            -
            #  :percentage_of_time=>"15"}
         
     | 
| 
       101 
     | 
    
         
            -
            ```
         
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
            ## Contributing
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
            1. Fork it
         
     | 
| 
       106 
     | 
    
         
            -
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
       107 
     | 
    
         
            -
            3. Commit your changes (`git commit -am 'Added some feature'`)
         
     | 
| 
       108 
     | 
    
         
            -
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
       109 
     | 
    
         
            -
            5. Create new Pull Request
         
     |