Custom Ruby Gem in Gemfile on Heroku
I've modified a Gem that I use in my Rails app, and need to use it on Heroku. Is there a way to upload the modified Gem to Heroku within my 开发者_C百科app and specify a custom path in my Gemfile?
You can place custom gems in the vendor
directory and then specify them in your Gemfile:
gem 'gemname', '1.0', :path => 'vendor/gemname'
in Gemfile:
gem 'blah', :git => 'https://github.com/XXX/YYY.git'
- Fork it on github
- Point your application to your modified gem using :git option when specifying gem dependency in Gemfile
You can set up a custom gem server like Geminabox. Unfortunately, it is designed for a LAN and has no built-in authentication. You can protect it via Rack::Auth middleware or use Rack::Mount to attach it to a secret path. If that's too tedious, you can use a private gem hosting service like Gemfury (disclaimer: I work on this service). Once you have either of those set up, just add the following to your Gemfile:
source 'https://custom-gem-server.com/secret-token/'
精彩评论