1[![Gem](https://img.shields.io/gem/v/grpc.svg)](https://rubygems.org/gems/grpc/) 2gRPC Ruby 3========= 4 5A Ruby implementation of gRPC. 6 7PREREQUISITES 8------------- 9 10- Ruby 2.x. The gRPC API uses keyword args. 11 12INSTALLATION 13--------------- 14 15**Linux and Mac OS X:** 16 17```sh 18gem install grpc 19``` 20 21BUILD FROM SOURCE 22--------------------- 23- Clone this repository 24 25- Init submodules 26 27```sh 28git submodule update --init 29``` 30 31- Install Ruby 2.x. Consider doing this with [RVM](http://rvm.io), it's a nice way of controlling 32 the exact ruby version that's used. 33```sh 34$ command curl -sSL https://rvm.io/mpapis.asc | gpg --import - 35$ \curl -sSL https://get.rvm.io | bash -s stable --ruby=ruby-2 36$ 37$ # follow the instructions to ensure that your're using the latest stable version of Ruby 38$ # and that the rvm command is installed 39``` 40- Make sure your run `source $HOME/.rvm/scripts/rvm` as instructed to complete the set up of RVM 41 42- Install [bundler](http://bundler.io/) 43``` 44$ gem install bundler 45``` 46 47- Finally, build and install the gRPC gem locally. 48```sh 49$ # from this directory 50$ bundle install # creates the ruby bundle, including building the grpc extension 51$ rake # runs the unit tests, see rake -T for other options 52``` 53 54DOCUMENTATION 55------------- 56- rubydoc for the gRPC gem is available online at [rubydoc][]. 57- the gRPC Ruby reference documentation is available online at [grpc.io][] 58 59CONTENTS 60-------- 61Directory structure is the layout for [ruby extensions][] 62- ext: the gRPC ruby extension 63- lib: the entrypoint gRPC ruby library to be used in a 'require' statement 64- spec: Rspec unittests 65- bin: example gRPC clients and servers, e.g, 66 67 ```ruby 68 stub = Math::Math::Stub.new('my.test.math.server.com:8080', :this_channel_is_insecure) 69 req = Math::DivArgs.new(dividend: 7, divisor: 3) 70 GRPC.logger.info("div(7/3): req=#{req.inspect}") 71 resp = stub.div(req) 72 GRPC.logger.info("Answer: #{resp.inspect}") 73 ``` 74 75[ruby extensions]:http://guides.rubygems.org/gems-with-extensions/ 76[rubydoc]: http://www.rubydoc.info/gems/grpc 77[grpc.io]: https://grpc.io/docs/languages/ruby/quickstart 78[Debian jessie-backports]:http://backports.debian.org/Instructions/ 79