Sha256: 2d86faf195cc518ed890f86528b28d07d949c60201f1ebcd791f836e9622be9c

Contents?: true

Size: 1.21 KB

Versions: 34

Compression:

Stored size: 1.21 KB

Contents

# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'rbconfig'

# This is based on http://stackoverflow.com/a/171011/159388 by Aaron Hinni

module PLATFORM
  def PLATFORM.os_name
    case RbConfig::CONFIG['host_os']
      when /cygwin|mswin|mingw|bccwin|wince|emx/
        'windows'
      when /darwin/
        'macos'
      else
        'linux'
    end
  end

  def PLATFORM.architecture
    host_cpu = RbConfig::CONFIG['host_cpu']

    # When we're on arm in macOS, we can rely on Rosetta and use the x86_64 binary
    return 'x86_64' if RbConfig::CONFIG['host_os'] =~ /darwin/ && host_cpu =~ /arm/

    case host_cpu
      when /x86_64/
        'x86_64'
      else
        'x86'
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
grpc-tools-1.54.3 platform_check.rb
grpc-tools-1.53.2 platform_check.rb
grpc-tools-1.53.1 platform_check.rb
grpc-tools-1.52.2 platform_check.rb
grpc-tools-1.54.2 platform_check.rb
grpc-tools-1.54.0 platform_check.rb
grpc-tools-1.53.0 platform_check.rb
grpc-tools-1.53.0.pre2 platform_check.rb
grpc-tools-1.52.0 platform_check.rb
grpc-tools-1.51.0 platform_check.rb
grpc-tools-1.52.0.pre2 platform_check.rb
grpc-tools-1.50.0 platform_check.rb
grpc-tools-1.50.0.pre1 platform_check.rb
grpc-tools-1.49.1 platform_check.rb
grpc-tools-1.49.0.pre1 platform_check.rb
grpc-tools-1.48.0 platform_check.rb
grpc-tools-1.48.0.pre1 platform_check.rb
grpc-tools-1.47.0 platform_check.rb
grpc-tools-1.46.3 platform_check.rb
grpc-tools-1.46.2 platform_check.rb