blob: 1fa958db94be253fc6646301253ff2dab89398b7 [file] [log] [blame] [view]
Tim Emiolaeb158ff2015-02-21 06:29:53 -08001gRPC in 3 minutes (Ruby)
2========================
Tim Emiola49f3ccd2015-02-19 11:09:19 -08003
Dan Cirulibc4b1ce2015-02-25 15:22:58 -08004BACKGROUND
5-------------
6For this sample, we've already generated the server and client stubs from [helloworld.proto](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto).
7
Tim Emiolaeb158ff2015-02-21 06:29:53 -08008PREREQUISITES
9-------------
Tim Emiola49f3ccd2015-02-19 11:09:19 -080010
Tim Emiola9da96d92015-04-30 13:09:07 -040011- Ruby 2.x
12
13This requires Ruby 2.x, as the gRPC API surface uses keyword args.
14If you don't have that installed locally, you can use [RVM](https://www.rvm.io/) to use Ruby 2.x for testing without upgrading the version of Ruby on your whole system.
Tim Emiola8af51752015-02-26 02:04:15 -080015RVM is also useful if you don't have the necessary privileges to update your system's Ruby.
Tim Emiola5b5e1462015-02-25 04:18:56 -080016```sh
Tim Emiola8af51752015-02-26 02:04:15 -080017$ # RVM installation as specified at https://rvm.io/rvm/install
18$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Tim Emiola9da96d92015-04-30 13:09:07 -040019$ \curl -sSL https://get.rvm.io | bash -s stable --ruby=ruby-2
Tim Emiola5b5e1462015-02-25 04:18:56 -080020$
21$ # follow the instructions to ensure that your're using the latest stable version of Ruby
22$ # and that the rvm command is installed
23```
Tim Emiola8af51752015-02-26 02:04:15 -080024- *N.B* Make sure your run `source $HOME/.rvm/scripts/rvm` as instructed to complete the set-up of RVM.
Tim Emiola5b5e1462015-02-25 04:18:56 -080025
Tim Emiola9da96d92015-04-30 13:09:07 -040026- Homebrew/Linuxbrew
27
28The gRPC core will be installed using [Linuxbrew][Linuxbrew] for Linux and [Homebrew][Homebrew] on Macs.
29Please ensure these are installed before proceeding.
30
Tim Emiola49f3ccd2015-02-19 11:09:19 -080031INSTALL
32-------
33
Tim Emiola9da96d92015-04-30 13:09:07 -040034- Clone this repository
Tim Emiola5828df62015-02-26 12:57:10 -080035- Use bundler to install the example package's dependencies
Tim Emiola49f3ccd2015-02-19 11:09:19 -080036```sh
37$ # from this directory
Tim Emiola5828df62015-02-26 12:57:10 -080038$ gem install bundler # if you don't already have bundler available
39$ bundle install
Tim Emiola49f3ccd2015-02-19 11:09:19 -080040```
41
Tim Emiolaeb158ff2015-02-21 06:29:53 -080042Try it!
43-------
Tim Emiola49f3ccd2015-02-19 11:09:19 -080044
45- Run the server
46```sh
47$ # from this directory
48$ bundle exec ./greeter_server.rb &
49```
50
51- Run the client
52```sh
53$ # from this directory
54$ bundle exec ./greeter_client.rb
55```
Tim Emiolac66fe1e2015-02-26 03:53:16 -080056
57Tutorial
58--------
59
60You can find a more detailed tutorial in [gRPC Basics: Ruby](https://github.com/grpc/grpc-common/blob/master/ruby/route_guide/README.md)
Tim Emiola9da96d92015-04-30 13:09:07 -040061
62[Homebrew]: https://github.com/Homebrew/homebrew
63[Linuxbrew]: https://github.com/Homebrew/linuxbrew