I have a custom gem that is published only to Github, not rubygems.org, and updated its dependencies to include the gem 'net-http-persistent'.
I followed the same format which I did previously for my other dependencies (using a .gemspec file), and bundle update
still works just fine. However, now when I try to deploy the main app (which includes my custom gem) to my Staging server with Capistrano, I'm hit with this error:
DEBUG [20cee5f9] Command: cd /var/www/inside/releases/20160418182647 && ( RAILS_ENV=staging ~/.rvm/bin/rvm 2.1.0@rails4.1 do bundle exec rake assets:precompile )
DEBUG [20cee5f9] rake aborted!
DEBUG [20cee5f9] LoadError: cannot load such file -- net-http-persistent
DEBUG [20cee5f9] /var/www/inside/shared/bundle/ruby/2.1.0/bundler/gems/series25-5465e368ff56/lib/series25.rb:4:in `require'
DEBUG [20cee5f9] /var/www/inside/shared/bundle/ruby/2.1.0/bundler/gems/series25-5465e368ff56/lib/series25.rb:4:in `<top (required)>'
DEBUG [20cee5f9] /home/charles/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
DEBUG [20cee5f9] /home/charles/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
DEBUG [20cee5f9] /home/charles/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
DEBUG [20cee5f9] /home/charles/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
DEBUG [20cee5f9] /home/charles/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
DEBUG [20cee5f9] /home/charles/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
DEBUG [20cee5f9] /home/charles/.rvm/gems/ruby-2.1.0@global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
DEBUG [20cee5f9] /var/www/inside/releases/20160418182647/config/application.rb:9:in `<top (required)>'
DEBUG [20cee5f9] /var/www/inside/releases/20160418182647/Rakefile:4:in `require'
DEBUG [20cee5f9] /var/www/inside/releases/20160418182647/Rakefile:4:in `<top (required)>'
DEBUG [20cee5f9] (See full trace by running task with --trace)
cap aborted!
I've been able to replicate the error locally by simply running rake assets:precompile
. I've tried many potential fixes, including installing net-http-persistent locally and adding it to my Gemfile, but to no avail.
Here's what the custom gem looks like in my gemfile currently:
gem 'series25', git: 'git://github.com/chapmanu/series25.git'
I made this issue in a bit of a hurry, so if I'm missing any pertinent information let me know. Thanks ahead of time for helping!
Turns out that while the gemspec file needed spec.add_dependency 'net-http-persistent'
, the file in which I put all of my require statements (In my case & in most cases something like lib/mygem.rb
) needed require 'net/http/persistent'
.
Certainly specific to my case with this gem, but hopefully useful to anyone else who runs into a similar problem at some point.