Reputation: 334
I'm curious if there is some comfortable way to use some gem locally but not pushing it to a public repository.
For example, let's assume that project I'm working on is not using in development gem likebetter_errors
, but it may be very useful for me.
I know I could add it to my Gemfile and just not include it in a commit, but then I could forget about it and push it someday. Also keeping it in mind all the time may be frustrating.
I just wonder is there some nice way to have it automatically included in the local copy and preventing from pushing.
Upvotes: 0
Views: 63
Reputation: 106882
You could add an initializer like this to your Rails app:
# in config/initializers/local_gems.rb
%q[better_errors binding_of_caller].each do |gem|
require(gem) rescue puts("Gem not installed: #{gem}")
end
But this only loads the gem when it was installed before and that means you have to install it manually and cannot use bundler.
Upvotes: 1