step_by_step 0.0.1.5 → 0.0.1.6
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/README.md +1 -1
- data/lib/step_by_step/rollout.rb +14 -8
- data/lib/step_by_step/version.rb +1 -1
- data/spec/rollout_spec.rb +11 -0
- data/step_by_step.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b64d9c4cfa6b4c77891f18ea104026433d41053
|
4
|
+
data.tar.gz: 9f983742023547cf519014cde73a7b904598bbcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 578b543150c9db5cb5f83c7e7cf28d6c0aa7a5b19c9f87156624989058e1995a3fbbae5da8645cba37fdf1dd294b3ec44802bb8ed2c70e78ee42f553d1cd73ba
|
7
|
+
data.tar.gz: 755afe31c41c9d7a9fcf972d85cfa4b99847ea149701957a69bc75b450284b9081e755e4944d76595464c231acd520b83ba9d253a072860edbe61b8ddc6f5e3d
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ Now your first user can see the comments feature.
|
|
77
77
|
StepByStep::Rollout.activate(:comments)
|
78
78
|
```
|
79
79
|
|
80
|
-
Now everyone can see the comments feature. This
|
80
|
+
Now everyone can see the comments feature. This also includes users who are not authenticated. If you want to roll out a feature to all authenticated users, but not to the public, roll it out to a percentage of 100 instead.
|
81
81
|
|
82
82
|
Activating a feature for everyone is common after you have determined that your rollout phase was successful.
|
83
83
|
|
data/lib/step_by_step/rollout.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
module StepByStep
|
2
2
|
class Rollout < ActiveRecord::Base
|
3
3
|
def match?(user)
|
4
|
-
user && enabled? && (match_group?(user) || match_user?(user) || match_percentage?(user))
|
4
|
+
public? || user && enabled? && (match_group?(user) || match_user?(user) || match_percentage?(user))
|
5
|
+
end
|
6
|
+
|
7
|
+
def public?
|
8
|
+
group == 'all'
|
5
9
|
end
|
6
10
|
|
7
11
|
# Activates a feature for everyone
|
@@ -64,14 +68,16 @@ module StepByStep
|
|
64
68
|
# Find the group whose block should be evaluated based on its name
|
65
69
|
g = @@groups.select { |i| i.first.to_sym == group.to_sym }
|
66
70
|
|
67
|
-
|
68
|
-
|
69
|
-
|
71
|
+
if g.present?
|
72
|
+
# There could theoretically be multiple groups with the same name;
|
73
|
+
# only take the last one
|
74
|
+
g = g.last
|
70
75
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
76
|
+
# g is now an array that looks like this:
|
77
|
+
# [:group_name, code_block]
|
78
|
+
# Call the code block here with the user
|
79
|
+
g.last.call(user)
|
80
|
+
end
|
75
81
|
end
|
76
82
|
end
|
77
83
|
|
data/lib/step_by_step/version.rb
CHANGED
data/spec/rollout_spec.rb
CHANGED
@@ -22,6 +22,11 @@ module StepByStep
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
it 'rolls out to the public' do
|
26
|
+
rollout = Rollout.activate(:feature)
|
27
|
+
expect(rollout.match?(user_3)).to be_truthy
|
28
|
+
end
|
29
|
+
|
25
30
|
it 'rolls out to all' do
|
26
31
|
rollout = Rollout.activate(:feature)
|
27
32
|
expect(rollout.match?(user_1)).to be_truthy
|
@@ -40,6 +45,12 @@ module StepByStep
|
|
40
45
|
expect(rollout.match?(user_2)).to be_falsey
|
41
46
|
end
|
42
47
|
|
48
|
+
it 'rolls out to a user while group is empty string instead of `nil`' do
|
49
|
+
rollout = Rollout.create(user_id: user_1.id, group: '')
|
50
|
+
expect(rollout.match?(user_1)).to be_truthy
|
51
|
+
expect(rollout.match?(user_2)).to be_falsey
|
52
|
+
end
|
53
|
+
|
43
54
|
it 'rolls out to a percentage' do
|
44
55
|
rollout = Rollout.activate_percentage(:feature, 50)
|
45
56
|
|
data/step_by_step.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["dennis.hackethal@gmail.com"]
|
11
11
|
spec.summary = %q{Active Record alternative to https://github.com/FetLife/rollout.}
|
12
12
|
spec.description = %q{Alternative to https://github.com/FetLife/rollout, with an Active Record backend and additional helpers, partially based on Ryan Bates's custom solution in http://railscasts.com/episodes/315-rollout-and-degrade.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/cobalthq/step_by_step"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: step_by_step
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Charles Hackethal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,7 +118,7 @@ files:
|
|
118
118
|
- spec/step_by_step.sqlite3
|
119
119
|
- spec/support/schema.rb
|
120
120
|
- step_by_step.gemspec
|
121
|
-
homepage:
|
121
|
+
homepage: https://github.com/cobalthq/step_by_step
|
122
122
|
licenses:
|
123
123
|
- MIT
|
124
124
|
metadata: {}
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.4.6
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Active Record alternative to https://github.com/FetLife/rollout.
|