I am trying to customize a gem called "gem_name" from github. I forked the project and cloned it to a directory.
I changed s.name in the "spec = Gem::Specification.new do |s|" block in the rake file to a custom gem name "gem_name_myname".
I also changed a line in the rails/init.rb file called "require gem_name" to require "gem_name_mygemname".
Then I installed the gem locally with rake install.
IN my app I changed the config.gem call to refer to "gem_name_mygem".
But when I start the app, it开发者_如何学Python throws the error saying
no-such-file to load "gem_name_mygem"
What's the best way to customize a gem? What am I doing wrong?
I'm guessing that you need to put your customised gem somewhere in your load path.
Did you check that the location resulting from rake install was in your application's load path? Perhaps you need to vendor your gem? By that I mean you can put your custom gem in vendor/gems by locally using rake gems:unpack. This command will vendor any dependent gems listed listed in the environment.rb
A lot of this does depend upon which version of Rails you are using, and what kind of gem you have customised, so I'm taking some big guesses here!
精彩评论