Sha256: 3935c52d2cdd8ae31757f75590ef333ea56e9b4a1f5ab2944c3f324062183c03

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby

require 'platform'
require 'protoc/version'

PLATFORM_TO_PROTOC_ARCH = {:x86 => :x86_32, :x86_64 => :x86_64, :powerpc => :powerpc}

# Work around for lack of x86_64 support in Platform 0.4.0, which is the
# latest in rubygems.org. https://github.com/mmower/platform/issues/3
def platform_arch
  if Platform::ARCH == :unknown && RUBY_PLATFORM =~ /x86_64/
    :x86_64
  else
    Platform::ARCH
  end
end

def exec_protoc_for_os(os)
  case Platform::OS
    when :win32
      exec("#{File.dirname(__FILE__)}/protoc-#{Protoc::PROTOBUF_VERSION}-#{os}-#{PLATFORM_TO_PROTOC_ARCH[platform_arch]}.exe", *ARGV)
    else
      exec("#{File.dirname(__FILE__)}/protoc-#{Protoc::PROTOBUF_VERSION}-#{os}-#{PLATFORM_TO_PROTOC_ARCH[platform_arch]}", *ARGV)      
  end
end

case Platform::OS
  when :win32
    exec_protoc_for_os('windows')
  when :unix
    case Platform::IMPL
      when :macosx
        exec_protoc_for_os('osx')
      when :linux
        exec_protoc_for_os('linux')
      when :aix
        exec_protoc_for_os('aix')
      else
        raise "I don't have a binary for #{Platform::IMPL}"
    end
  else
    raise "I don't have a binary for #{Platform::OS}"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
protoc-2.6.1.3-universal-mswin32 bin/protoc
protoc-2.6.1.3 bin/protoc
protoc-2.6.1.3-universal-mingw32 bin/protoc