If you need to reference local gems in your Gemfile, but don't want to annoy your coworkers by hardcoding a path in your home directory, here's a quick solution.
Comments
You can use paths that are relative the the Gemfile - i.e. :path => "../gemname"astevens - November 30, 2012 04:14
Good point. But that still might mean making an assumption based on your own directory structure that isn't true for your teammates.NathanLong - November 30, 2012 13:26
You still have the problem of having to remove local paths when you are ready to deploy. Or is there some other way around that?trans - November 30, 2012 13:42
@trans - you're right. I don't know a way around that. What we do is comment out the line pointing to the local gem and uncomment the one pointing to the the git repo.NathanLong - November 30, 2012 18:38
A solution to the commenting/uncommenting problem is to define method and configure it using environment variables from the command line, something like this:
def local_gem(name)
if ENV["GEM_#{name.uppercase}"] == "local"
gem name
else
gem name, :path => "/usr/local/gems/#{name}"
end
end
Then you could:
GEM_DEVISE=local rails server
Just don't forget to do a plain `bundle install` before committing.Leventix - December 04, 2012 23:18
Comments