enabler 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +49 -2
- data/lib/enabler/version.rb +1 -1
- data/lib/enabler.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7292b10984446825ad2199ad40de2589136c203b
|
4
|
+
data.tar.gz: 9ef0a852a2c72b8a1dec129969731e6525946834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27d862408a5fb3547f41365ef5cd4e562302e2a5f6e69e9642147a522f8f9bf45d1e6f3bd938d3f27a3d4433c37d9a86579ac70942548d22e0a24dbc0ccb671a
|
7
|
+
data.tar.gz: 94f7ff34fbaaabd17e1f5535a6e4b4e969503234219ce54157b9aa3f553ce437dc7d0c266a07ab1d415a9cf418a0bebb37b2e87bc9f92b2a72acbd4ad60b845a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Enabler
|
2
2
|
|
3
|
-
Feature
|
3
|
+
### Granular Feature Enabling For Ruby Apps
|
4
|
+
|
5
|
+
There are a fair few feature flip gems out there. None of them had *exactly* the feature set I needed. Most either flipped features globally or worked only on the basis of a user class. I needed to be able to switch features on for users, teams of users OR entirely different models altogether E.G companies
|
6
|
+
|
7
|
+
The goal of this gem is to enable very *granular* control of which users/teams/companies/customers/cats have access to which features.
|
8
|
+
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
@@ -18,7 +23,49 @@ Or install it yourself as:
|
|
18
23
|
|
19
24
|
## Usage
|
20
25
|
|
21
|
-
|
26
|
+
### Configuration
|
27
|
+
|
28
|
+
Currently there is only one storage adapter - Redis
|
29
|
+
|
30
|
+
```Ruby
|
31
|
+
Enabler.store = Enabler::Storage::Redis.new($redis)
|
32
|
+
```
|
33
|
+
|
34
|
+
### Rules
|
35
|
+
|
36
|
+
```Ruby
|
37
|
+
Enabler.define_rule! :dance do |object|
|
38
|
+
object.is_cool?
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
### Specific Models
|
43
|
+
|
44
|
+
```Ruby
|
45
|
+
Enabler.enable! :dance, User.first
|
46
|
+
```
|
47
|
+
|
48
|
+
### Check if feature enabled for object
|
49
|
+
|
50
|
+
```Ruby
|
51
|
+
class NewFeatureController < ActionController::Base
|
52
|
+
def show
|
53
|
+
redirect_to '/home' unless Enabler.enabled? :new_feature, current_user
|
54
|
+
render_super_secret_awesome_new_feature
|
55
|
+
end
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
## TODO
|
62
|
+
* caching
|
63
|
+
* group definitions
|
64
|
+
* rake task to add feature for percentage of users
|
65
|
+
* ActiveRecord storage
|
66
|
+
* Mongo storage
|
67
|
+
* In memory storage
|
68
|
+
|
22
69
|
|
23
70
|
## Contributing
|
24
71
|
|
data/lib/enabler/version.rb
CHANGED
data/lib/enabler.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enabler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|