Sha256: 7f83cf3c8a947cd10bde02da1671dc53f738dc0d5b8cb6e379b513e2d37aa493

Contents?: true

Size: 1.57 KB

Versions: 34

Compression:

Stored size: 1.57 KB

Contents

# Encapsulates the logic for installing plugins into Capistrano. Plugins must
# simply conform to a basic API; the PluginInstaller takes care of invoking the
# API at appropriate times.
#
# This class is not used directly; instead it is typically accessed via the
# `install_plugin` method of the Capistrano DSL.
#
module Capistrano
  class Configuration
    class PluginInstaller
      # "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.
      #
      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

      def scm_installed?
        @scm_installed
      end

      private

      def provides_scm?(plugin)
        plugin.respond_to?(:scm?) && plugin.scm?
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
capistrano-3.19.2 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.19.1 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.19.0 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.18.1 lib/capistrano/configuration/plugin_installer.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/capistrano-3.18.0/lib/capistrano/configuration/plugin_installer.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/capistrano-3.18.0/lib/capistrano/configuration/plugin_installer.rb
capistrano-3.18.0 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.17.3 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.17.2 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.17.1 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.17.0 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.16.0 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.15.0 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.14.1 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.14.0 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.13.0 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.12.1 lib/capistrano/configuration/plugin_installer.rb
capistrano-3.12.0 lib/capistrano/configuration/plugin_installer.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/capistrano-3.11.0/lib/capistrano/configuration/plugin_installer.rb
capistrano-3.11.2 lib/capistrano/configuration/plugin_installer.rb