Class: FseventsToVm::SshEmit

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

Instance Method Summary collapse

Constructor Details

#initializeSshEmit

Returns a new instance of SshEmit.



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

def initialize
  @ssh_config = Tempfile.new('fsevents-ssh-config')
  @ssh_config.write(`cd /usr/local/var/dinghy/vagrant && vagrant ssh-config --host dinghy`)
  raise("Could not read Vagrant VM ssh config") unless $?.success?
  @ssh_config.flush
  @ssh = Net::SSH.start('dinghy', 'docker', config: @ssh_config.path)
end

Instance Method Details

#event(event) ⇒ Object



15
16
17
# File 'lib/fsevents_to_vm/ssh_emit.rb', line 15

def event(event)
  @ssh.exec!("touch -m -c -t #{event.mtime} #{Shellwords.escape event.path}".force_encoding(Encoding::BINARY))
end