96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/wordmove/hook.rb', line 96
def self.run(commands, options, simulate = false)
logger.task "Running remote hooks"
ssh_options = options[:ssh]
wordpress_path = options[:wordpress_path]
copier = Photocopier::SSH.new(ssh_options).tap { |c| c.logger = logger }
commands.each do |command|
logger.task_step false, "Exec command: #{command}"
return true if simulate
stdout, stderr, exit_code =
copier.exec!("cd #{wordpress_path} && #{command}")
if exit_code.zero?
logger.task_step false, "Output: #{stdout}"
logger.success ""
else
logger.task_step false, "Output: #{stderr}"
logger.error "Error code #{exit_code}"
raise Wordmove::RemoteHookException
end
end
end
|