core: use symbol names for providers everywhere
This commit is contained in:
parent
e316e10552
commit
f2c4adc4ee
|
@ -51,7 +51,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
providers = nil
|
providers = nil
|
||||||
providers = Array(opts[:provider]) if opts[:provider]
|
providers = Array(opts[:provider]).map(&:to_sym) if opts[:provider]
|
||||||
|
|
||||||
@version_map.keys.sort.reverse.each do |v|
|
@version_map.keys.sort.reverse.each do |v|
|
||||||
next if !requirements.all? { |r| r.satisfied_by?(v) }
|
next if !requirements.all? { |r| r.satisfied_by?(v) }
|
||||||
|
@ -84,7 +84,7 @@ module Vagrant
|
||||||
|
|
||||||
@version = raw["version"]
|
@version = raw["version"]
|
||||||
@provider_map = (raw["providers"] || []).map do |p|
|
@provider_map = (raw["providers"] || []).map do |p|
|
||||||
[p["name"], p]
|
[p["name"].to_sym, p]
|
||||||
end
|
end
|
||||||
@provider_map = Hash[@provider_map]
|
@provider_map = Hash[@provider_map]
|
||||||
end
|
end
|
||||||
|
@ -92,7 +92,7 @@ module Vagrant
|
||||||
# Returns a [Provider] for the given name, or nil if it isn't
|
# Returns a [Provider] for the given name, or nil if it isn't
|
||||||
# supported by this version.
|
# supported by this version.
|
||||||
def provider(name)
|
def provider(name)
|
||||||
p = @provider_map[name]
|
p = @provider_map[name.to_sym]
|
||||||
return nil if !p
|
return nil if !p
|
||||||
Provider.new(p)
|
Provider.new(p)
|
||||||
end
|
end
|
||||||
|
@ -100,9 +100,9 @@ module Vagrant
|
||||||
# Returns the providers that are available for this version
|
# Returns the providers that are available for this version
|
||||||
# of the box.
|
# of the box.
|
||||||
#
|
#
|
||||||
# @return [Provider]
|
# @return [Array<Symbol>]
|
||||||
def providers
|
def providers
|
||||||
@provider_map.keys
|
@provider_map.keys.map(&:to_sym)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ describe Vagrant::BoxMetadata do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "matches the constraint that has the given provider" do
|
it "matches the constraint that has the given provider" do
|
||||||
result = subject.version(">= 0", provider: "vmware")
|
result = subject.version(">= 0", provider: :vmware)
|
||||||
expect(result).to_not be_nil
|
expect(result).to_not be_nil
|
||||||
expect(result).to be_kind_of(Vagrant::BoxMetadata::Version)
|
expect(result).to be_kind_of(Vagrant::BoxMetadata::Version)
|
||||||
expect(result.version).to eq("1.1.0")
|
expect(result.version).to eq("1.1.0")
|
||||||
|
@ -131,7 +131,7 @@ describe Vagrant::BoxMetadata::Version do
|
||||||
describe "#providers" do
|
describe "#providers" do
|
||||||
it "returns the providers available" do
|
it "returns the providers available" do
|
||||||
expect(subject.providers.sort).to eq(
|
expect(subject.providers.sort).to eq(
|
||||||
["virtualbox", "vmware"])
|
[:virtualbox, :vmware])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue