core: Vagrant.installer_embedded_dir
This commit is contained in:
parent
7194fc9173
commit
616bf15df5
|
@ -8,6 +8,15 @@ module Vagrant
|
|||
# @return [String]
|
||||
DEFAULT_SERVER_URL = "https://www.vagrantcloud.com"
|
||||
|
||||
# Returns the path to the embedded directory of the Vagrant installer,
|
||||
# if there is one (if we're running in an installer).
|
||||
#
|
||||
# @return [String]
|
||||
def self.installer_embedded_dir
|
||||
return nil if !Vagrant.in_installer?
|
||||
ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
|
||||
end
|
||||
|
||||
# This returns whether or not 3rd party plugins should be loaded.
|
||||
#
|
||||
# @return [Boolean]
|
||||
|
|
|
@ -8,6 +8,21 @@ describe Vagrant do
|
|||
|
||||
subject { described_class }
|
||||
|
||||
describe "#installer_embedded_dir" do
|
||||
it "returns nil if not in an installer" do
|
||||
Vagrant.stub(in_installer?: false)
|
||||
expect(subject.installer_embedded_dir).to be_nil
|
||||
end
|
||||
|
||||
it "returns the set directory" do
|
||||
Vagrant.stub(in_installer?: true)
|
||||
|
||||
with_temp_env("VAGRANT_INSTALLER_EMBEDDED_DIR" => "/foo") do
|
||||
expect(subject.installer_embedded_dir).to eq("/foo")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#plugins_enabled?" do
|
||||
it "returns true if the env is not set" do
|
||||
with_temp_env("VAGRANT_NO_PLUGINS" => nil) do
|
||||
|
|
Loading…
Reference in New Issue