Sha256: fdbce8cf978eb8859c59629a21d48172f2f334d009d748bf1e078c910397b8ce

Contents?: true

Size: 919 Bytes

Versions: 10

Compression:

Stored size: 919 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

10 entries across 10 versions & 1 rubygems

Version Path
ffi-libarchive-binary-0.4.0 lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0-x86_64-linux lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0-x86_64-darwin lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0-arm64-darwin lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0-aarch64-linux lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0.rc1 lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0.rc1-x86_64-linux lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0.rc1-x86_64-darwin lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0.rc1-arm64-darwin lib/ffi-libarchive-binary/configuration.rb
ffi-libarchive-binary-0.4.0.rc1-aarch64-linux lib/ffi-libarchive-binary/configuration.rb