diff --git a/lib/vagrant.rb b/lib/vagrant.rb index c854103f2..f36cf5b5a 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -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 } diff --git a/lib/vagrant/guest/suse.rb b/lib/vagrant/guest/suse.rb deleted file mode 100644 index 113b2df71..000000000 --- a/lib/vagrant/guest/suse.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Vagrant - module Guest - class Suse < Redhat - def network_scripts_dir - '/etc/sysconfig/network/' - end - end - end -end diff --git a/lib/vagrant/guest/arch.rb b/plugins/guest_arch/guest.rb similarity index 95% rename from lib/vagrant/guest/arch.rb rename to plugins/guest_arch/guest.rb index c0686c092..a45efb369 100644 --- a/lib/vagrant/guest/arch.rb +++ b/plugins/guest_arch/guest.rb @@ -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 diff --git a/plugins/guest_arch/plugin.rb b/plugins/guest_arch/plugin.rb new file mode 100644 index 000000000..864463f65 --- /dev/null +++ b/plugins/guest_arch/plugin.rb @@ -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 diff --git a/lib/vagrant/guest/debian.rb b/plugins/guest_debian/guest.rb similarity index 96% rename from lib/vagrant/guest/debian.rb rename to plugins/guest_debian/guest.rb index 7b11c3dca..d43e50c25 100644 --- a/lib/vagrant/guest/debian.rb +++ b/plugins/guest_debian/guest.rb @@ -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 diff --git a/plugins/guest_debian/plugin.rb b/plugins/guest_debian/plugin.rb new file mode 100644 index 000000000..c4124e00e --- /dev/null +++ b/plugins/guest_debian/plugin.rb @@ -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 diff --git a/lib/vagrant/guest/fedora.rb b/plugins/guest_fedora/guest.rb similarity index 96% rename from lib/vagrant/guest/fedora.rb rename to plugins/guest_fedora/guest.rb index de02377c5..adbaa5a3e 100644 --- a/lib/vagrant/guest/fedora.rb +++ b/plugins/guest_fedora/guest.rb @@ -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 diff --git a/plugins/guest_fedora/plugin.rb b/plugins/guest_fedora/plugin.rb new file mode 100644 index 000000000..1d55b2db5 --- /dev/null +++ b/plugins/guest_fedora/plugin.rb @@ -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 diff --git a/lib/vagrant/guest/gentoo.rb b/plugins/guest_gentoo/guest.rb similarity index 95% rename from lib/vagrant/guest/gentoo.rb rename to plugins/guest_gentoo/guest.rb index 58ca3a7d1..a74391d18 100644 --- a/lib/vagrant/guest/gentoo.rb +++ b/plugins/guest_gentoo/guest.rb @@ -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 diff --git a/plugins/guest_gentoo/plugin.rb b/plugins/guest_gentoo/plugin.rb new file mode 100644 index 000000000..2796b1d71 --- /dev/null +++ b/plugins/guest_gentoo/plugin.rb @@ -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 diff --git a/plugins/guest_linux/guest.rb b/plugins/guest_linux/guest.rb index 53d5251ad..23ab0f746 100644 --- a/plugins/guest_linux/guest.rb +++ b/plugins/guest_linux/guest.rb @@ -1,7 +1,5 @@ require 'log4r' -require 'vagrant/guest/linux/error' - module VagrantPlugins module GuestLinux class Guest < Vagrant::Guest::Base diff --git a/lib/vagrant/guest/openbsd.rb b/plugins/guest_openbsd/guest.rb similarity index 81% rename from lib/vagrant/guest/openbsd.rb rename to plugins/guest_openbsd/guest.rb index a673ecf2a..42de5d6d1 100644 --- a/lib/vagrant/guest/openbsd.rb +++ b/plugins/guest_openbsd/guest.rb @@ -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") diff --git a/plugins/guest_openbsd/plugin.rb b/plugins/guest_openbsd/plugin.rb new file mode 100644 index 000000000..7f9f1f430 --- /dev/null +++ b/plugins/guest_openbsd/plugin.rb @@ -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 diff --git a/lib/vagrant/guest/redhat.rb b/plugins/guest_redhat/guest.rb similarity index 96% rename from lib/vagrant/guest/redhat.rb rename to plugins/guest_redhat/guest.rb index d2b2b6d30..681fe4f47 100644 --- a/lib/vagrant/guest/redhat.rb +++ b/plugins/guest_redhat/guest.rb @@ -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 diff --git a/plugins/guest_redhat/plugin.rb b/plugins/guest_redhat/plugin.rb new file mode 100644 index 000000000..fd88a2504 --- /dev/null +++ b/plugins/guest_redhat/plugin.rb @@ -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 diff --git a/plugins/guest_suse/guest.rb b/plugins/guest_suse/guest.rb new file mode 100644 index 000000000..bba0c7ec0 --- /dev/null +++ b/plugins/guest_suse/guest.rb @@ -0,0 +1,9 @@ +module VagrantPlugins + module GuestSuse + class Guest < VagrantPlugins::GuestRedHat::Guest + def network_scripts_dir + '/etc/sysconfig/network/' + end + end + end +end diff --git a/plugins/guest_suse/plugin.rb b/plugins/guest_suse/plugin.rb new file mode 100644 index 000000000..e692b0e29 --- /dev/null +++ b/plugins/guest_suse/plugin.rb @@ -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 diff --git a/lib/vagrant/guest/ubuntu.rb b/plugins/guest_ubuntu/guest.rb similarity index 87% rename from lib/vagrant/guest/ubuntu.rb rename to plugins/guest_ubuntu/guest.rb index 37814fcdf..8e30ba8b4 100644 --- a/lib/vagrant/guest/ubuntu.rb +++ b/plugins/guest_ubuntu/guest.rb @@ -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 diff --git a/plugins/guest_ubuntu/plugin.rb b/plugins/guest_ubuntu/plugin.rb new file mode 100644 index 000000000..2cd361b90 --- /dev/null +++ b/plugins/guest_ubuntu/plugin.rb @@ -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 diff --git a/test/unit/vagrant_test.rb b/test/unit/vagrant_test.rb index 7fb572a39..f69f2e8ba 100644 --- a/test/unit/vagrant_test.rb +++ b/test/unit/vagrant_test.rb @@ -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