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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 222c8c53af430f408ecfcd55d978ab59b4089af31302190912d0a596a5682bfa
4
- data.tar.gz: c614987373dd1fd3844a883cb895941574da085d3a0afe83a9f95e1a02ef887e
3
+ metadata.gz: 36e35ed413407ffb4dd36efdff5529ec1936b79743fbffa17f9c5b80d42a6555
4
+ data.tar.gz: 19a14730baf92f0dc9a528a00de92e5bf4c49f2238e70b8c4d9567d616341cdf
5
5
  SHA512:
6
- metadata.gz: 116211b838c40f3cbb8d03bbf7ed4d78b2cdf97a3e68dec7f6bdb5623fbaea2fa580c6892009351c22aec65536dbf6322f95cfcf73a89ade22020b01ab932b35
7
- data.tar.gz: ca31eba01302373a7a5625cda951d1176c917f4d1bc5ecabc1a0d3108cb3ec03224ba5b05cacb222b1a531e99851e014b356f8dd9d754023c471c3a67d882312
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
- ## Example: Company Level feature toggle
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
- ## Granularity
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
@@ -9,15 +9,15 @@ require "beta_feature/error"
9
9
 
10
10
  module BetaFeature
11
11
  def self.all_betas
12
- @@__all_betas__ ||= YAML.load_file("#{Rails.root}/config/beta_features.yml")
12
+ @@all_betas ||= YAML.load_file("#{Rails.root}/config/beta_features.yml")
13
13
  end
14
14
 
15
15
  def self.in_progress
16
- @@__in_progress_betas__ ||= all_betas.select {|k, v| v["status"] == 'in_progress'}
16
+ @@in_progress_betas ||= all_betas.select {|k, v| v["status"] == 'in_progress'}
17
17
  end
18
18
 
19
19
  def self.released
20
- @@__released_betas__ ||= all_betas.select {|k, v| v["status"] == 'released'}
20
+ @@released_betas ||= all_betas.select {|k, v| v["status"] == 'released'}
21
21
  end
22
22
  end
23
23
 
@@ -44,7 +44,9 @@ module BetaFeature
44
44
  end
45
45
 
46
46
  def all_betas
47
- @__all_betas__ ||= find_or_create_beta_feature_setting.betas.to_set
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
@@ -1,3 +1,3 @@
1
1
  module BetaFeature
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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.integer :betable_id, null: false
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beta_feature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Lv