Class: Capistrano::Configuration::PluginInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/configuration/plugin_installer.rb

Instance Method Summary collapse

Instance Method Details

#install(plugin, load_hooks: true, load_immediately: false) ⇒ Object

“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)

Note that the :load_immediately flag is for internal use only and will be removed in an upcoming release.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/capistrano/configuration/plugin_installer.rb', line 24

def install(plugin, load_hooks: true, load_immediately: false)
  plugin = plugin.is_a?(Class) ? plugin.new : plugin

  plugin.define_tasks
  plugin.register_hooks if load_hooks
  @scm_installed ||= provides_scm?(plugin)

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

#scm_installed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/capistrano/configuration/plugin_installer.rb', line 40

def scm_installed?
  @scm_installed
end