Who defines `defer` in `deploy.rb`?

658 views Asked by At

In whenever's README, there is an example like this,

set :whenever_environment, defer { stage }
require "whenever/capistrano"

I probably understand what defer means, but I want to know how it works, and how it is implemented.

Where can I find the source code of defer?

1

There are 1 answers

0
Nikos On BEST ANSWER

defer used to be part of the capistrano v2 gem. It is nothing more than an alias to the ruby lambda and is used only for readability purposes.

As you might know in capistrano you can set many variables. Their values are calculated upon initialization of the capistrano script unless a value is a block. In that context defer makes more sense as a keyword since evaluation is defered until the variable is accessed.