Class: FseventsToVm::SshEmit

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

Instance Method Summary collapse

Constructor Details

#initialize(identity_file, ip, username) ⇒ SshEmit

Returns a new instance of SshEmit.


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

def initialize(identity_file, ip, username)
  @identity_file = identity_file
  @ip = ip
  @username = username
end

Instance Method Details

#event(event) ⇒ Object


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

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