Skip to content

Commit

Permalink
hooks -> load_hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbrictson committed Apr 4, 2016
1 parent 20fa221 commit cac99bd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/capistrano/configuration.rb
Expand Up @@ -152,8 +152,8 @@ def dry_run?
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
Expand Down
6 changes: 3 additions & 3 deletions lib/capistrano/configuration/plugin_installer.rb
Expand Up @@ -11,18 +11,18 @@ 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 `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
Expand Down
2 changes: 1 addition & 1 deletion lib/capistrano/plugin.rb
Expand Up @@ -30,7 +30,7 @@
#
# # 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
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/capistrano/plugin_spec.rb
Expand Up @@ -51,8 +51,8 @@ def hello
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

Expand Down

0 comments on commit cac99bd

Please sign in to comment.