aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2017-01-23 17:19:53 -0800
committerGravatar Yuchen Zeng <zyc@google.com>2017-01-23 17:19:53 -0800
commite38698e5bdb3c21dc63d1236d2111e0c4fbf4a20 (patch)
tree61bc024713ecd469d446032b14bca52b6923b96e /src/ruby
parentc09fd8c58a3cbaf991079f61dc0a98a815676f09 (diff)
parent889b0a45352928e2a815c34d5f849be9641284b0 (diff)
Merge remote-tracking branch 'upstream/master' into cares_bazel_rule
Diffstat (limited to 'src/ruby')
-rwxr-xr-xsrc/ruby/tools/bin/grpc_tools_ruby_protoc4
-rwxr-xr-xsrc/ruby/tools/bin/grpc_tools_ruby_protoc_plugin4
-rw-r--r--src/ruby/tools/grpc-tools.gemspec2
-rw-r--r--src/ruby/tools/platform_check.rb (renamed from src/ruby/tools/os_check.rb)29
4 files changed, 24 insertions, 15 deletions
diff --git a/src/ruby/tools/bin/grpc_tools_ruby_protoc b/src/ruby/tools/bin/grpc_tools_ruby_protoc
index dab06e7958..7e619e74a9 100755
--- a/src/ruby/tools/bin/grpc_tools_ruby_protoc
+++ b/src/ruby/tools/bin/grpc_tools_ruby_protoc
@@ -30,7 +30,7 @@
require 'rbconfig'
-require_relative '../os_check'
+require_relative '../platform_check'
ext = RbConfig::CONFIG['EXEEXT']
@@ -39,7 +39,7 @@ protoc_name = 'protoc' + ext
plugin_name = 'grpc_ruby_plugin' + ext
protoc_dir = File.join(File.dirname(__FILE__),
- RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name)
+ PLATFORM.architecture + '-' + PLATFORM.os_name)
protoc_path = File.join(protoc_dir, protoc_name)
diff --git a/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin b/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin
index 4b296dedc7..e6af2fe365 100755
--- a/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin
+++ b/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin
@@ -30,12 +30,12 @@
require 'rbconfig'
-require_relative '../os_check'
+require_relative '../platform_check'
plugin_name = 'grpc_ruby_plugin' + RbConfig::CONFIG['EXEEXT']
plugin_path = File.join(File.dirname(__FILE__),
- RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name,
+ PLATFORM.architecture + '-' + PLATFORM.os_name,
plugin_name)
exec([ plugin_path, plugin_path ], *ARGV)
diff --git a/src/ruby/tools/grpc-tools.gemspec b/src/ruby/tools/grpc-tools.gemspec
index 68e2a7a113..bc142ae3cb 100644
--- a/src/ruby/tools/grpc-tools.gemspec
+++ b/src/ruby/tools/grpc-tools.gemspec
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.description = 'protoc and the Ruby gRPC protoc plugin'
s.license = 'BSD-3-Clause'
- s.files = %w( version.rb os_check.rb README.md )
+ s.files = %w( version.rb platform_check.rb README.md )
s.files += Dir.glob('bin/**/*')
s.bindir = 'bin'
diff --git a/src/ruby/tools/os_check.rb b/src/ruby/tools/platform_check.rb
index 2677306457..1f4d5a68b7 100644
--- a/src/ruby/tools/os_check.rb
+++ b/src/ruby/tools/platform_check.rb
@@ -27,19 +27,28 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# This is based on http://stackoverflow.com/a/171011/159388 by Aaron Hinni
-
require 'rbconfig'
-module OS
- def OS.os_name
+# 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'
+ when /cygwin|mswin|mingw|bccwin|wince|emx/
+ 'windows'
+ when /darwin/
+ 'macos'
+ else
+ 'linux'
+ end
+ end
+
+ def PLATFORM.architecture
+ case RbConfig::CONFIG['host_cpu']
+ when /x86_64/
+ 'x86_64'
+ else
+ 'x86'
end
end
end