class Capistrano::Configuration::PluginInstaller

Public Instance Methods

install(plugin, load_hooks:true) click to toggle source

“Installs” a Plugin into Capistrano by loading its tasks, hooks, and defaults at the appropriate time. The hooks in particular can be skipped, if you want full control over when and how the plugin's tasks are executed. Simply pass `load_hooks:false` to opt out.

The plugin class or instance may be provided. These are equivalent:

install(Capistrano::SCM::Git) install(Capistrano::SCM::Git.new)

# File lib/capistrano/configuration/plugin_installer.rb, line 21
def install(plugin, load_hooks:true)
  plugin = plugin.is_a?(Class) ? plugin.new : plugin

  plugin.define_tasks
  plugin.register_hooks if load_hooks

  Rake::Task.define_task("load:defaults") do
    plugin.set_defaults
  end
end