1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

hooks -> load_hooks

This commit is contained in:
Matt Brictson 2016-03-02 17:43:03 -08:00
parent 20fa2219c3
commit cac99bd8c3
4 changed files with 8 additions and 8 deletions

View file

@ -152,8 +152,8 @@ module Capistrano
fetch(:sshkit_backend) == SSHKit::Backend::Printer
end
def install_plugin(plugin, hooks:true)
installer.install(plugin, hooks: hooks)
def install_plugin(plugin, load_hooks:true)
installer.install(plugin, load_hooks: load_hooks)
end
private

View file

@ -11,18 +11,18 @@ module Capistrano
# "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 `hooks:false` to opt out.
# 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)
#
def install(plugin, hooks:true)
def install(plugin, load_hooks:true)
plugin = plugin.is_a?(Class) ? plugin.new : plugin
plugin.define_tasks
plugin.register_hooks if hooks
plugin.register_hooks if load_hooks
Rake::Task.define_task("load:defaults") do
plugin.set_defaults

View file

@ -30,7 +30,7 @@ require "rake/tasklib"
#
# # Capfile
# require "capistrano/superfancy"
# install_plugin Capistrano::Superfancy, hooks: false
# install_plugin Capistrano::Superfancy, load_hooks: false
#
class Capistrano::Plugin < Rake::TaskLib
include Capistrano::DSL

View file

@ -51,8 +51,8 @@ module Capistrano
expect(Rake::Task["deploy:published"].prerequisites).to include("hello")
end
it "skips registering hooks if :hooks => false" do
install_plugin(DummyPlugin, hooks: false)
it "skips registering hooks if load_hooks: false" do
install_plugin(DummyPlugin, load_hooks: false)
expect(Rake::Task["deploy:published"].prerequisites).to be_empty
end