Class: FseventsToVm::SshEmit

Inherits:
Object
  • Object
show all
Defined in:
lib/fsevents_to_vm/ssh_emit.rb

Instance Method Summary collapse

Constructor Details

#initialize(ssh_config_file) ⇒ SshEmit

Returns a new instance of SshEmit.



7
8
9
# File 'lib/fsevents_to_vm/ssh_emit.rb', line 7

def initialize(ssh_config_file)
  @config_path = ssh_config_file.path
end

Instance Method Details

#event(event) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/fsevents_to_vm/ssh_emit.rb', line 11

def event(event)
  ssh.exec!("touch -m -c -t #{event.mtime} #{Shellwords.escape event.path}".force_encoding(Encoding::BINARY))
rescue SystemCallError => e
  $stderr.puts "Error sending event: #{e}"
  $stderr.puts "\t#{e.backtrace.join("\n\t")}"
  disconnect!
end