rollout 2.1.0 → 2.2.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.
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Golick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.10.0
19
+ version: '0'
20
20
  type: :development
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: 2.10.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,35 +53,21 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.6.4
55
55
  - !ruby/object:Gem::Dependency
56
- name: bourne
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
- - !ruby/object:Gem::Dependency
70
- name: mocha
56
+ name: redis
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '='
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: 0.9.8
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '='
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: 0.9.8
68
+ version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: redis
70
+ name: codeclimate-test-reporter
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
@@ -103,19 +89,18 @@ extra_rdoc_files: []
103
89
  files:
104
90
  - ".document"
105
91
  - ".gitignore"
92
+ - ".rspec"
106
93
  - ".travis.yml"
107
94
  - Gemfile
108
95
  - Gemfile.lock
109
96
  - LICENSE
110
- - README.rdoc
97
+ - README.md
111
98
  - lib/rollout.rb
112
99
  - lib/rollout/legacy.rb
113
100
  - lib/rollout/version.rb
114
- - misc/check_rollout.rb
115
101
  - rollout.gemspec
116
102
  - spec/legacy_spec.rb
117
103
  - spec/rollout_spec.rb
118
- - spec/spec.opts
119
104
  - spec/spec_helper.rb
120
105
  homepage: https://github.com/jamesgolick/rollout
121
106
  licenses: []
@@ -135,13 +120,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
120
  - !ruby/object:Gem::Version
136
121
  version: '0'
137
122
  requirements: []
138
- rubyforge_project: rollout
139
- rubygems_version: 2.2.2
123
+ rubyforge_project:
124
+ rubygems_version: 2.4.5.1
140
125
  signing_key:
141
126
  specification_version: 4
142
127
  summary: Feature flippers with redis.
143
128
  test_files:
144
129
  - spec/legacy_spec.rb
145
130
  - spec/rollout_spec.rb
146
- - spec/spec.opts
147
131
  - spec/spec_helper.rb
data/README.rdoc DELETED
@@ -1,130 +0,0 @@
1
- = rollout
2
-
3
- Feature flippers.
4
-
5
- {<img src="https://travis-ci.org/FetLife/rollout.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/FetLife/rollout]
6
-
7
- == MAKE SURE TO READ THIS: 2.0 Changes and Migration Path
8
-
9
- As of rollout-2.x, only one key is used per feature for performance reasons. The data format is <tt>percentage|user_id,user_id,...|group,_group...</tt>. This has the effect of making concurrent feature modifications unsafe, but in practice, I doubt this will actually be a problem.
10
-
11
- This also has the effect of rollout no longer being dependent on redis. Just give it something that responds to <tt>set(key,value)</tt> and <tt>get(key)</tt>.
12
-
13
- If you have been using the 1.x format, you can initialize Rollout with <tt>:migrate => true</tt> and it'll do its best to automatically migrate your old features to the new format. There will be some performance impact, but it should be limited and short-lived since each feature only needs to get migrated once.
14
-
15
- == Rollout::Legacy
16
-
17
- If you'd prefer to continue to use the old layout in redis, <tt>Rollout::Legacy</tt> is a copy and paste of the old code :-).
18
-
19
- == Install it
20
-
21
- gem install rollout
22
-
23
- == How it works
24
-
25
- Initialize a rollout object. I assign it to a global var.
26
-
27
- require 'redis'
28
-
29
- $redis = Redis.new
30
- $rollout = Rollout.new($redis)
31
-
32
- Check whether a feature is active for a particular user:
33
-
34
- $rollout.active?(:chat, User.first) # => true/false
35
-
36
- Check whether a feature is active globally:
37
-
38
- $rollout.active?(:chat)
39
-
40
- You can activate features using a number of different mechanisms.
41
-
42
- == Groups
43
-
44
- Rollout ships with one group by default: "all", which does exactly what it sounds like.
45
-
46
- You can activate the all group for the chat feature like this:
47
-
48
- $rollout.activate_group(:chat, :all)
49
-
50
- You might also want to define your own groups. We have one for our caretakers:
51
-
52
- $rollout.define_group(:caretakers) do |user|
53
- user.caretaker?
54
- end
55
-
56
- You can activate multiple groups per feature.
57
-
58
- Deactivate groups like this:
59
-
60
- $rollout.deactivate_group(:chat, :all)
61
-
62
- == Specific Users
63
-
64
- You might want to let a specific user into a beta test or something. If that user isn't part of an existing group, you can let them in specifically:
65
-
66
- $rollout.activate_user(:chat, @user)
67
-
68
- Deactivate them like this:
69
-
70
- $rollout.deactivate_user(:chat, @user)
71
-
72
- == User Percentages
73
-
74
- If you're rolling out a new feature, you might want to test the waters by slowly enabling it for a percentage of your users.
75
-
76
- $rollout.activate_percentage(:chat, 20)
77
-
78
- The algorithm for determining which users get let in is this:
79
-
80
- CRC32(user.id) % 100 < percentage
81
-
82
- So, for 20%, users 0, 1, 10, 11, 20, 21, etc would be allowed in. Those users would remain in as the percentage increases.
83
-
84
- Deactivate all percentages like this:
85
-
86
- $rollout.deactivate_percentage(:chat)
87
-
88
- _Note that activating a feature for 100% of users will also make it active "globally". That is when calling Rollout#active? without a user object._
89
-
90
- == Feature is broken
91
-
92
- Deactivate everybody at once:
93
-
94
- $rollout.deactivate(:chat)
95
-
96
- For many of our features, we keep track of error rates using redis, and deactivate them automatically when a threshold is reached to prevent service failures from cascading. See http://github.com/jamesgolick/degrade for the failure detection code.
97
-
98
- == Namespacing
99
-
100
- Rollout separates its keys from other keys in the data store using the "feature" keyspace.
101
-
102
- If you're using redis, you can namespace keys further to support multiple environments by using the http://github.com/defunkt/redis-namespace gem.
103
-
104
- $ns = Redis::Namespace.new(Rails.env, :redis => $redis)
105
- $rollout = Rollout.new($ns)
106
- $rollout.activate_group(:chat, :all)
107
-
108
- This example would use the "development:feature:chat:groups" key.
109
-
110
- == misc/check_rollout.rb
111
-
112
- In our infrastructure, rollout obviously allows us to progressively enable new features but we also use it to automatically disable features and services that break or fail to prevent them from causing cascading failures and wiping out our entire system.
113
-
114
- When a feature reaches "maturity" - in other words, expected to be at 100% rollout all the time - we use check_rollout.rb to setup nagios alerts on the rollouts so that we get paged if one of them gets disabled.
115
-
116
-
117
- == Implementations in other languages
118
-
119
- * Python: http://github.com/asenchi/proclaim
120
- * PHP: https://github.com/opensoft/rollout
121
- * Clojure: https://github.com/tcrayford/shoutout
122
-
123
- == Contributors
124
-
125
- * James Golick - Creator - https://github.com/jamesgolick
126
- * Eric Rafaloff - Maintainer - https://github.com/EricR
127
-
128
- == Copyright
129
-
130
- Copyright (c) 2010-InfinityAndBeyond BitLove, Inc. See LICENSE for details.
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "rubygems"
4
- require "yajl"
5
- require "open-uri"
6
-
7
- output = Yajl::Parser.parse(open(ARGV[0]))
8
- percentage = output["percentage"].to_i
9
-
10
- puts Yajl::Encoder.encode(output)
11
-
12
- if percentage == 100
13
- exit(0)
14
- else
15
- exit(2)
16
- end