简体   繁体   English

谁在`deploy.rb`中定义`defer`?

[英]Who defines `defer` in `deploy.rb`?

In whenever 's README, there is an example like this, whenever自述,都有这样的例子,

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. 我可能理解defer意味着什么,但我想知道它是如何工作的,以及它是如何实现的。

Where can I find the source code of defer ? 我在哪里可以找到defer的源代码?

defer used to be part of the capistrano v2 gem . defer曾经是capistrano v2 gem的一部分 It is nothing more than an alias to the ruby lambda and is used only for readability purposes. 它只不过是ruby lambda的别名,仅用于可读性目的。

As you might know in capistrano you can set many variables. 正如您在capistrano中可能知道的那样,您可以set许多变量。 Their values are calculated upon initialization of the capistrano script unless a value is a block . 它们的值是在capistrano脚本初始化时计算的, 除非值是块 In that context defer makes more sense as a keyword since evaluation is defered until the variable is accessed. 在该上下文中, defer作为关键字更有意义,因为在访问变量之前需要进行评估。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM