Skip to content
Gem version automation with Bundler
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Explicitly call instead of importing it Jan 23, 2016
spec #3 #4 Improve retainment of spacing Jan 12, 2017
.gitignore update gemspec Aug 16, 2015
.ruby-version it's alive Jul 19, 2015
Gemfile Seperate real Gemfile from testing Gemfile Dec 9, 2015
LICENSE.txt add license Feb 6, 2016 Add drg:upgrade_file[file] to help with deprecations Dec 29, 2016
Rakefile Update rake task descriptions and the README to reflect it Jan 23, 2016
drg.gemspec Remove duck_puncher dependency Sep 16, 2016

DRG Code Climate Gem Version Build Status

A Ruby utility to help automate dependency management using Bundler. You can pin Gem versions to the current or the next available level.


  • Bundler 1.10+


gem 'drg'


% rake -T
rake drg:pin                    # Pin the gems in your Gemfile to the current version in the Gemfile.lock
rake drg:pin:major              # Add the approximate major version of your gems (rails, "~> 4")
rake drg:pin:minor              # Add the approximate minor version of your gems (rails, "~> 4.2")
rake drg:pin:patch              # Add the approximate patch version of your gems (rails, "~> 4.2.3")
rake drg:pin:latest[gem]        # Pin the given gem to the latest version (defaults to all gems)
rake drg:pin:minor_latest[gem]  # Pin the given gem to the latest available patch version (defaults to all gems)
rake drg:pin:patch_latest[gem]  # Pin the given gem to the latest available minor version (defaults to all gems)
rake drg:unpin                  # Unpin the gems in your Gemfile
rake drg:upgrade_file[file]     # Updates the file to use Ruby 2 hash syntax and fixes RSpec and FactoryGirl deprecations


DRG really wants to help you manage your project's gems. But DRG doesn't want to replace Bundler. Instead, we want to build on it. Pinning ignores gems that are fetched from somewhere other than rubygems. For example, gems listed with :git, :github, or :path will be ignored. You can "pin" all your versions to the current version listed in the Gemfile.lock:

rake drg:pin

This task will update your Gemfile with the gem's approximate version. It'll change:

gem 'rails'
gem 'byebug', require: false
gem 'therubyracer', '~> 0.12', platforms: :ruby
gem 'drg' # :)


gem 'rails', '~> 4.2'
gem 'byebug', '~> 5.0', require: false
gem 'therubyracer', '~> 0.12', platforms: :ruby
gem 'drg', '~> 1.2' # :)


I use the bin/drg bash script to update all gems to the latest [major|minor|patch] version, run all tests and then add the result if the specs pass or rollback the changes if they fail (e.g. bin/drg patch).

Skipping gems

You can tell drg to ignore gems by adding an inline comment with @drg (skip|ignore|frozen)

gem 'name' # @drg skip


Looking for drg:spec that does RSpec scaffolding? It's been moved to it's own gem: rspec-scaffold


Having trouble on Rails 3? Try updating to the latest version or make sure the line with gem 'drg' is outside of the :development and :test blocks. It Needs to be at the top level for some reason.


After checking out the repo, run bin/setup to install dependencies. Then, run rake to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.


Bug reports and pull requests are welcome on GitHub at

You can’t perform that action at this time.