Sha256: dab78b1fffd098dc6e783af75d2c6a3e4b3c2b2f3ffa9ab36c5e090ad2302234
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require "rubygems" require "rake/clean" def locate_mime_database possible_paths = [ (File.expand_path(ENV["FREEDESKTOP_MIME_TYPES_PATH"]) if ENV["FREEDESKTOP_MIME_TYPES_PATH"]), "/usr/local/share/mime/packages/freedesktop.org.xml", "/opt/homebrew/share/mime/packages/freedesktop.org.xml", "/usr/share/mime/packages/freedesktop.org.xml" ].compact path = possible_paths.find { |candidate| File.exist?(candidate) } return path unless path.nil? raise(<<~ERROR) Could not find MIME type database in the following locations: #{possible_paths} Ensure you have either installed the shared-mime-types package for your distribution, or obtain a version of freedesktop.org.xml and set FREEDESKTOP_MIME_TYPES_PATH to the location of that file. ERROR end desc "Build a file pointing at the database" task :default do mime_database_path = locate_mime_database open("../../lib/mimemagic/path.rb", "w") do |f| f.print(%Q{ class MimeMagic DATABASE_PATH="#{mime_database_path}" end }) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mimemagic-0.3.8 | ext/mimemagic/Rakefile |
mimemagic-0.4.1 | ext/mimemagic/Rakefile |
mimemagic-0.3.7 | ext/mimemagic/Rakefile |