flipper-redis 0.7.0.beta6 → 0.7.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
  SHA1:
3
- metadata.gz: 99aaf6e6d4c1dbb4821ad6adbf5a6baab833f8ed
4
- data.tar.gz: 37611d9420d384eeba3efdb2486b334469a7c504
3
+ metadata.gz: d4598afa53e9b44a1aa08c9fe459eadae08f91f4
4
+ data.tar.gz: 2e510829c1c6f717a88d9d9ada5b46e4c2d14ed8
5
5
  SHA512:
6
- metadata.gz: 7bfb408fc6a014f1e780bf8739c3c042c0d384f969df7c23dcde1c16b59ccd3021c95df873e43196d60a28599823165aee12810a2d5a63822acb4679834fe305
7
- data.tar.gz: ce2966b28733754d9b2c01d45d44f438ecc9720c896f6c77891d06629ec0be86dd65e163ceb35cbf0472500494bf28ac8ad62ecd2a80e35a4911c75a8ac28ab1
6
+ metadata.gz: 975c8d8cf2c77e96bdd373e95919af5ca5e434f02c4158179b26c7d91494a6e8dbf75c4c175ce4bda19347348d0d2fc576367145b91c40d45b0fdea822013340
7
+ data.tar.gz: 3d931cd96e6901d3fce1f33af2606df43fcbb9f10bb6508014fcd3d4c7e70605773fe69b802184aa60fb6a594b4595404be5355087d38d3e15a1b0f00527bd64
@@ -0,0 +1,48 @@
1
+ require 'pp'
2
+ require 'pathname'
3
+ require 'logger'
4
+ begin
5
+ require 'redis-namespace'
6
+ rescue LoadError
7
+ puts 'you must have redis-namespace gem installed'
8
+ exit 1
9
+ end
10
+
11
+ root_path = Pathname(__FILE__).dirname.join('..').expand_path
12
+ lib_path = root_path.join('lib')
13
+ $:.unshift(lib_path)
14
+
15
+ require 'flipper/adapters/redis'
16
+ options = {url: 'redis://127.0.0.1:6379'}
17
+ if ENV['BOXEN_REDIS_URL']
18
+ options[:url] = ENV['BOXEN_REDIS_URL']
19
+ end
20
+ client = Redis.new(options)
21
+ namespaced_client = Redis::Namespace.new(:flipper_namespace, redis: client)
22
+ adapter = Flipper::Adapters::Redis.new(namespaced_client)
23
+ flipper = Flipper.new(adapter)
24
+
25
+ # Register a few groups.
26
+ Flipper.register(:admins) { |thing| thing.admin? }
27
+ Flipper.register(:early_access) { |thing| thing.early_access? }
28
+
29
+ # Create a user class that has flipper_id instance method.
30
+ User = Struct.new(:flipper_id)
31
+
32
+ flipper[:stats].enable
33
+ flipper[:stats].enable_group :admins
34
+ flipper[:stats].enable_group :early_access
35
+ flipper[:stats].enable_actor User.new('25')
36
+ flipper[:stats].enable_actor User.new('90')
37
+ flipper[:stats].enable_actor User.new('180')
38
+ flipper[:stats].enable_percentage_of_time 15
39
+ flipper[:stats].enable_percentage_of_actors 45
40
+
41
+ flipper[:search].enable
42
+
43
+ print 'all keys: '
44
+ pp client.keys
45
+ # all keys: ["stats", "flipper_features", "search"]
46
+ puts
47
+
48
+ puts 'notice how all the keys are namespaced'
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = "0.7.0.beta6"
2
+ VERSION = "0.7.0"
3
3
  end
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.7.0.beta6
4
+ version: 0.7.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: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-06-21 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.7.0.beta6
19
+ version: 0.7.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.7.0.beta6
26
+ version: 0.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -54,6 +54,7 @@ files:
54
54
  - docs/redis/README.md
55
55
  - examples/redis/basic.rb
56
56
  - examples/redis/internals.rb
57
+ - examples/redis/namespaced.rb
57
58
  - flipper-redis.gemspec
58
59
  - lib/flipper-redis.rb
59
60
  - lib/flipper/adapters/redis.rb
@@ -74,9 +75,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
75
  version: '0'
75
76
  required_rubygems_version: !ruby/object:Gem::Requirement
76
77
  requirements:
77
- - - ">"
78
+ - - ">="
78
79
  - !ruby/object:Gem::Version
79
- version: 1.3.1
80
+ version: '0'
80
81
  requirements: []
81
82
  rubyforge_project:
82
83
  rubygems_version: 2.2.3