Method: MacSetup::Symlink#link

Defined in:
lib/mac_setup/symlink_installer.rb


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mac_setup/symlink_installer.rb', line 11

def link
  return if Secrets.encrypted?(source_path)

  short_source_path = MacSetup.shorten_path(source_path)
  short_target_path = MacSetup.shorten_path(target_path)
  MacSetup.log "Linking #{short_source_path} to #{short_target_path}..."

  return unless source_exists

  target_exists? ? replace : FileUtils.ln_s(source_path, target_path)
end