Sha256: c6c97af9afa1033fc0375dd554e7cf9d3c14fc624e288ba95cfb4ddd9d493a91

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Dfect

  INSTDIR = File.expand_path('../../..', __FILE__)

  # load inochi configuration
  inochi_file = __FILE__.sub(/rb$/, 'yaml')
  begin

    configs = File.open(inochi_file) do |f|
      require 'yaml'
      YAML.load_stream(f).documents
    end

    INOCHI = configs.shift.to_hash
    INOCHI[:runtime] ||= {}
    INOCHI[:devtime] ||= {}

    INOCHI2 = (configs.shift || {}).to_hash

  rescue => error
    error.message.insert 0,
      "Could not load Inochi configuration file: #{inochi_file.inspect}\n"
    raise error
  end

  # make values available as constants
  INOCHI.each do |param, value|
    const_set param.to_s.upcase, value
  end

  def self.inspect
    "#{PROJECT} #{VERSION} (#{RELEASE})"
  end

  # establish gem version dependencies
  if respond_to? :gem
    [:runtime, :devtime].each do |key|
      INOCHI[key].each do |gem_name, gem_version|
        begin
          gem gem_name, *Array(gem_version)
        rescue LoadError => error
          warn "#{inspect} #{key}: #{error}"
        end
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dfect-2.0.0 lib/dfect/inochi.rb