Sha256: fe113ca209e44fadb8d161a902a3bbf53e591d77fed5cac1f0edf4582b58ed30

Contents?: true

Size: 1023 Bytes

Versions: 8

Compression:

Stored size: 1023 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.safe_load(File.read(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 /gnueabihf/ then :arm
      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

8 entries across 8 versions & 1 rubygems

Version Path
jruby_art-1.7.0 lib/jruby_art/config.rb
jruby_art-1.6.4 lib/jruby_art/config.rb
jruby_art-1.6.3 lib/jruby_art/config.rb
jruby_art-1.6.2 lib/jruby_art/config.rb
jruby_art-1.6.1 lib/jruby_art/config.rb
jruby_art-1.6.0 lib/jruby_art/config.rb
jruby_art-1.5.2 lib/jruby_art/config.rb
jruby_art-1.5.1 lib/jruby_art/config.rb