hosts/*: proper detect API

This commit is contained in:
Mitchell Hashimoto 2014-01-07 21:18:36 -08:00
parent 5f832467b3
commit e9f6c81ab7
8 changed files with 8 additions and 8 deletions

View File

@ -10,7 +10,7 @@ module Vagrant
# matches the host class. # matches the host class.
# #
# @return [Boolean] # @return [Boolean]
def detect? def detect?(env)
false false
end end
end end

View File

@ -4,7 +4,7 @@ require 'vagrant/util/platform'
module VagrantPlugins module VagrantPlugins
module HostFreeBSD module HostFreeBSD
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def self.detect?(env) def detect?(env)
Vagrant::Util::Platform.freebsd? Vagrant::Util::Platform.freebsd?
end end
end end

View File

@ -3,7 +3,7 @@ require "vagrant"
module VagrantPlugins module VagrantPlugins
module HostGentoo module HostGentoo
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def self.detect?(env) def detect?(env)
File.exists?("/etc/gentoo-release") File.exists?("/etc/gentoo-release")
end end
end end

View File

@ -4,7 +4,7 @@ module VagrantPlugins
module HostLinux module HostLinux
# Represents a Linux based host, such as Ubuntu. # Represents a Linux based host, such as Ubuntu.
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def self.detect?(env) def detect?(env)
Vagrant::Util::Platform.linux? Vagrant::Util::Platform.linux?
end end
end end

View File

@ -5,7 +5,7 @@ require "vagrant"
module VagrantPlugins module VagrantPlugins
module HostOpenSUSE module HostOpenSUSE
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def self.detect?(env) def detect?(env)
release_file = Pathname.new("/etc/SuSE-release") release_file = Pathname.new("/etc/SuSE-release")
if release_file.exist? if release_file.exist?

View File

@ -5,7 +5,7 @@ require "vagrant"
module VagrantPlugins module VagrantPlugins
module HostRedHat module HostRedHat
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def self.detect?(env) def detect?(env)
release_file = Pathname.new("/etc/redhat-release") release_file = Pathname.new("/etc/redhat-release")
if release_file.exist? if release_file.exist?

View File

@ -3,7 +3,7 @@ require "vagrant"
module VagrantPlugins module VagrantPlugins
module HostSlackware module HostSlackware
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def self.detect?(env) def detect?(env)
return File.exists?("/etc/slackware-release") || return File.exists?("/etc/slackware-release") ||
!Dir.glob("/usr/lib/setup/Plamo-*").empty? !Dir.glob("/usr/lib/setup/Plamo-*").empty?
end end

View File

@ -5,7 +5,7 @@ require 'vagrant/util/platform'
module VagrantPlugins module VagrantPlugins
module HostWindows module HostWindows
class Host < Vagrant.plugin("2", :host) class Host < Vagrant.plugin("2", :host)
def self.detect?(env) def detect?(env)
Vagrant::Util::Platform.windows? Vagrant::Util::Platform.windows?
end end
end end