feature_gate 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: a55a3b7dcb354b59674d121dedd1817f9789cd65
4
- data.tar.gz: 9368c51d64e9f7a9421c9e79d5bdf3d3114e7aff
3
+ metadata.gz: f0406848d929e8aa0f675c4814a10c36f6663a0a
4
+ data.tar.gz: 7e46b5a0e1997b71a45fb71effe93c0a4777ab68
5
5
  SHA512:
6
- metadata.gz: 7fcf931569a8629ee9d6b483086978624074714510e0d87ba519597a57fd4c3d216d6557dc24b45d19cba0896e18079a3dea5e190704f7c114eacd9e44fa6bcb
7
- data.tar.gz: 1f1adde8b2ebf1a59412545adadad6dfe676f19f876506035450cffdeece7972a269dbcb1571e730046c9c7fbc86f587ef6f6273ea2f8ab829c0d476f166f072
6
+ metadata.gz: c65230e8cc3f0e3fd7ab7461da9d602d6e77131c08fd233bc01d60c7a72f797bd64c1c72eb7b5babff0d8a57755a337936e23ffc85017241fc70f3b356cf3eba
7
+ data.tar.gz: 8a2a00751a311f9c289511601957f049defdb5a9df44a85b543eec50af442d436c1e01ef76d6903110fb2af64a39022f13d5331d591d9a79dd787f38e79bf3f1
data/README.md CHANGED
@@ -22,6 +22,8 @@ Add to `config/routes.rb`
22
22
 
23
23
  ## Usage
24
24
 
25
+ ### Gating features
26
+
25
27
  All gates are closed by default, meaning the features you gate will be hidden until you toggle the gates open.
26
28
 
27
29
  In view files:
@@ -37,6 +39,22 @@ In controller actions:
37
39
  FeatureGate::Manager.gate_page('gate-name') # 404s if gate is closed
38
40
  end
39
41
 
42
+ ### Managing gates
43
+
44
+ #### Option 1: UI interface
45
+
46
+ <img src="http://i.imgur.com/aeRlKv0.png" border="1">
47
+
48
+ Go to `/feature_gate` for a preconfigured page that lists all your gates and give you the ability to toggle them open or close.
49
+
50
+ To limit accessibility to this page, define `feature_gate_control_allowed?` in `application_controller.rb`. If the method is not defined, `/feature_gate` will be accessible to <em>all</em> users.
51
+
52
+ def feature_gate_control_allowed?
53
+ # condition for allowing user to toggle feature gates, ex: current_admin_user.present?
54
+ end
55
+
56
+ #### Option 2: Console
57
+
40
58
  To deploy your feature:
41
59
 
42
60
  FeatureGate::Manager.open!('gate-name')
@@ -1,5 +1,6 @@
1
1
  module FeatureGate
2
2
  class GatedFeaturesController < ApplicationController
3
+ before_filter :ensure_feature_gate_control_allowed
3
4
  layout 'feature_gate/application'
4
5
 
5
6
  def index
@@ -19,5 +20,16 @@ module FeatureGate
19
20
 
20
21
  redirect_to gated_features_path
21
22
  end
23
+
24
+ private
25
+
26
+ define_method(:feature_gate_control_allowed?) do
27
+ true
28
+ end unless method_defined? :feature_gate_control_allowed?
29
+
30
+ def ensure_feature_gate_control_allowed
31
+ return if feature_gate_control_allowed?
32
+ raise ActionController::RoutingError.new('Not Found')
33
+ end
22
34
  end
23
35
  end
@@ -1,3 +1,3 @@
1
1
  module FeatureGate
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feature_gate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiffany Huang