Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to test a gem you're working on locally in your development host ruby on rails app

Setting up your bundle config to allow your host app to use the local version of your gem

What we don't want:

Having to test your gem on your host app after having to commit changes to your gem... and then having to rebundle your gemfile ... which forces you to refer to your gem-in-process like:

gem 'nfg_ui', git: 'https://github.com/network-for-good/nfg_ui', branch: 'feature/some_feature_branch_that_im_working_on'

And then have to:

$ bundle update gem_name`

None of that annoying stuff! Let's instead allow our gem to pick up immediate changes without having to rebundle from github.


Config bundler to use your local gem version:

Format:

$ bundle config [gem name] [path to the the local version of your gem]

Example using a real gem

This a gem that I'm working on and have cloned to my hardrive

$ bundle config local.nfg_ui /Users/jonathanroehm/projects/nfg_ui

Disabling local usage of your gem

Tell bundler config to STOP using your local gem version:

Format:

$ bundle config --delete local.[your gem name]

Example using a real gem

This deletes the config for the same gem I referred to above:

$ bundle config --delete local.nfg_ui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment