ruby-on-rails - 卡皮斯特拉诺卡文件 : what does >load 'deploy' do?

标签 ruby-on-rails ruby capistrano

运行 capify 后,默认的 Capfile 始终以以下内容开头:

load 'deploy'  

当我>puts $"时,我在加载路径上没有看到deploy.rb文件,但我假设这会加载capistrano附带的默认部署配方?

最佳答案

来自Ruby Standard library documentation for Kernel.load :

load(filename, wrap=false) → true

Loads and executes the Ruby program in the file filename. If the filename does not resolve to an absolute path, the file is searched for in the library directories listed in $:. If the optional wrap parameter is true, the loaded script will be executed under an anonymous module, protecting the calling program’s global namespace. In no circumstance will any local variables in the loaded file be propagated to the loading environment.

load 'deploy' 的作用完全符合您的想象,它从 Capistrano 中加载 deploy.rb

关于ruby-on-rails - 卡皮斯特拉诺卡文件 : what does >load 'deploy' do?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19552699/

相关文章:

ruby-on-rails - 为什么 ActiveRecord after_initialize 和 after_find 回调文档提到 block 级变量?

ruby-on-rails - sidekiq 将类作为参数发送会导致 stacklevel 太深错误

ruby - 使用 Mechanize/Nogokiri 按文本搜索

ubuntu - Capistrano mkdir 权限被拒绝

ruby-on-rails - 如何在 Rails 中零碎地设置属性

ruby-on-rails - Rails API 的 POST 请求为强参数返回 ParameterMissing

ruby - 仅当前类的实例方法列表

ruby-on-rails - Rails 主动管理部署 : couldn't find file 'jquery-ui'

deployment - Capistrano v3 - 运行命令后部署的 Hook

ruby-on-rails - 在 Rails 应用程序中切换布局时 Turbolinks 浏览器的后退按钮问题