Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helpers for deployments without roles #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

BattleBrisket
Copy link

No matter how my deployment roles lay out for production and staging, I always have one or two environments (development, and occasionally a demo server) that put all the roles on a single instance. In those cases, roles are effectively meaningless.

Initially I would handle those situations by writing conditionals in my rake tasks that look like this...

if role? :www || ENV['WD_ROLES'] == ''

...but that exposes WhiskeyDisk internals within my rake tasks. The conditionals also get a bit uglier when trying to watch for interesting file changes...

if (role?(:db) || ENV['WD_ROLES'] == '') and changed?('db/migrate')

So I added some helpers that encapsulate the notion, "Is this a deployment without any roles at all?"

no_roles? returns true if the ENV['WD_ROLES'] definition is empty.

nothing_or_role?(role) returns true if the current deployment has the specified role, or if the ENV['WD_ROLES'] definition is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant