Sha256: 77ffacaf40e8f4113f94659ddbe12883d6be8f8690178a24c7da9433855f73bb

Contents?: true

Size: 979 Bytes

Versions: 4

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: false

require 'yaml'

# The wrapper module
module Processing
  unless defined? RP_CONFIG
    config_path = "#{ENV['HOME']}/.jruby_art/config.yml"
    begin
      CONFIG_FILE_PATH = File.expand_path(config_path)
      RP_CONFIG = YAML.load_file(CONFIG_FILE_PATH)
    rescue
      warn(format('WARN: you need to set PROCESSING_ROOT in %s', config_path))
    end
  end

  WIN_PATTERNS = [
    /bccwin/i,
    /cygwin/i,
    /djgpp/i,
    /ming/i,
    /mswin/i,
    /wince/i
  ].freeze

  # This class knows about supported JRubyArt operating systems
  class HostOS
    def self.os
      detect_os = RbConfig::CONFIG['host_os']
      case detect_os
      when /mac|darwin/ then :mac
      when /linux/ then :linux
      when /solaris|bsd/ then :unix
      else
        WIN_PATTERNS.find { |reg| detect_os =~ reg }
        raise "unsupported os: #{detect_os.inspect}" if Regexp.last_match.nil?
        :windows
      end
    end
  end

  OS ||= HostOS.os
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jruby_art-1.4.4 lib/jruby_art/config.rb
jruby_art-1.4.3 lib/jruby_art/config.rb
jruby_art-1.4.2 lib/jruby_art/config.rb
jruby_art-1.4.1 lib/jruby_art/config.rb