Move all guests to plugins, even the distros

This commit is contained in:
Mitchell Hashimoto 2012-04-18 21:23:25 -07:00
parent 7766eb6098
commit 1b2fa748f9
20 changed files with 142 additions and 59 deletions

View File

@ -125,14 +125,6 @@ module Vagrant
@hosts ||= Registry.new
end
# Global registry of available guest classes and shortcut symbols
# associated with them.
#
# This registry is used to look up the shortcuts for `config.vm.guest`.
def self.guests
@guests ||= Registry.new
end
# Global registry of provisioners.
#
# This registry is used to look up the provisioners provided for
@ -184,19 +176,6 @@ Vagrant.hosts.register(:gentoo) { Vagrant::Hosts::Gentoo }
Vagrant.hosts.register(:linux) { Vagrant::Hosts::Linux }
Vagrant.hosts.register(:windows) { Vagrant::Hosts::Windows }
# Register the built-in guests
Vagrant.guests.register(:arch) { Vagrant::Guest::Arch }
Vagrant.guests.register(:debian) { Vagrant::Guest::Debian }
Vagrant.guests.register(:fedora) { Vagrant::Guest::Fedora }
Vagrant.guests.register(:freebsd) { Vagrant::Guest::FreeBSD }
Vagrant.guests.register(:gentoo) { Vagrant::Guest::Gentoo }
Vagrant.guests.register(:linux) { Vagrant::Guest::Linux }
Vagrant.guests.register(:openbsd) { Vagrant::Guest::OpenBSD }
Vagrant.guests.register(:redhat) { Vagrant::Guest::Redhat }
Vagrant.guests.register(:solaris) { Vagrant::Guest::Solaris }
Vagrant.guests.register(:suse) { Vagrant::Guest::Suse }
Vagrant.guests.register(:ubuntu) { Vagrant::Guest::Ubuntu }
# Register the built-in provisioners
Vagrant.provisioners.register(:chef_solo) { Vagrant::Provisioners::ChefSolo }
Vagrant.provisioners.register(:chef_client) { Vagrant::Provisioners::ChefClient }

View File

@ -1,9 +0,0 @@
module Vagrant
module Guest
class Suse < Redhat
def network_scripts_dir
'/etc/sysconfig/network/'
end
end
end
end

View File

@ -3,9 +3,9 @@ require 'tempfile'
require 'vagrant/util/template_renderer'
module Vagrant
module Guest
class Arch < Linux
module VagrantPlugins
module GuestArch
class Guest < VagrantPlugins::GuestLinux::Guest
# Make the TemplateRenderer top-level
include Vagrant::Util

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestArch
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "Arch guest"
description "Arch guest support."
guest("arch") { Guest }
end
end
end

View File

@ -3,9 +3,9 @@ require 'tempfile'
require 'vagrant/util/template_renderer'
module Vagrant
module Guest
class Debian < Linux
module VagrantPlugins
module GuestDebian
class Guest < VagrantPlugins::GuestLinux::Guest
# Make the TemplateRenderer top-level
include Vagrant::Util

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestDebian
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "Debian guest"
description "Debian guest support."
guest("debian") { Guest }
end
end
end

View File

@ -3,9 +3,9 @@ require 'tempfile'
require 'vagrant/util/template_renderer'
module Vagrant
module Guest
class Fedora < Linux
module VagrantPlugins
module GuestFedora
class Guest < VagrantPlugins::GuestLinux::Guest
# Make the TemplateRenderer top-level
include Vagrant::Util

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestFedora
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "Fedora guest"
description "Fedora guest support."
guest("fedora") { Guest }
end
end
end

View File

@ -2,9 +2,9 @@ require 'tempfile'
require 'vagrant/util/template_renderer'
module Vagrant
module Guest
class Gentoo < Linux
module VagrantPlugins
module GuestGentoo
class Guest < VagrantPlugins::GuestLinux::Guest
# Make the TemplateRenderer top-level
include Vagrant::Util

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestGentoo
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "Gentoo guest"
description "Gentoo guest support."
guest("gentoo") { Guest }
end
end
end

View File

@ -1,7 +1,5 @@
require 'log4r'
require 'vagrant/guest/linux/error'
module VagrantPlugins
module GuestLinux
class Guest < Vagrant::Guest::Base

View File

@ -1,6 +1,6 @@
module Vagrant
module Guest
class OpenBSD < Base
module VagrantPlugins
module GuestOpenBSD
class Guest < VagrantPlugins::GuestLinux::Guest
def halt
vm.channel.sudo("shutdown -p -h now")

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestOpenBSD
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "OpenBSD guest"
description "OpenBSD guest support."
guest("openbsd") { Guest }
end
end
end

View File

@ -3,9 +3,9 @@ require 'tempfile'
require 'vagrant/util/template_renderer'
module Vagrant
module Guest
class Redhat < Linux
module VagrantPlugins
module GuestRedHat
class Guest < VagrantPlugins::GuestLinux::Guest
# Make the TemplateRenderer top-level
include Vagrant::Util

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestRedHat
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "RedHat guest"
description "RedHat guest support."
guest("redhat") { Guest }
end
end
end

View File

@ -0,0 +1,9 @@
module VagrantPlugins
module GuestSuse
class Guest < VagrantPlugins::GuestRedHat::Guest
def network_scripts_dir
'/etc/sysconfig/network/'
end
end
end
end

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestSuse
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "SUSE guest"
description "SUSE guest support."
guest("suse") { Guest }
end
end
end

View File

@ -1,8 +1,6 @@
require 'vagrant/guest/debian'
module Vagrant
module Guest
class Ubuntu < Debian
module VagrantPlugins
module GuestUbuntu
class Guest < VagrantPlugins::GuestDebian::Guest
def mount_shared_folder(name, guestpath, options)
# Mount it like normal
super

View File

@ -0,0 +1,14 @@
require "vagrant"
module VagrantPlugins
module GuestUbuntu
autoload :Guest, File.expand_path("../guest", __FILE__)
class Plugin < Vagrant.plugin("1")
name "Ubuntu guest"
description "Ubuntu guest support."
guest("ubuntu") { Guest }
end
end
end

View File

@ -13,10 +13,6 @@ describe Vagrant do
described_class.hosts.should be_a(Vagrant::Registry)
end
it "has a registry for guests" do
described_class.guests.should be_a(Vagrant::Registry)
end
it "has a registry for provisioners" do
described_class.provisioners.should be_a(Vagrant::Registry)
end