Merge pull request #10279 from chrisroberts/e-local-encoded

Provide rgloader for project local plugins
This commit is contained in:
Chris Roberts 2018-10-10 16:38:09 -07:00 committed by GitHub
commit a841a75a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -906,6 +906,13 @@ module Vagrant
begin
@logger.debug("Creating: #{@local_data_path}")
FileUtils.mkdir_p(@local_data_path)
# Create the rgloader/loader file so we can use encoded files.
loader_file = @local_data_path.join("rgloader", "loader.rb")
if !loader_file.file?
source_loader = Vagrant.source_root.join("templates/rgloader.rb")
FileUtils.mkdir_p(@local_data_path.join("rgloader").to_s)
FileUtils.cp(source_loader.to_s, loader_file.to_s)
end
rescue Errno::EACCES
raise Errors::LocalDataDirectoryNotAccessible,
local_data_path: @local_data_path.to_s

View File

@ -1513,4 +1513,21 @@ VF
end
end
end
describe "#setup_local_data_path" do
before do
allow(FileUtils).to receive(:mkdir_p).and_call_original
allow(FileUtils).to receive(:cp).and_call_original
end
it "should create an rgloader path" do
expect(FileUtils).to receive(:mkdir_p).with(/(?!home)rgloader/)
instance
end
it "should write the rgloader file" do
expect(FileUtils).to receive(:cp).with(anything, /(?!home)rgloader.*rb$/)
instance
end
end
end