Skip to content

Add helpers for deployments without roles#43

Open
BattleBrisket wants to merge 3 commits intoflogic:masterfrom
forgecrafted:master
Open

Add helpers for deployments without roles#43
BattleBrisket wants to merge 3 commits intoflogic:masterfrom
forgecrafted:master

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.

1 participant