Class: Wordmove::Hook
- Inherits:
-
Object
- Object
- Wordmove::Hook
- Defined in:
- lib/wordmove/hook.rb
Defined Under Namespace
Classes: Config, Local, Remote
Class Method Summary collapse
- .logger ⇒ Object
-
.run(action, step, cli_options) ⇒ Object
rubocop:disable Metrics/MethodLength.
Class Method Details
.logger ⇒ Object
3 4 5 |
# 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) ⇒ Object
rubocop:disable Metrics/MethodLength
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/wordmove/hook.rb', line 8 def self.run(action, step, ) movefile = Wordmove::Movefile.new([:config]) = movefile.fetch(false) environment = movefile.environment() hooks = Wordmove::Hook::Config.new( [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, [:local], [:simulate]) when 'remote' if [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, [environment], [:simulate]) else next end end end |