Re-namespace all systems to the Vagrant::Guest module

This commit is contained in:
Mitchell Hashimoto 2011-12-15 21:05:19 -08:00
parent bfc8794d95
commit 1fcca71ce9
15 changed files with 47 additions and 44 deletions

View File

@ -28,6 +28,7 @@ module Vagrant
autoload :Downloaders, 'vagrant/downloaders'
autoload :Environment, 'vagrant/environment'
autoload :Errors, 'vagrant/errors'
autoload :Guest, 'vagrant/guest'
autoload :Hosts, 'vagrant/hosts'
autoload :Plugin, 'vagrant/plugin'
autoload :Provisioners, 'vagrant/provisioners'
@ -98,15 +99,15 @@ Vagrant.hosts.register(:linux) { Vagrant::Hosts::Linux }
Vagrant.hosts.register(:bsd) { Vagrant::Hosts::BSD }
# Register the built-in guests
Vagrant.guests.register(:arch) { Vagrant::Systems::Arch }
Vagrant.guests.register(:debian) { Vagrant::Systems::Debian }
Vagrant.guests.register(:freebsd) { Vagrant::Systems::FreeBSD }
Vagrant.guests.register(:gentoo) { Vagrant::Systems::Gentoo }
Vagrant.guests.register(:linux) { Vagrant::Systems::Linux }
Vagrant.guests.register(:redhat) { Vagrant::Systems::Redhat }
Vagrant.guests.register(:solaris) { Vagrant::Systems::Solaris }
Vagrant.guests.register(:suse) { Vagrant::Systems::Suse }
Vagrant.guests.register(:ubuntu) { Vagrant::Systems::Ubuntu }
Vagrant.guests.register(:arch) { Vagrant::Guest::Arch }
Vagrant.guests.register(:debian) { Vagrant::Guest::Debian }
Vagrant.guests.register(:freebsd) { Vagrant::Guest::FreeBSD }
Vagrant.guests.register(:gentoo) { Vagrant::Guest::Gentoo }
Vagrant.guests.register(:linux) { Vagrant::Guest::Linux }
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 }
@ -116,12 +117,11 @@ Vagrant.provisioners.register(:puppet_server) { Vagrant::Provisioners::PuppetSer
Vagrant.provisioners.register(:shell) { Vagrant::Provisioners::Shell }
# Register the built-in systems
Vagrant.config_keys.register(:freebsd) { Vagrant::Provisioners::FreeBSD::FreeBSDConfig }
Vagrant.config_keys.register(:linux) { Vagrant::Provisioners::Linux::LinuxConfig }
Vagrant.config_keys.register(:solaris) { Vagrant::Provisioners::Solaris::SolarisConfig }
Vagrant.config_keys.register(:freebsd) { Vagrant::Guest::FreeBSD::FreeBSDConfig }
Vagrant.config_keys.register(:linux) { Vagrant::Guest::Linux::LinuxConfig }
Vagrant.config_keys.register(:solaris) { Vagrant::Guest::Solaris::SolarisConfig }
# Load the things which must be loaded before anything else.
require 'vagrant/command'
require 'vagrant/systems'
require 'vagrant/version'
Vagrant::Plugin.load!

16
lib/vagrant/guest.rb Normal file
View File

@ -0,0 +1,16 @@
module Vagrant
module Guest
autoload :Base, 'vagrant/guest/base'
# Specific guests
autoload :Arch, 'vagrant/guest/arch'
autoload :Debian, 'vagrant/guest/debian'
autoload :FreeBSD, 'vagrant/guest/freebsd'
autoload :Gentoo, 'vagrant/guest/gentoo'
autoload :Linux, 'vagrant/guest/linux'
autoload :RedHat, 'vagrant/guest/redhat'
autoload :Solaris, 'vagrant/guest/solaris'
autoload :Suse, 'vagrant/guest/suse'
autoload :Ubuntu, 'vagrant/guest/ubuntu'
end
end

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
class Arch < Linux
def change_host_name(name)
vm.ssh.execute do |ssh|

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
# The base class for a "system." A system represents an installed
# operating system on a given box. There are some portions of
# Vagrant which are fairly OS-specific (such as mounting shared

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
class Debian < Linux
def prepare_host_only_network(net_options=nil)
# Remove any previous host only network additions to the

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
# A general Vagrant system implementation for "freebsd".
#
# Contributed by Kenneth Vestergaard <kvs@binarysolutions.dk>

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
class Gentoo < Linux
def prepare_host_only_network(net_options=nil)
# Remove any previous host only network additions to the

View File

@ -1,8 +1,8 @@
require 'vagrant/systems/linux/error'
require 'vagrant/systems/linux/config'
require 'vagrant/guest/linux/error'
require 'vagrant/guest/linux/config'
module Vagrant
module Systems
module Guest
class Linux < Base
def distro_dispatch
vm.ssh.execute do |ssh|

View File

@ -1,6 +1,6 @@
module Vagrant
module Systems
class Linux < Vagrant::Systems::Base
module Guest
class Linux < Vagrant::Guest::Base
# A custom config class which will be made accessible via `config.linux`
# This is not necessary for all system implementers, of course. However,
# generally, Vagrant tries to make almost every aspect of its execution

View File

@ -1,6 +1,6 @@
module Vagrant
module Systems
class Linux < Vagrant::Systems::Base
module Guest
class Linux < Vagrant::Guest::Base
class LinuxError < Errors::VagrantError
error_namespace("vagrant.systems.linux")
end

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
class Redhat < Linux
def prepare_host_only_network(net_options)
# Remove any previous host only network additions to the

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
# A general Vagrant system implementation for "solaris".
#
# Contributed by Blake Irvin <b.irvin@modcloth.com>

View File

@ -1,5 +1,5 @@
module Vagrant
module Systems
module Guest
class Suse < Redhat
def network_scripts_dir
'/etc/sysconfig/network/'

View File

@ -1,7 +1,7 @@
require 'vagrant/systems/debian'
require 'vagrant/guest/debian'
module Vagrant
module Systems
module Guest
class Ubuntu < Debian
def change_host_name(name)
vm.ssh.execute do |ssh|

View File

@ -1,13 +0,0 @@
# These can't be autoloaded because they have to register functionality
# with Vagrant core.
require 'vagrant/systems/base'
require 'vagrant/systems/freebsd'
require 'vagrant/systems/linux'
require 'vagrant/systems/solaris'
require 'vagrant/systems/debian'
require 'vagrant/systems/gentoo'
require 'vagrant/systems/redhat'
require 'vagrant/systems/suse'
require 'vagrant/systems/ubuntu'
require 'vagrant/systems/arch'