Skip to content

Instantly share code, notes, and snippets.

@yosemsweet
Last active August 29, 2015 14:11
Show Gist options
  • Save yosemsweet/fd24366d28e5185362d2 to your computer and use it in GitHub Desktop.
Save yosemsweet/fd24366d28e5185362d2 to your computer and use it in GitHub Desktop.
feature flagging concept
# ---
# Doorman is yet another feature flipper. You can use Doorman to limit access
# of features on a global or per object scale to specific users or accounts.
#
# Doorman uses Rolify to store state and keeps the global list of features
# in Redis (or maybe in PG - depending on what's easier).
#
# :section Example Usage
#
# Setting up instructions
# feature = Doorman::Feature.for(name: :account_management)
# feature.instructions.enable(version: :google_plus, user: user)
# feature.save!
#
# Used in a controller or model
# account_service = { google_plus: GooglePlusAccount, rooster: RoosterAccount, default: GooglePlusAccount }.freeze
# feature = Doorman::Feature.for(name: :account_management)
# service = account_service[feature.version(user)]
# service.call()
#
# Used in a view with a feature in the view context
#
# #In Controller
# @feature = Feature.for(name: :account_management)
#
# #In View
# - feature.allow?(:google_plus)
# %h1 Your Google+ Account
# ...
#
# Used in a view via the Feature.allow? helper
# - Doorman::Feature.allow?(:account_management, :google_plus)
# %h1 Your Google+ Account
# ...
# ---
@yosemsweet
Copy link
Author

Feel like we need a more full featured feature flagging system. Don't know that we need all these variations but wanted to put them here so we could figure out what would be good now and what would be a hassle.

Basically I'm thinking I could back this on Rolify because nothing in glass-tiger back end should be in heavy usage.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment