rcurtain 0.0.4 → 0.0.5

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: ce878794b47c6035d21459a1c1af002fa6b940e1
4
- data.tar.gz: 85c51fab7b638d6ddd973890f451b5230f5bef74
3
+ metadata.gz: 7ab6558f0e50b98928e608b36e888b1c3e8b5392
4
+ data.tar.gz: 1aa80e75058d16d1c4f216638519081b09660312
5
5
  SHA512:
6
- metadata.gz: 323fa3f0ccf54d90c751e23754e3b31037d90aaac48fd1af7a315fa4b1ced47be24272798b0b3cb7742f6d50662c797d050361d2ad97b8fa9759b2bb154cc912
7
- data.tar.gz: 27ad99d24e74cd623c8c660e325b80b33e20d1d4231bd97f4108537409ecf2cfa3b7adb469e9e7146b94e624552889d70d7be9662b977270eff0c67380932185
6
+ metadata.gz: 988206381c2e90d9d12ea32f72b8ed1307ab166376941e861c4e656a1aaf5a57aeb494da69fc45fa6e505b8b58ae915bfc9167d9c1eff587f2ed879d4fea7af7
7
+ data.tar.gz: d02f19b5043c4a1e6c5c8facd91e0cb6277d6ede208790c2a7614705fc9bb68028a4a4fc4cb8c9f31d725c4cf0e91a70917f5e5a6a41565b849bb1f6b18b7d8d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rcurtain (0.0.3)
4
+ rcurtain (0.0.4)
5
5
  hiredis
6
6
  redis (~> 3.2)
7
7
 
@@ -10,7 +10,7 @@ GEM
10
10
  specs:
11
11
  diff-lcs (1.2.5)
12
12
  hiredis (0.6.1)
13
- redis (3.3.0)
13
+ redis (3.3.3)
14
14
  rspec (3.4.0)
15
15
  rspec-core (~> 3.4.0)
16
16
  rspec-expectations (~> 3.4.0)
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Easy way to control your features using [redis](http://redis.io/).
4
4
 
5
+ Also available for Java -> [JCurtain!](https://github.com/moip/jcurtain)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -20,13 +20,17 @@ module Rcurtain
20
20
  return Rcurtain.configuration.default_response
21
21
  end
22
22
 
23
+ def get_users(feature)
24
+ get_feature(feature).users
25
+ rescue Redis::CannotConnectError
26
+ Rcurtain.configuration.default_response
27
+ end
28
+
23
29
  private
24
30
  def get_feature (name)
25
- percentage = redis.get("feature:#{name}:percentage")
26
- percentage ||= 0
31
+ percentage = redis.get("feature:#{name}:percentage") || 0
27
32
 
28
- users = redis.smembers("feature:#{name}:users")
29
- users ||= []
33
+ users = redis.smembers("feature:#{name}:users") || []
30
34
 
31
35
  return Feature.new(name, percentage, users)
32
36
  end
Binary file
data/rcurtain.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rcurtain'
3
- s.version = '0.0.4'
4
- s.date = '2016-05-26'
3
+ s.version = '0.0.5'
4
+ s.date = '2017-07-03'
5
5
  s.summary = "RCurtain"
6
6
  s.description = "Open the curtain and see if your feature is enabled"
7
7
  s.authors = ["Danillo Souza", "Gabriel Queiroz"]
@@ -69,4 +69,12 @@ describe Rcurtain do
69
69
  end
70
70
  end
71
71
 
72
- end
72
+ context "get users from feature" do
73
+ before do
74
+ allow_any_instance_of(Redis).to receive(:get).and_return(0)
75
+ allow_any_instance_of(Redis).to receive(:smembers).and_return(['123', '321'])
76
+ end
77
+ it { expect(rcurtain.get_users("feature")).to eq ['123', '321']}
78
+ end
79
+
80
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcurtain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danillo Souza
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-26 00:00:00.000000000 Z
12
+ date: 2017-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hiredis
@@ -68,6 +68,7 @@ files:
68
68
  - lib/rcurtain/configuration.rb
69
69
  - lib/rcurtain/curtain.rb
70
70
  - lib/rcurtain/feature.rb
71
+ - rcurtain-0.0.4.gem
71
72
  - rcurtain.gemspec
72
73
  - spec/lib/configuration_spec.rb
73
74
  - spec/lib/curtain_spec.rb
@@ -92,9 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.5.1
96
+ rubygems_version: 2.4.6
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: RCurtain
99
100
  test_files: []
100
- has_rdoc: