Skip to content

Commit

Permalink
[HooksManager] Remove deprecated support for not specifying a plugin_…
Browse files Browse the repository at this point in the history
…name
  • Loading branch information
segiddins committed Dec 30, 2015
1 parent b0d5184 commit 141b8c1
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions lib/cocoapods/hooks_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ class Hook
#
def initialize(name, plugin_name, block)
raise ArgumentError, 'Missing name' unless name
raise ArgumentError, 'Missing plugin_name' unless name
raise ArgumentError, 'Missing block' unless block

UI.warn '[Hooks] The use of hooks without specifying a `plugin_name` ' \
"has been deprecated (from file `#{block.binding.eval('File.expand_path __FILE__')}`)." unless plugin_name

@name = name
@plugin_name = plugin_name
@block = block
Expand All @@ -72,13 +70,7 @@ class << self
# @param [Proc] block
# The block.
#
def register(plugin_name, hook_name = nil, &block)
# TODO: Backwards compatibility with nameless plugins from CP 0.34
if hook_name.nil?
hook_name = plugin_name
plugin_name = nil
end

def register(plugin_name, hook_name, &block)
@registrations ||= {}
@registrations[hook_name] ||= []
@registrations[hook_name] << Hook.new(hook_name, plugin_name, block)
Expand Down Expand Up @@ -108,7 +100,7 @@ def run(name, context, whitelisted_plugins = nil)
UI.message "- Running #{name.to_s.tr('_', ' ')} hooks" do
hooks.each do |hook|
next if whitelisted_plugins && !whitelisted_plugins.key?(hook.plugin_name)
UI.message "- #{hook.plugin_name || 'unknown plugin'} from " \
UI.message "- #{hook.plugin_name} from " \
"`#{hook.block.source_location.first}`" do
block = hook.block
if block.arity > 1
Expand Down

0 comments on commit 141b8c1

Please sign in to comment.