aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/tools
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-01-27 16:07:01 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-01-27 16:07:01 -0800
commitd9b2d94c687ccb5b46ed4c4c3d1167ebec380d7d (patch)
tree5a292078ee6b243f20e21fea60fef9e72228bccc /src/ruby/tools
parentfaa835c308ad7c107f08d9065d24dfc589b1cb20 (diff)
parent46357c882df1afc28f7a5228c40fde522093fa32 (diff)
Merge github.com:grpc/grpc into large_message_benchmarks
Diffstat (limited to 'src/ruby/tools')
-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