#!/usr/bin/ruby

require_relative 'sshfs.local'

active_mounts  = `mount`

$mounts.each do |mount|
  destination  = File.expand_path(mount[:destination])
  volname      = mount[:volname] || File.basename(destination)
  options      = ($options + ["volname='#{volname}'"]).join(',')
  port         = mount[:port] ? "-p #{mount[:port]}" : ''
  is_mounted   = active_mounts.include? destination

  if !is_mounted 
    `#{$sshfs_path} #{port} -o #{options} \
      '#{mount[:source]}' '#{destination}'`
  end
end

#!/usr/bin/ruby

require_relative 'sshfs.local'

active_mounts  = `mount`

$mounts.each do |mount|
  destination  = File.expand_path(mount[:destination])
  volname      = mount[:volname] || File.basename(destination)
  options      = ($options + ["volname='#{volname}'"]).join(',')
  port         = mount[:port] ? "-p #{mount[:port]}" : ''
  is_mounted   = active_mounts.include? destination

  if !is_mounted 
    system 'mkdir', '-p', destination
    `#{$sshfs_path} #{port} -o #{options} \
      '#{mount[:source]}' '#{destination}'`
  end
end

Create mount point if it doesn't exist
Create mount point if it doesn't exist

The reason for this is that mount points are automatically deleted in
/Volumes on OS X upon shutdown or reboot.
