Declare App Dependencies
Page last updated:
Page last updated:
Cloud Foundry recognizes an app as a Ruby app by the existence of a Gemfile
and a Gemfile.lock
file in the root directory.
The demo app you deployed already has a Gemfile
, and it looks something like this:
source 'https://rubygems.org'
gem 'puma'
gem 'rack-coffee'
group :web do
gem 'haml'
gem 'sinatra'
gem 'sass'
end
group :development do
gem 'sinatra-reloader'
end
The Gemfile
file specifies the dependencies that should be installed with your application.
When an app is deployed, Cloud Foundry reads this file and installs the appropriate Ruby version together with the dependencies using the bundle install
command.
Now run bundle install
in your local directory to install the dependencies, preparing your system for running the app locally:
$ bundle install Using backports 3.3.5 Using coffee-script-source 1.6.2 Using multi_json 1.7.6 Using tilt 1.4.1 ...
Pro Tip: It’s good practice to specify the Ruby version to use in your Gemfile
. Be aware though, that Cloud Foundry only accepts the Ruby versions specified here.
Once dependencies are installed, you will be ready to run your app locally.
View the source for this page in GitHub