flipper 0.16.0 → 0.16.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49607173763cd256cdb8f6a9ef1ada1fb213092a
4
- data.tar.gz: 123bcd59f941d0a4673526132bab358c75ada4ae
3
+ metadata.gz: 0d3f43b874f8dfd5484317d635fd96662f8c4aab
4
+ data.tar.gz: 83b68438215b14a9f1fd6ba0782ceaa87f08e592
5
5
  SHA512:
6
- metadata.gz: bf6951c97102685c5222c8b096133857b0a7a3251190cd3e6cf8885b0260463c341b8bb9f02e100e2ea2f541999ff6c7c53e6d4f73abed1cea09c8327f70acd4
7
- data.tar.gz: 10ecb72720e4b8a58956d025351118810baa6c20c82ec629ea6c5117b870cf2ef499958ba6efd6e924ecfadc86776a73be66a11c200251e39d08c64897452c72
6
+ metadata.gz: 8d05d3d79dbe8150d0e7cda538f9cb891d7e05ad04faf9fb55ef10cf693406bdc8d84783cb70bdfccecbfdbeb6b5569df54b3742bb13108a35fa04a201872776
7
+ data.tar.gz: 11beea578344f06abd0e203e92b8eda7277ee8ac556adab9f756af0745e926059510a0063ff13f121edde890af7ea9b8b38e367ddc31c73c8646d28d36b72b19
@@ -1,3 +1,13 @@
1
+ ## 0.16.1
2
+
3
+ ### Additions/Changes
4
+
5
+ * Add actors API endpoint (https://github.com/jnunemaker/flipper/pull/372).
6
+ * Fix rack body proxy require for those using flipper without rack (https://github.com/jnunemaker/flipper/pull/376).
7
+ * Unescapes feature_name in FeatureNameFromRoute (https://github.com/jnunemaker/flipper/pull/377).
8
+ * Replace delete_all with destroy_all in ActiveRecord adapter (https://github.com/jnunemaker/flipper/pull/395)
9
+ * Target correct bootstrap breakpoints in flipper UI (https://github.com/jnunemaker/flipper/pull/396)
10
+
1
11
  ## 0.16.0
2
12
 
3
13
  ### Bug Fixes
@@ -13,69 +13,7 @@ flipper[:stats].disable # turn off
13
13
  flipper[:stats].enabled? # check
14
14
  ```
15
15
 
16
- ## 2. Group
17
-
18
- Turn on feature based on the return value of block. Super flexible way to turn on a feature for multiple things (users, people, accounts, etc.) as long as the thing returns true when passed to the block.
19
-
20
- ```ruby
21
- # this registers a group
22
- Flipper.register(:admins) do |actor|
23
- actor.respond_to?(:admin?) && actor.admin?
24
- end
25
-
26
- flipper = Flipper.new(adapter)
27
-
28
- flipper[:stats].enable flipper.group(:admins) # This registers a stats feature and turns it on for admins (which is anything that returns true from the registered block).
29
- flipper[:stats].disable flipper.group(:admins) # turn off the stats feature for admins
30
-
31
- person = Person.find(params[:id])
32
- flipper[:stats].enabled? person # check if enabled, returns true if person.admin? is true
33
-
34
- # you can also use shortcut methods. This also registers a stats feature and turns it on for admins.
35
- flipper.enable_group :stats, :admins
36
- person = Person.find(params[:id])
37
- flipper[:stats].enabled? person # same as above. check if enabled, returns true if person.admin? is true
38
-
39
- flipper.disable_group :stats, :admins
40
- flipper[:stats].enable_group :admins
41
- flipper[:stats].disable_group :admins
42
- ```
43
-
44
- Here's a quick explanation of the above code block:
45
-
46
- ```
47
- Flipper.register(:admins) do |actor|
48
- actor.respond_to?(:admin?) && actor.admin?
49
- end
50
- ```
51
- - The above first registers a group called `admins` which essentially saves a [Proc](http://www.eriktrautman.com/posts/ruby-explained-blocks-procs-and-lambdas-aka-closures) to be called later.
52
-
53
- ```
54
- flipper[:stats].enable flipper.group(:admins)
55
- ```
56
-
57
- - The above enables the stats feature to any object that returns true from the `:admins` proc.
58
-
59
- ```
60
- person = Person.find(params[:id])
61
- flipper[:stats].enabled? person # check if person is enabled, returns true if person.admin? is true
62
- ```
63
-
64
- When the `person` object is passed to the `enabled?` method, it is then passed into the proc. If the proc returns true, the entire statement returns true and so `flipper[:stats].enabled? person` returns true. Whatever logic follows this conditional check is then executed.
65
-
66
- There is no requirement that the thing yielded to the block be a user model or whatever. It can be anything you want, therefore it is a good idea to check that the thing passed into the group block actually responds to what you are trying to do in the `register` proc.
67
-
68
- In your application code, you can do something like this now:
69
-
70
- ```
71
- if flipper[:stats].enabled?(some_admin)
72
- # do thing...
73
- else
74
- # do not do thing
75
- end
76
- ```
77
-
78
- ## 3. Individual Actor
16
+ ## 2. Individual Actor
79
17
 
80
18
  Turn feature on for individual thing. Think enable feature for someone to test or for a buddy. The only requirement for an individual actor is that it must respond to `flipper_id`.
81
19
 
@@ -117,7 +55,7 @@ class Group
117
55
  end
118
56
  ```
119
57
 
120
- ## 4. Percentage of Actors
58
+ ## 3. Percentage of Actors
121
59
 
122
60
  Turn this on for a percentage of actors (think user, member, account, group, whatever). Consistently on or off for this user as long as percentage increases. Think slow rollout of a new feature to a percentage of things.
123
61
 
@@ -141,7 +79,7 @@ flipper[:search].enable_percentage_of_actors 10
141
79
  flipper[:search].disable_percentage_of_actors # sets to 0
142
80
  ```
143
81
 
144
- ## 5. Percentage of Time
82
+ ## 4. Percentage of Time
145
83
 
146
84
  Turn this on for a percentage of time. Think load testing new features behind the scenes and such.
147
85
 
@@ -165,3 +103,65 @@ flipper[:search].disable_percentage_of_time # sets to 0
165
103
  ```
166
104
 
167
105
  Timeness is not a good idea for enabling new features in the UI. Most of the time you want a feature on or off for a user, but there are definitely times when I have found percentage of time to be very useful.
106
+
107
+ ## 5. Group
108
+
109
+ Turn on feature based on the return value of block. Super flexible way to turn on a feature for multiple things (users, people, accounts, etc.) as long as the thing returns true when passed to the block.
110
+
111
+ ```ruby
112
+ # this registers a group
113
+ Flipper.register(:admins) do |actor|
114
+ actor.respond_to?(:admin?) && actor.admin?
115
+ end
116
+
117
+ flipper = Flipper.new(adapter)
118
+
119
+ flipper[:stats].enable flipper.group(:admins) # This registers a stats feature and turns it on for admins (which is anything that returns true from the registered block).
120
+ flipper[:stats].disable flipper.group(:admins) # turn off the stats feature for admins
121
+
122
+ person = Person.find(params[:id])
123
+ flipper[:stats].enabled? person # check if enabled, returns true if person.admin? is true
124
+
125
+ # you can also use shortcut methods. This also registers a stats feature and turns it on for admins.
126
+ flipper.enable_group :stats, :admins
127
+ person = Person.find(params[:id])
128
+ flipper[:stats].enabled? person # same as above. check if enabled, returns true if person.admin? is true
129
+
130
+ flipper.disable_group :stats, :admins
131
+ flipper[:stats].enable_group :admins
132
+ flipper[:stats].disable_group :admins
133
+ ```
134
+
135
+ Here's a quick explanation of the above code block:
136
+
137
+ ```
138
+ Flipper.register(:admins) do |actor|
139
+ actor.respond_to?(:admin?) && actor.admin?
140
+ end
141
+ ```
142
+ - The above first registers a group called `admins` which essentially saves a [Proc](http://www.eriktrautman.com/posts/ruby-explained-blocks-procs-and-lambdas-aka-closures) to be called later.
143
+
144
+ ```
145
+ flipper[:stats].enable flipper.group(:admins)
146
+ ```
147
+
148
+ - The above enables the stats feature to any object that returns true from the `:admins` proc.
149
+
150
+ ```
151
+ person = Person.find(params[:id])
152
+ flipper[:stats].enabled? person # check if person is enabled, returns true if person.admin? is true
153
+ ```
154
+
155
+ When the `person` object is passed to the `enabled?` method, it is then passed into the proc. If the proc returns true, the entire statement returns true and so `flipper[:stats].enabled? person` returns true. Whatever logic follows this conditional check is then executed.
156
+
157
+ There is no requirement that the thing yielded to the block be a user model or whatever. It can be anything you want, therefore it is a good idea to check that the thing passed into the group block actually responds to what you are trying to do in the `register` proc.
158
+
159
+ In your application code, you can do something like this now:
160
+
161
+ ```
162
+ if flipper[:stats].enabled?(some_admin)
163
+ # do thing...
164
+ else
165
+ # do not do thing
166
+ end
167
+ ```
@@ -815,6 +815,41 @@ Successful disabling of a percentage of time will set the percentage to 0 and re
815
815
  }
816
816
  ```
817
817
 
818
+ ### Check if features are enabled for an actor
819
+
820
+ **URL**
821
+
822
+ `GET /actors/{flipper_id}`
823
+
824
+ **Parameters**
825
+
826
+ * `keys` - comma-separated list of features to check
827
+
828
+ **Request**
829
+
830
+ ```
831
+ curl -X GET http://example.com/flipper/api/actors/user:1?keys=my_feature_1,my_feature_2
832
+ ```
833
+
834
+ **Response**
835
+
836
+ Returns whether the actor with the provided flipper_id is enabled for the specififed feature keys.
837
+ If no keys are specified all features are returned.
838
+
839
+ ```json
840
+ {
841
+ "flipper_id": "user:1",
842
+ "features": {
843
+ "my_feature_1": {
844
+ "enabled": true,
845
+ },
846
+ "my_feature_2": {
847
+ "enabled": false,
848
+ }
849
+ }
850
+ }
851
+ ```
852
+
818
853
  ## Errors
819
854
  In the event of an error the Flipper API will return an error object. The error object will contain a Flipper-specific error code, an error message, and a link to documentation providing more information about the error.
820
855
 
@@ -1,5 +1,3 @@
1
- require 'rack/body_proxy'
2
-
3
1
  module Flipper
4
2
  module Middleware
5
3
  class Memoizer
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.16.0'.freeze
2
+ VERSION = '0.16.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2019-02-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Feature flipper is the act of enabling/disabling features in your application,
14
14
  ideally without re-deploying or changing anything in your code base. Flipper makes