1# Copyright 2016 gRPC authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15require 'rbconfig' 16 17# This is based on http://stackoverflow.com/a/171011/159388 by Aaron Hinni 18 19module PLATFORM 20 def PLATFORM.os_name 21 case RbConfig::CONFIG['host_os'] 22 when /cygwin|mswin|mingw|bccwin|wince|emx/ 23 'windows' 24 when /darwin/ 25 'macos' 26 else 27 'linux' 28 end 29 end 30 31 def PLATFORM.architecture 32 case RbConfig::CONFIG['host_cpu'] 33 when /x86_64/ 34 'x86_64' 35 else 36 'x86' 37 end 38 end 39end 40