beta_feature 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -2
- data/lib/beta_feature.rb +3 -3
- data/lib/beta_feature/flagger.rb +3 -1
- data/lib/beta_feature/version.rb +1 -1
- data/lib/generators/beta_feature/templates/install.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36e35ed413407ffb4dd36efdff5529ec1936b79743fbffa17f9c5b80d42a6555
|
4
|
+
data.tar.gz: 19a14730baf92f0dc9a528a00de92e5bf4c49f2238e70b8c4d9567d616341cdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d17b5545bf27f4d8a0512766540ddaa937b5d7d371166835244e2ebf9addb76d35d844c318bc1ffeefe3752e187fd3b0c961cf2bd8d29c629ccf57a3f4caeed
|
7
|
+
data.tar.gz: 780aa124b2e1c267b55b1653eac71bcbde04e48df42c77e5d0bbaec0f62953750062ed0b9abf71cca1f8dd5972a5743953ca63b29fdc0026181799dde75990f5
|
data/README.md
CHANGED
@@ -93,7 +93,7 @@ end
|
|
93
93
|
```
|
94
94
|
|
95
95
|
|
96
|
-
|
96
|
+
### Example: Company Level feature toggle
|
97
97
|
|
98
98
|
For enterprise application, you might want to enable a beta feature for all the employees of specific company. You can do it in this way.
|
99
99
|
|
@@ -131,7 +131,7 @@ else
|
|
131
131
|
end
|
132
132
|
```
|
133
133
|
|
134
|
-
|
134
|
+
### Granularity
|
135
135
|
|
136
136
|
User level and company level beta toggles could meet most applications. But if you have special requirements, you can enable feature toggle to any models by calling `flagger`.
|
137
137
|
|
@@ -154,6 +154,23 @@ group.remove_beta!(:landing_page_ux_improvement)
|
|
154
154
|
group.can_access_beta?(:dark_mode) # => true/false
|
155
155
|
```
|
156
156
|
|
157
|
+
### General Availability (GA)
|
158
|
+
|
159
|
+
If your feature has been well tested, changing the status from `in_progress` to `released` will make this feature general available to all customer. The feature check will always return true.
|
160
|
+
|
161
|
+
|
162
|
+
```yml
|
163
|
+
dark_mode:
|
164
|
+
developer: ryan@corp.com
|
165
|
+
qa: windy@corp.com
|
166
|
+
status: released
|
167
|
+
description: Building dark mode for my website.
|
168
|
+
```
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
user.can_access_beta?(:dark_mode) # => always return true
|
172
|
+
```
|
173
|
+
|
157
174
|
|
158
175
|
|
159
176
|
## Alternative
|
data/lib/beta_feature.rb
CHANGED
@@ -9,15 +9,15 @@ require "beta_feature/error"
|
|
9
9
|
|
10
10
|
module BetaFeature
|
11
11
|
def self.all_betas
|
12
|
-
@@
|
12
|
+
@@all_betas ||= YAML.load_file("#{Rails.root}/config/beta_features.yml")
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.in_progress
|
16
|
-
@@
|
16
|
+
@@in_progress_betas ||= all_betas.select {|k, v| v["status"] == 'in_progress'}
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.released
|
20
|
-
@@
|
20
|
+
@@released_betas ||= all_betas.select {|k, v| v["status"] == 'released'}
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
data/lib/beta_feature/flagger.rb
CHANGED
@@ -44,7 +44,9 @@ module BetaFeature
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def all_betas
|
47
|
-
@__all_betas__ ||=
|
47
|
+
@__all_betas__ ||= begin
|
48
|
+
find_or_create_beta_feature_setting.betas.to_set + BetaFeature.released.keys.to_set
|
49
|
+
end
|
48
50
|
end
|
49
51
|
|
50
52
|
private
|
data/lib/beta_feature/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class <%= migration_class_name %> < <%= migration_parent %>
|
2
2
|
def self.up
|
3
3
|
create_table :beta_feature_settings, force: true do |t|
|
4
|
-
t.
|
4
|
+
t.bigint :betable_id, null: false
|
5
5
|
t.string :betable_type, null: false
|
6
6
|
t.string :betas, array: true, default: [], null: false
|
7
7
|
t.timestamps
|