3 # This is a wrapper to properly execute Vagrant so that it sees system gems and
4 # merges with it's own gems.
6 # This sets up proper environmental variables so that everything loads and
7 # compiles to proper directories.
9 # Set the path to the Ruby executable
10 RUBY_EXECUTABLE="/usr/bin/ruby"
12 GEM_PATH=$($RUBY_EXECUTABLE -r rubygems -e 'puts Gem.respond_to?(:default_dirs) ? Gem.default_dirs[:system][:gem_dir] : Gem.path.first')
15 # Export gem paths so it can find vagrant own gem
16 export GEM_HOME="${GEM_PATH}"
18 # Unset any RUBYOPT and RUBYLIB, we don't want these bleeding into our
23 # Find the Vagrant executable
24 for needle in "${GEM_PATH}/gems/vagrant-"*; do
25 if [ -f "${needle}/lib/vagrant/version.rb" ]; then
26 VAGRANT_GEM_PATH="${needle}"
30 VAGRANT_EXECUTABLE="${VAGRANT_GEM_PATH}/bin/vagrant"
32 # Call the actual Vagrant bin with our arguments
33 exec "$RUBY_EXECUTABLE" -r rubygems "$VAGRANT_EXECUTABLE" "$@"