Moved standard library requirements to the files which use them. Cleaned up vagrant.rb quite a bit.

This commit is contained in:
Mitchell Hashimoto 2010-08-23 21:41:40 -07:00
parent cd82c8d7f8
commit 4844d6c12f
12 changed files with 31 additions and 9 deletions

View File

@ -1,8 +1,6 @@
# First, load the various libs which Vagrant requires require 'json'
%w{tempfile json pathname logger virtualbox net/ssh archive/tar/minitar require 'virtualbox'
net/scp fileutils mario}.each do |lib| require "vagrant/util/glob_loader"
require lib
end
module Vagrant module Vagrant
class << self class << self
@ -14,10 +12,8 @@ module Vagrant
end end
end end
# Then load the glob loader, which will handle loading everything else # Load them up. One day we'll convert this to autoloads. Today
require "vagrant/util/glob_loader" # is not that day. Low hanging fruit for anyone wishing to do it.
# Load them up
libdir = File.expand_path("lib/vagrant", Vagrant.source_root) libdir = File.expand_path("lib/vagrant", Vagrant.source_root)
Vagrant::GlobLoader.glob_require(libdir, %w{util util/stacked_proc_runner Vagrant::GlobLoader.glob_require(libdir, %w{util util/stacked_proc_runner
downloaders/base config provisioners/base provisioners/chef systems/base downloaders/base config provisioners/base provisioners/chef systems/base

View File

@ -1,3 +1,5 @@
require 'fileutils'
module Vagrant module Vagrant
class Action class Action
module Box module Box

View File

@ -1,3 +1,6 @@
require 'fileutils'
require 'archive/tar/minitar'
module Vagrant module Vagrant
class Action class Action
module Box module Box

View File

@ -1,3 +1,6 @@
require 'fileutils'
require 'archive/tar/minitar'
module Vagrant module Vagrant
class Action class Action
module General module General

View File

@ -1,3 +1,5 @@
require 'fileutils'
module Vagrant module Vagrant
class Action class Action
module VM module VM

View File

@ -1,3 +1,5 @@
require 'fileutils'
module Vagrant module Vagrant
module Downloaders module Downloaders
# "Downloads" a file to a temporary file. Basically, this downloader # "Downloads" a file to a temporary file. Basically, this downloader

View File

@ -1,3 +1,6 @@
require 'pathname'
require 'fileutils'
module Vagrant module Vagrant
# Represents a single Vagrant environment. This class is responsible # Represents a single Vagrant environment. This class is responsible
# for loading all of the Vagrantfile's for the given environment and # for loading all of the Vagrantfile's for the given environment and

View File

@ -1,3 +1,5 @@
require 'pathname'
module Vagrant module Vagrant
module Provisioners module Provisioners
# This class implements provisioning via chef-client, allowing provisioning # This class implements provisioning via chef-client, allowing provisioning

View File

@ -1,3 +1,7 @@
require 'net/ssh'
require 'net/scp'
require 'mario'
module Vagrant module Vagrant
# Manages SSH access to a specific environment. Allows an environment to # Manages SSH access to a specific environment. Allows an environment to
# replace the process with SSH itself, run a specific set of commands, # replace the process with SSH itself, run a specific set of commands,

View File

@ -1,3 +1,5 @@
require 'logger'
module Vagrant module Vagrant
module Util module Util
# Subclass of the standard library logger which has no format on # Subclass of the standard library logger which has no format on

View File

@ -1,3 +1,5 @@
require 'mario'
module Vagrant module Vagrant
module Util module Util
# This class just contains some platform checking code. # This class just contains some platform checking code.

View File

@ -1,4 +1,5 @@
require 'thread' require 'thread'
require 'mario'
module Vagrant module Vagrant
module Util module Util