class Fonts

Installs and Removes Fonts

Public Instance Methods

down() click to toggle source
# File lib/exogenesis/passengers/fonts.rb, line 13
def down
  collect_fonts do |file|
    rm_rf target_font_path(file)
  end
end
up() click to toggle source
# File lib/exogenesis/passengers/fonts.rb, line 9
def up
  install_all_fonts
end

Private Instance Methods

collect_fonts() { |file| ... } click to toggle source
# File lib/exogenesis/passengers/fonts.rb, line 27
def collect_fonts
  Dir.glob(File.join(fonts_path, '**/*.{ttf,otf}')).each do |file|
    yield file
  end
end
install_all_fonts() click to toggle source
# File lib/exogenesis/passengers/fonts.rb, line 21
def install_all_fonts
  collect_fonts do |file|
    install_font(file)
  end
end
install_font(file) click to toggle source
# File lib/exogenesis/passengers/fonts.rb, line 33
def install_font(file)
  if File.exist? target_font_path(file)
    skip_task "Copying #{File.basename file}", 'Already copied'
  else
    execute "Copying #{File.basename file}", "cp '#{file}' '#{target_font_path(file)}'"
  end
end
target_font_path(file) click to toggle source
# File lib/exogenesis/passengers/fonts.rb, line 41
def target_font_path(file)
  File.join(ENV['HOME'], 'Library/Fonts', File.basename(file))
end