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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,5 @@
require 'pathname'
module Vagrant
module Provisioners
# 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
# Manages SSH access to a specific environment. Allows an environment to
# replace the process with SSH itself, run a specific set of commands,

View File

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

View File

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

View File

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