Module: Fontist::Utils::System
- Defined in:
- lib/fontist/utils/system.rb
Class Method Summary collapse
- .fontconfig_installed? ⇒ Boolean
- .match?(platform) ⇒ Boolean
-
.user_os ⇒ Object
rubocop:disable Metrics/MethodLength.
- .user_os_with_version ⇒ Object
Class Method Details
.fontconfig_installed? ⇒ Boolean
32 33 34 35 36 37 38 |
# 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) ⇒ Boolean
28 29 30 |
# File 'lib/fontist/utils/system.rb', line 28 def self.match?(platform) user_os_with_version.start_with?(platform) end |
.user_os ⇒ Object
rubocop:disable Metrics/MethodLength
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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 ⇒ Object
24 25 26 |
# File 'lib/fontist/utils/system.rb', line 24 def self.user_os_with_version "#{user_os}-#{Sys::Uname.release}" end |