Skip to content

Instantly share code, notes, and snippets.

@arvind02
Last active May 16, 2018 12:03
Show Gist options
  • Save arvind02/046e90b18b10255aa1d89e5ee468eb0f to your computer and use it in GitHub Desktop.
Save arvind02/046e90b18b10255aa1d89e5ee468eb0f to your computer and use it in GitHub Desktop.
Testing Ruby Gem

Option 1st

Long way of doing things (new files need to be added to staging area before building the gem)

git add . && gem build my_gem.gemspec && gem install my_gem-0.0.0.gem

Option 2nd

If using Bundler to generate the gem (rake task does the same as above)

git add . && rake install

Option 3rd

This way you don't need to rebuild the gem after every change

gem 'my_gem', :path => '/Users/me/path/to/my_gem'
gem 'some_gem', :git => 'https://github.com/User/SomeGem.git', :branch => 'some-branch'
bundle exec my_gem_command

Note: if you point to a local gem "A" and that gem internally references/requires another local gem "B" which you wish to run locally, then you need to open the Gemfile for the top-level application and modify it to use the same Bundler trick again gem "b", :path => "path/to/local/b/gem"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment