Project

bastet

0.0
No commit activity in last 3 years
No release in over 3 years
Simple feature rollout for criteria based groups
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 0.10.0
~> 0.9.2.2
~> 2.2.2
~> 2.7.0
 Project Readme

Bastet - The criteria based feature rollout beast Build Status

Gemfile

gem "bastet"

Configuration

redis = Redis.new
bastet = Bastet.setup(redis) #=> Bastet::Base.instance ...

Usage

Activate

group = Bastet::Group.new('admin_users') { |user| user.admin? }
bastet.activate("admin_only_feature", group)

Test

user = User.new(admin: true)
bastet.active?("admin_only_feature", user) #=> true

Deactivate

bastet.deactivate("admin_only_feature", group)
bastet.inactive?("admin_only_feature", user) #=> true

Criteria

Bastet::Group.new('all') { true } # true for everyone
Bastet::Group.new('none') { false } # false for everyone
Bastet::Group.new('admins') { |user| user.admin? } # True for entities that respond to #admin? with true
Bastet::Group.new('10_percent') { |user| (entity.id % 10) < (20 / 10) } # True for 20% of entities based on the id

To Do

  1. Support activating/deactivating for multiple users/groups at once
  2. Percentage support
  3. Logging

Contibuting

  1. Fork Basteet
  2. Create a topic branch - git checkout -b my_branch
  3. Push to your branch - git push origin my_branch
  4. Create a pull request from your branch