module Fontist::Utils::System

Public Class Methods

fontconfig_installed?() click to toggle source
# File lib/fontist/utils/system.rb, line 32
def self.fontconfig_installed?
  Helpers.silence_stream($stderr) do
    !!Helpers.run("fc-cache -V")
  end
rescue Errno::ENOENT
  false
end
match?(platform) click to toggle source
# File lib/fontist/utils/system.rb, line 28
def self.match?(platform)
  user_os_with_version.start_with?(platform)
end
user_os() click to toggle source
# File lib/fontist/utils/system.rb, line 6
def self.user_os # rubocop:disable Metrics/MethodLength
  @user_os ||= begin
    host_os = RbConfig::CONFIG["host_os"]
    case host_os
    when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
      :windows
    when /darwin|mac os/
      :macos
    when /linux/
      :linux
    when /solaris|bsd/
      :unix
    else
      raise Fontist::Error, "unknown os: #{host_os.inspect}"
    end
  end
end
user_os_with_version() click to toggle source
# File lib/fontist/utils/system.rb, line 24
def self.user_os_with_version
  "#{user_os}-#{Sys::Uname.release}"
end