class Wordmove::Hook
Constants
- Config
rubocop:enable Metrics/MethodLength
Public Class Methods
logger()
click to toggle source
# File lib/wordmove/hook.rb, line 3 def self.logger Logger.new(STDOUT).tap { |l| l.level = Logger::DEBUG } end
run(action, step, cli_options)
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/wordmove/hook.rb, line 8 def self.run(action, step, cli_options) movefile = Wordmove::Movefile.new(cli_options[:config]) options = movefile.fetch(false) environment = movefile.environment(cli_options) hooks = Wordmove::Hook::Config.new( options[environment][:hooks], action, step ) return if hooks.empty? logger.task "Running #{action}/#{step} hooks" hooks.all_commands.each do |command| case command[:where] when 'local' Wordmove::Hook::Local.run(command, options[:local], cli_options[:simulate]) when 'remote' if options[environment][:ftp] logger.debug "You have configured remote hooks to run over "\ "an FTP connection, but this is not possible. Skipping." next end Wordmove::Hook::Remote.run(command, options[environment], cli_options[:simulate]) else next end end end