Don't like ads? PRO users don't see any ads ;-)
Guest

Vagrantfile problem

By: a guest on May 11th, 2012  |  syntax: Ruby  |  size: 1.03 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. # I have a Vagrantfile (Ruby) beginning:
  3.  
  4. require 'rubygems'
  5. require 'git'
  6.  
  7. # But "vagrant reload" (say) fails with LoadError -- git ...
  8.  
  9. # But the git gem is installed:
  10.  
  11. $ /opt/vagrant/embedded/bin/irb
  12. irb(main):001:0> require 'git'
  13. => true
  14.  
  15. irb(main):002:0> $LOAD_PATH
  16. => ["/opt/vagrant/embedded/lib/ruby/gems/1.9.1/gems/git-1.2.5/lib", "/opt/vagrant/embedded/lib/ruby/site_ruby/1.9.1", "/opt/vagrant/embedded/lib/ruby/site_ruby/1.9.1/i686-linux", "/opt/vagrant/embedded/lib/ruby/site_ruby", "/opt/vagrant/embedded/lib/ruby/vendor_ruby/1.9.1", "/opt/vagrant/embedded/lib/ruby/vendor_ruby/1.9.1/i686-linux", "/opt/vagrant/embedded/lib/ruby/vendor_ruby", "/opt/vagrant/embedded/lib/ruby/1.9.1", "/opt/vagrant/embedded/lib/ruby/1.9.1/i686-linux"]
  17. irb(main):003:0>
  18.  
  19. # I have to do this at the top of the Vagrantfile:
  20.  
  21. $LOAD_PATH.push('/opt/vagrant/embedded/lib/ruby/gems/1.9.1/gems/git-1.2.5/lib/')
  22.  
  23. require 'rubygems'
  24. require 'git'
  25.  
  26. # Is there any way to avoid the "$LOAD_PATH.push" step, so that vagrant works transparently?