OLD | NEW |
(Empty) | |
| 1 gRPC in 3 minutes (Ruby) |
| 2 ======================== |
| 3 |
| 4 BACKGROUND |
| 5 ------------- |
| 6 For this sample, we've already generated the server and client stubs from [hello
world.proto][] |
| 7 |
| 8 PREREQUISITES |
| 9 ------------- |
| 10 |
| 11 - Ruby 2.x |
| 12 This requires Ruby 2.x, as the gRPC API surface uses keyword args. |
| 13 If you don't have that installed locally, you can use [RVM][] to use Ruby 2.x fo
r testing without upgrading the version of Ruby on your whole system. |
| 14 RVM is also useful if you don't have the necessary privileges to update your sys
tem's Ruby. |
| 15 |
| 16 ```sh |
| 17 $ # RVM installation as specified at https://rvm.io/rvm/install |
| 18 $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A170311380
4BB82D39DC0E3 |
| 19 $ \curl -sSL https://get.rvm.io | bash -s stable --ruby=ruby-2 |
| 20 $ |
| 21 $ # follow the instructions to ensure that your're using the latest stable ver
sion of Ruby |
| 22 $ # and that the rvm command is installed |
| 23 ``` |
| 24 - *N.B* Make sure your run `source $HOME/.rvm/scripts/rvm` as instructed to comp
lete the set-up of RVM. |
| 25 |
| 26 INSTALL |
| 27 ------- |
| 28 - [Install gRPC Ruby][] |
| 29 |
| 30 - Use bundler to install the example package's dependencies |
| 31 |
| 32 ```sh |
| 33 $ # from this directory |
| 34 $ gem install bundler # if you don't already have bundler available |
| 35 $ bundle install |
| 36 ``` |
| 37 |
| 38 Try it! |
| 39 ------- |
| 40 |
| 41 - Run the server |
| 42 |
| 43 ```sh |
| 44 $ # from this directory |
| 45 $ bundle exec ./greeter_server.rb & |
| 46 ``` |
| 47 |
| 48 - Run the client |
| 49 |
| 50 ```sh |
| 51 $ # from this directory |
| 52 $ bundle exec ./greeter_client.rb |
| 53 ``` |
| 54 |
| 55 Tutorial |
| 56 -------- |
| 57 |
| 58 You can find a more detailed tutorial in [gRPC Basics: Ruby][] |
| 59 |
| 60 [helloworld.proto]:../protos/helloworld.proto |
| 61 [RVM]:https://www.rvm.io/ |
| 62 [Install gRPC ruby]:../../src/ruby#installation |
| 63 [gRPC Basics: Ruby]:http://www.grpc.io/docs/tutorials/basic/ruby.html |
OLD | NEW |