Often during app development, it's a good idea to extract some functionality into a gem. The simple way to do this is to open a new git repository, do a
bundle gem foobar, publish it, install said gem inside Rails app, use it and test some more.
How about updates? We have to change the gem, guessing how it can be used inside Rails. Then release a version, install it inside your app, and finally do some testing. This is a lot of friction. This can be especially bad if your gem is closely coupled with the app, or gets updated a lot.
How about this?
- Create an empty gem (e.g.
bundle gem foobar) (without doing any release)
- Push it onto Github.
- Put the gem in your Rails app as a submodule:
git submodule add https://github.com/foo/foobar.git vendor/foobar
- Install the empty gem in your app's Gemfile:
gem 'settei', path:'./vendor/foobar'
Now develop the gem entirely inside app's submodule. It's probably possible to autoload it (though I don't recommend it). This will also work in production too.