Dependencies for Ruby applications are declared in a
[`Gemfile`](https://bundler.io/v2.4/man/gemfile.5.html)
file.

For example:

    source "https://rubygems.org"

    gem "rails"

You can use any Linux-compatible Ruby package in the App Engine flexible
environment, including packages that require native (C) extensions.

The Ruby runtime will [automatically install](https://docs.cloud.google.com/appengine/docs/flexible/ruby/runtime#dependencies) all
dependencies declared in your `Gemfile` file during deployment.

## Installing a web framework

You'll need to use a web framework to enable your app to serve web requests.
You can use any Ruby web framework including the following:

- [Ruby on Rails](http://rubyonrails.org/)
- [Sinatra](http://www.sinatrarb.com/)
- [Rack](http://rack.github.io/)

To use a particular web framework, specify a startup command in your `app.yaml`
file:

    runtime: ruby
    env: flex
    entrypoint: rails server

## Installing the Cloud Client Libraries

The [Cloud Client Libraries for Ruby](https://docs.cloud.google.com/ruby/docs/reference) is a client
library for accessing Google Cloud services that significantly reduces
the boilerplate code you have to write. The library provides high-level API
abstractions so they're easier to understand and means you spend more time
creating code that matters to you.

To install the library locally:

    gem install google-cloud

The client library can automatically handle authentication for you locally as
well by using [Google Cloud CLI](https://docs.cloud.google.com/sdk/docs):

    gcloud auth login

For details on configuring Cloud Client Libraries for Ruby to handle authentication
automatically, see [Authenticate to Cloud services using client libraries](https://docs.cloud.google.com/docs/authentication/client-libraries).