Sha256: dc7303cae445c3a20fc7be4d0824182dfcadef2278bd2eebce6dd09d75d3b854

Contents?: true

Size: 950 Bytes

Versions: 4

Compression:

Stored size: 950 Bytes

Contents

# frozen_string_literal: true

require "psych"
require "yaml"

module LibarchiveBinary
  def self.libraries
    configuration_file = File.join(File.dirname(__FILE__), "..", "..", "ext", "configuration.yml")
    @@libraries ||= ::YAML.load_file(configuration_file)["libraries"] || {}
  rescue Psych::SyntaxError => e
    puts "Warning: The configuration file '#{configuration_file}' contains invalid YAML syntax."
    puts e.message
    exit 1
  rescue StandardError => e
    puts "An unexpected error occurred while loading the configuration file '#{configuration_file}'."
    puts e.message
    exit 1
  end

  def self.library_for(libname)
    if MiniPortile::windows?
      libraries[libname]["windows"] || libraries[libname]["all"]
    else
      libraries[libname]["all"]
    end
  rescue StandardError => e
    puts "Failed to load library configuration for '#{libname}'."
    puts e.message
    exit 1
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-libarchive-binary-0.4.0-x64-mingw32 lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0-x64-mingw-ucrt lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0.rc1-x64-mingw32 lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0.rc1-x64-mingw-ucrt lib/ffi-libarchive-binary/configuration.rb