From 67c2e205bef46f9d874cbc784396f99f310da209 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 31 Jan 2013 18:48:56 -0800 Subject: [PATCH] Create rgloader/loader.rb files for encoded files --- lib/vagrant/environment.rb | 9 ++++++++- templates/rgloader.rb | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 templates/rgloader.rb diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index c6c5f7e14..37554a066 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -490,7 +490,7 @@ module Vagrant # Setup the list of child directories that need to be created if they # don't already exist. dirs = [@home_path] - subdirs = ["boxes", "data", "gems", "tmp"] + subdirs = ["boxes", "data", "gems", "rgloader", "tmp"] dirs += subdirs.collect { |subdir| @home_path.join(subdir) } # Go through each required directory, creating it if it doesn't exist @@ -514,6 +514,13 @@ module Vagrant f.write("1.1") end end + + # Create the rgloader/loader file so we can use encoded files. + loader_file = @home_path.join("rgloader", "loader.rb") + if !loader_file.file? + source_loader = Vagrant.source_root.join("templates/rgloader.rb") + FileUtils.cp(source_loader.to_s, loader_file.to_s) + end end # This creates the local data directory and show an error if it diff --git a/templates/rgloader.rb b/templates/rgloader.rb new file mode 100644 index 000000000..53f19cb80 --- /dev/null +++ b/templates/rgloader.rb @@ -0,0 +1,7 @@ +# This file loads the proper rgloader/loader.rb file that comes packaged +# with Vagrant so that encoded files can properly run with Vagrant. + +if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"] + require File.expand_path( + "rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]) +end