class Kitchen::LifecycleHook::Base
Attributes
hook[R]
return [Hash]
lifecycle_hooks[R]
@return [Kitchen::LifecycleHooks]
phase[R]
return [String]
Public Class Methods
new(lifecycle_hooks, phase, hook)
click to toggle source
@param lifecycle_hooks
[Kitchen::LifecycleHooks] @param phase [String] @param hook [Hash]
# File lib/kitchen/lifecycle_hook/base.rb, line 16 def initialize(lifecycle_hooks, phase, hook) @lifecycle_hooks = lifecycle_hooks @phase = phase @hook = hook end
Public Instance Methods
logger()
click to toggle source
@return [Logger] the lifecycle hooks's logger
otherwise
@api private
# File lib/kitchen/lifecycle_hook/base.rb, line 41 def logger lifecycle_hooks.send(:logger) end
run()
click to toggle source
return [void]
# File lib/kitchen/lifecycle_hook/base.rb, line 23 def run raise NotImplementedError end
should_run?()
click to toggle source
@return [TrueClass, FalseClass]
# File lib/kitchen/lifecycle_hook/base.rb, line 28 def should_run? if !includes.empty? includes.include?(platform_name) elsif !excludes.empty? !excludes.include?(platform_name) else true end end
Private Instance Methods
config()
click to toggle source
@return [Hash]
# File lib/kitchen/lifecycle_hook/base.rb, line 53 def config lifecycle_hooks.send(:config) end
excludes()
click to toggle source
@return [Array<String>] names of excluded platforms
# File lib/kitchen/lifecycle_hook/base.rb, line 63 def excludes @excludes ||= hook.fetch(:excludes, []) end
includes()
click to toggle source
@return [Array<String>] names of only included platforms
# File lib/kitchen/lifecycle_hook/base.rb, line 68 def includes @includes ||= hook.fetch(:includes, []) end
instance()
click to toggle source
@return [Kitchen::Instance]
# File lib/kitchen/lifecycle_hook/base.rb, line 48 def instance lifecycle_hooks.instance end
platform_name()
click to toggle source
@return [String]
# File lib/kitchen/lifecycle_hook/base.rb, line 73 def platform_name instance.platform.name end
state_file()
click to toggle source
@return [Kitchen::StateFile]
# File lib/kitchen/lifecycle_hook/base.rb, line 58 def state_file lifecycle_hooks.state_file end