# heroku-buildpack-ruby **Repository Path**: mirrors_pelletier/heroku-buildpack-ruby ## Basic Information - **Project Name**: heroku-buildpack-ruby - **Description**: Heroku's Ruby Buildpack for Cedar - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-25 - **Last Updated**: 2026-05-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Heroku Buildpack for Ruby ![ruby](https://cloud.githubusercontent.com/assets/51578/13712725/3c6b3368-e793-11e5-83c1-728440111358.png) This is a [Heroku Buildpack](http://devcenter.heroku.com/articles/buildpacks) for Ruby, Rack, and Rails apps. It uses [Bundler](https://bundler.io) for dependency management. This buildpack requires 64-bit Linux. ## Usage ### Ruby Example Usage: $ ls Gemfile Gemfile.lock $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git $ git push heroku master ... -----> Heroku receiving push -----> Fetching custom buildpack -----> Ruby app detected -----> Installing dependencies using Bundler version 1.1.rc Running: bundle install --without development:test --path vendor/bundle --deployment Fetching gem metadata from http://rubygems.org/.. Installing rack (1.3.5) Using bundler (1.1.rc) Your bundle is complete! It was installed into ./vendor/bundle Cleaning up the bundler cache. -----> Discovering process types Procfile declares types -> (none) Default types for Ruby -> console, rake The buildpack will detect your app as Ruby if it has a `Gemfile` and `Gemfile.lock` files in the root directory. It will then proceed to run `bundle install` after setting up the appropriate environment for [ruby](http://ruby-lang.org) and [Bundler](https://bundler.io). #### Bundler For non-windows `Gemfile.lock` files, the `--deployment` flag will be used. In the case of windows, the Gemfile.lock will be deleted and Bundler will do a full resolve so native gems are handled properly. The `vendor/bundle` directory is cached between builds to allow for faster `bundle install` times. `bundle clean` is used to ensure no stale gems are stored between builds. ### Rails 2 Example Usage: $ ls app config db doc Gemfile Gemfile.lock lib log public Rakefile README script test tmp vendor $ ls config/environment.rb config/environment.rb $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git $ git push heroku master ... -----> Heroku receiving push -----> Ruby/Rails app detected -----> Installing dependencies using Bundler version 1.1.rc ... -----> Writing config/database.yml to read from DATABASE_URL -----> Rails plugin injection Injecting rails_log_stdout -----> Discovering process types Procfile declares types -> (none) Default types for Ruby/Rails -> console, rake, web, worker The buildpack will detect your app as a Rails 2 app if it has a `environment.rb` file in the `config` directory. #### Rails Log STDOUT A [rails_log_stdout](http://github.com/ddollar/rails_log_stdout) is installed by default so Rails' logger will log to STDOUT and picked up by Heroku's [logplex](http://github.com/heroku/logplex). #### Auto Injecting Plugins Any vendored plugin can be stopped from being installed by creating the directory it's installed to in the slug. For instance, to prevent rails_log_stdout plugin from being injected, add `vendor/plugins/rails_log_stdout/.gitkeep` to your git repo. ### Rails 3 Example Usage: $ ls app config config.ru db doc Gemfile Gemfile.lock lib log Procfile public Rakefile README script tmp vendor $ ls config/application.rb config/application.rb $ heroku create --buildpack https://github.com/heroku/heroku-buildpack-ruby.git $ git push heroku master -----> Heroku receiving push -----> Ruby/Rails app detected -----> Installing dependencies using Bundler version 1.1.rc Running: bundle install --without development:test --path vendor/bundle --deployment ... -----> Writing config/database.yml to read from DATABASE_URL -----> Preparing app for Rails asset pipeline Running: rake assets:precompile -----> Rails plugin injection Injecting rails_log_stdout Injecting rails3_serve_static_assets -----> Discovering process types Procfile declares types -> web Default types for Ruby/Rails -> console, rake, worker The buildpack will detect your apps as a Rails 3 app if it has an `application.rb` file in the `config` directory. #### Assets To enable static assets being served on the dyno, [rails3_serve_static_assets](http://github.com/pedro/rails3_serve_static_assets) is installed by default. If the [execjs gem](http://github.com/sstephenson/execjs) is detected then [node.js](http://github.com/joyent/node) will be vendored. The `assets:precompile` rake task will get run if no `public/manifest.yml` is detected. See [this article](http://devcenter.heroku.com/articles/rails31_heroku_cedar) on how rails 3.1 works on cedar. ## Documentation For more information about using Ruby and buildpacks on Heroku, see these Dev Center articles: - [Heroku Ruby Support](https://devcenter.heroku.com/articles/ruby-support) - [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/getting-started-with-ruby) - [Getting Started with Rails 4 on Heroku](https://devcenter.heroku.com/articles/getting-started-with-rails4) - [Buildpacks](https://devcenter.heroku.com/articles/buildpacks) - [Buildpack API](https://devcenter.heroku.com/articles/buildpack-api) ## Hacking To use this buildpack, fork it on Github. Push up changes to your fork, then create a test app with `--buildpack ` and push to it. To change the vendored binaries for Bundler, [Node.js](http://github.com/joyent/node), and rails plugins, use the rake tasks provided by the `Rakefile`. You'll need an S3-enabled AWS account and a bucket to store your binaries in as well as the [vulcan](http://github.com/heroku/vulcan) gem to build the binaries on heroku. For example, you can change the vendored version of Bundler to 1.1.rc. First you'll need to build a Heroku-compatible version of Node.js: $ export AWS_ID=xxx AWS_SECRET=yyy S3_BUCKET=zzz $ s3 create $S3_BUCKET $ rake gem:install[bundler,1.1.rc] Open `lib/language_pack/ruby.rb` in your editor, and change the following line: BUNDLER_VERSION = "1.11.2" Open `lib/language_pack/base.rb` in your editor, and change the following line: VENDOR_URL = "https://s3.amazonaws.com/zzz" Commit and push the changes to your buildpack to your Github fork, then push your sample app to Heroku to test. You should see: -----> Installing dependencies using Bundler version 1.1.rc NOTE: You'll need to vendor the plugins, node, Bundler, and libyaml by running the rake tasks for the buildpack to work properly. ### Testing The tests on this buildpack are written in Rspec to allow the use of `focused: true`. Parallelization of testing is provided by https://github.com/grosser/parallel_tests this lib spins up an arbitrary number of processes and running a different test file in each process, it does not parallelize tests within a test file. To run the tests: clone the repo, then `bundle install` then clone the test fixtures by running: ```sh $ bundle exec hatchet install ``` then go to [hatchet](https://github.com/heroku/hatchet) repo and follow the instructions to set it up. Now run the tests: ```sh $ bundle exec parallel_rspec -n 6 spec/ ``` If you don't want to run them in parallel you can still: ```sh $ bundle exec rake spec ``` Now go take a nap or do something for a really long time.