Class: Rundock::Builder::HookBuilder
- Defined in:
- lib/rundock/builder/hook_builder.rb
Constant Summary collapse
- DEFAULT_HOOKS_FILE_PATH =
'./hooks.yml'
- HookStructureError =
Class.new(NotImplementedError)
Constants inherited from Base
Base::BuilderNotImplementedError
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rundock::Builder::Base
Instance Method Details
#build(enables) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rundock/builder/hook_builder.rb', line 9 def build(enables) if enables.blank? Logger.info('Empty hook is specified.') return [] elsif @options[:hooks] if FileTest.exist?(@options[:hooks]) hooks_file = @options[:hooks] Logger.info("hooks file is #{hooks_file}") else Logger.warn("hooks file is not found. use #{DEFAULT_HOOKS_FILE_PATH}") hooks_file = DEFAULT_HOOKS_FILE_PATH end else return [] end build_from_file(hooks_file, enables) end |
#build_from_attributes(attributes) ⇒ Object
28 29 30 31 |
# File 'lib/rundock/builder/hook_builder.rb', line 28 def build_from_attributes(attributes) return [] unless attributes.key?(:enable_hooks) build_from_file(attributes[:hooks], attributes[:enable_hooks]) end |