aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby/tools
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2017-01-23 17:32:15 +0000
committerGravatar Nathaniel Manista <nathaniel@google.com>2017-01-23 17:32:15 +0000
commit9ff26dc693b548acf65696369079b9ad01af5693 (patch)
treeb8bc44741faeb614bce8158e827da1511c425d4c /src/ruby/tools
parentba9aa59bdfc107054dd6083f36b3527a9bc85d72 (diff)
parentc8fa4cfcffdcca960eb6b7a4352dae868c20c6ef (diff)
v1.0.x → master upmerge
Manual resolution: - Force use of local distributions in Python-building in tools/run_tests/helper_scripts/build_python.sh.
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