Giter Site home page Giter Site logo

osmanperviz / featureflags Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 32 KB

FeatureFlags provides a declarative, layered way of enabling and disabling application functionality at run-time.

License: MIT License

Ruby 98.68% Shell 1.32%
featureflags ruby rubygem

featureflags's Introduction

featureToggle

A flagsToggle is a branching point that your code can utilize to determine whether or not a feature should be made available to one or more customers.This simple gem allow you to enable a feature for a specific set of users, or just your team for them to try it out before it's rolled out for everyone.

Installation

Add this line to your application's Gemfile:

gem 'featureToggle'

And then execute:

 $ bundle

Or install it yourself as:

$ gem install featureToggle

Usage

Run "rake flags_toggle_config" command will generate under AppRoot/config/initializers/Flags.rb file.All configuration will be placed in this file.You may also specify a Rails environment to use a new feature (eg. in all environments, but not in production):

This will generate file like this:

     FeatureSettings.config do |config|
       config.app_id = 'Some_id'
       config.enable_some_feature = true
       config.desktop_subdomain = 'Some default subdomain'

       if Rails.env.production?
         config.app_id = 'Production_id'
         config.enable_some_feature = false
         config.desktop_subdomain = 'www'
       end

       if Rails.env.development?
       end

       if Rails.env.staging?
         config.desktop_subdomain = 'staging'
       end
     end

If your value is a boolean(PREDICATE) you will access them with question mark at the end:

      Feature.config.test_value? # true/false

If you value is string or number(NON PREDICATE) you will access on normal(Regular) way:

      Feature.config.app_id # some string or number

Use Feature in your production code

      desktop_subdomain = Feature.config.desktop_subdomain # eg. 'www'

or

      if Flags.config.enable_some_feature? do
        #do something
      end    

Environment variable overriding

In flagsToggle gem environment variable automatically override you custom configuration.

Contributing

  • Fork the project.

  • Make your feature addition or bug fix.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

License

The gem is available as open source under the terms of the MIT License.

featureflags's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.