
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Flips your features based on a redis key, a config/features.yml
file or environment variables.
Add can-do
to your Gemfile:
# Gemfile
gem "can-do", require: "can_do"
To use redis as a storage set the environment variable CANDO_REDIS_URL
with your redis instance.
The keys have to be prefixed with 'features:'.
So to set and use the feature experiment-1
set the key like
$ redis-cli SET features:experiment_1 true
and use it like
require "can_do"
CanDo.feature?(:experiment_1)
Any unset key will fall back to either the environment variable or the yaml variable and false
if none is set.
require "can_do"
CanDo.feature?(:experiment_1)
Inside the config
folder relative to your working directory create a file called features.yml
. Within this file,
place your default feature flags within the defaults
key. All available features should be listed here, together with
their default values. Add environment-specific feature flags under the environment name.
# config/features.yml
defaults:
some_feature: false
other_feature: true
development:
some_feature: true
production:
other_feature: false
Check if a feature is enabled by calling CanDo.feature?(:some_feature)
:
require "can_do"
CanDo.feature?(:some_feature)
Or by using a block:
require "can_do"
CanDo.feature?(:some_feature) do
# This block is only evaluated if some_feature is enabled
end
If a feature is not found, false
is returned.
You can use environment variables to flip your features. Environment variables always take precedence over anything
within your config/features.yml
file.
> RAILS_ENV=development rails console
CanDo.feature?(:some_feature) => false
> SOME_FEATURE=true RAILS_ENV=development rails console
CanDo.feature?(:some_feature) => true
> SOME_FEATURE=true RAILS_ENV=development rails console
CanDo.feature?(:some_feature) => true
> OTHER_FEATURE=true RAILS_ENV=production rails console
CanDo.feature?(:other_feature) => true
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that can-do demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.