From 1fcca71ce9d23f974d9d349d26d0fde7dc969e57 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 15 Dec 2011 21:05:19 -0800 Subject: [PATCH] Re-namespace all systems to the Vagrant::Guest module --- lib/vagrant.rb | 26 +++++++++---------- lib/vagrant/guest.rb | 16 ++++++++++++ lib/vagrant/{systems => guest}/arch.rb | 2 +- lib/vagrant/{systems => guest}/base.rb | 2 +- lib/vagrant/{systems => guest}/debian.rb | 2 +- lib/vagrant/{systems => guest}/freebsd.rb | 2 +- lib/vagrant/{systems => guest}/gentoo.rb | 2 +- lib/vagrant/{systems => guest}/linux.rb | 6 ++--- .../{systems => guest}/linux/config.rb | 4 +-- lib/vagrant/{systems => guest}/linux/error.rb | 4 +-- lib/vagrant/{systems => guest}/redhat.rb | 2 +- lib/vagrant/{systems => guest}/solaris.rb | 2 +- lib/vagrant/{systems => guest}/suse.rb | 4 +-- lib/vagrant/{systems => guest}/ubuntu.rb | 4 +-- lib/vagrant/systems.rb | 13 ---------- 15 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 lib/vagrant/guest.rb rename lib/vagrant/{systems => guest}/arch.rb (98%) rename lib/vagrant/{systems => guest}/base.rb (99%) rename lib/vagrant/{systems => guest}/debian.rb (98%) rename lib/vagrant/{systems => guest}/freebsd.rb (99%) rename lib/vagrant/{systems => guest}/gentoo.rb (98%) rename lib/vagrant/{systems => guest}/linux.rb (96%) rename lib/vagrant/{systems => guest}/linux/config.rb (90%) rename lib/vagrant/{systems => guest}/linux/error.rb (70%) rename lib/vagrant/{systems => guest}/redhat.rb (99%) rename lib/vagrant/{systems => guest}/solaris.rb (99%) rename lib/vagrant/{systems => guest}/suse.rb (81%) rename lib/vagrant/{systems => guest}/ubuntu.rb (90%) delete mode 100644 lib/vagrant/systems.rb diff --git a/lib/vagrant.rb b/lib/vagrant.rb index 376f8900f..bcce7b6bb 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -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! diff --git a/lib/vagrant/guest.rb b/lib/vagrant/guest.rb new file mode 100644 index 000000000..96339ab0c --- /dev/null +++ b/lib/vagrant/guest.rb @@ -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 diff --git a/lib/vagrant/systems/arch.rb b/lib/vagrant/guest/arch.rb similarity index 98% rename from lib/vagrant/systems/arch.rb rename to lib/vagrant/guest/arch.rb index 720f31f7a..962521e06 100644 --- a/lib/vagrant/systems/arch.rb +++ b/lib/vagrant/guest/arch.rb @@ -1,5 +1,5 @@ module Vagrant - module Systems + module Guest class Arch < Linux def change_host_name(name) vm.ssh.execute do |ssh| diff --git a/lib/vagrant/systems/base.rb b/lib/vagrant/guest/base.rb similarity index 99% rename from lib/vagrant/systems/base.rb rename to lib/vagrant/guest/base.rb index 1e0729df1..72861b085 100644 --- a/lib/vagrant/systems/base.rb +++ b/lib/vagrant/guest/base.rb @@ -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 diff --git a/lib/vagrant/systems/debian.rb b/lib/vagrant/guest/debian.rb similarity index 98% rename from lib/vagrant/systems/debian.rb rename to lib/vagrant/guest/debian.rb index 19422a6eb..b29c97ffc 100644 --- a/lib/vagrant/systems/debian.rb +++ b/lib/vagrant/guest/debian.rb @@ -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 diff --git a/lib/vagrant/systems/freebsd.rb b/lib/vagrant/guest/freebsd.rb similarity index 99% rename from lib/vagrant/systems/freebsd.rb rename to lib/vagrant/guest/freebsd.rb index 2944bc094..208a2f96a 100644 --- a/lib/vagrant/systems/freebsd.rb +++ b/lib/vagrant/guest/freebsd.rb @@ -1,5 +1,5 @@ module Vagrant - module Systems + module Guest # A general Vagrant system implementation for "freebsd". # # Contributed by Kenneth Vestergaard diff --git a/lib/vagrant/systems/gentoo.rb b/lib/vagrant/guest/gentoo.rb similarity index 98% rename from lib/vagrant/systems/gentoo.rb rename to lib/vagrant/guest/gentoo.rb index d557d70d5..cf5590cc6 100644 --- a/lib/vagrant/systems/gentoo.rb +++ b/lib/vagrant/guest/gentoo.rb @@ -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 diff --git a/lib/vagrant/systems/linux.rb b/lib/vagrant/guest/linux.rb similarity index 96% rename from lib/vagrant/systems/linux.rb rename to lib/vagrant/guest/linux.rb index 1992fc6fc..7c370008f 100644 --- a/lib/vagrant/systems/linux.rb +++ b/lib/vagrant/guest/linux.rb @@ -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| diff --git a/lib/vagrant/systems/linux/config.rb b/lib/vagrant/guest/linux/config.rb similarity index 90% rename from lib/vagrant/systems/linux/config.rb rename to lib/vagrant/guest/linux/config.rb index 76e029199..1e80c522d 100644 --- a/lib/vagrant/systems/linux/config.rb +++ b/lib/vagrant/guest/linux/config.rb @@ -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 diff --git a/lib/vagrant/systems/linux/error.rb b/lib/vagrant/guest/linux/error.rb similarity index 70% rename from lib/vagrant/systems/linux/error.rb rename to lib/vagrant/guest/linux/error.rb index b1f033b25..d9088cf1e 100644 --- a/lib/vagrant/systems/linux/error.rb +++ b/lib/vagrant/guest/linux/error.rb @@ -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 diff --git a/lib/vagrant/systems/redhat.rb b/lib/vagrant/guest/redhat.rb similarity index 99% rename from lib/vagrant/systems/redhat.rb rename to lib/vagrant/guest/redhat.rb index 15a1f6cb8..14a4557cb 100644 --- a/lib/vagrant/systems/redhat.rb +++ b/lib/vagrant/guest/redhat.rb @@ -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 diff --git a/lib/vagrant/systems/solaris.rb b/lib/vagrant/guest/solaris.rb similarity index 99% rename from lib/vagrant/systems/solaris.rb rename to lib/vagrant/guest/solaris.rb index 86936fb0d..9d0fddd7a 100644 --- a/lib/vagrant/systems/solaris.rb +++ b/lib/vagrant/guest/solaris.rb @@ -1,5 +1,5 @@ module Vagrant - module Systems + module Guest # A general Vagrant system implementation for "solaris". # # Contributed by Blake Irvin diff --git a/lib/vagrant/systems/suse.rb b/lib/vagrant/guest/suse.rb similarity index 81% rename from lib/vagrant/systems/suse.rb rename to lib/vagrant/guest/suse.rb index 411338e81..113b2df71 100644 --- a/lib/vagrant/systems/suse.rb +++ b/lib/vagrant/guest/suse.rb @@ -1,9 +1,9 @@ module Vagrant - module Systems + module Guest class Suse < Redhat def network_scripts_dir '/etc/sysconfig/network/' - end + end end end end diff --git a/lib/vagrant/systems/ubuntu.rb b/lib/vagrant/guest/ubuntu.rb similarity index 90% rename from lib/vagrant/systems/ubuntu.rb rename to lib/vagrant/guest/ubuntu.rb index 2aaad4814..677eec9e3 100644 --- a/lib/vagrant/systems/ubuntu.rb +++ b/lib/vagrant/guest/ubuntu.rb @@ -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| diff --git a/lib/vagrant/systems.rb b/lib/vagrant/systems.rb deleted file mode 100644 index feca7a12e..000000000 --- a/lib/vagrant/systems.rb +++ /dev/null @@ -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'