From 004ba551a6be6c9dae0dc37ddd4b778685e7b984 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 24 Aug 2010 11:18:29 -0700 Subject: [PATCH] Moved errors out into its own file so that vagrant.rb doesn't get too cluttered --- lib/vagrant.rb | 22 ++++++---------------- lib/vagrant/errors.rb | 10 ++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 lib/vagrant/errors.rb diff --git a/lib/vagrant.rb b/lib/vagrant.rb index ba874012b..f7cd8ce71 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -1,6 +1,7 @@ require 'json' require 'virtualbox' -require "vagrant/util/glob_loader" +require 'vagrant/errors' +require 'vagrant/util/glob_loader' module Vagrant # TODO: Move more classes over to the autoload model. We'll @@ -13,22 +14,11 @@ module Vagrant autoload :GroupBase, 'vagrant/command/group_base' end - class << self - # The source root is the path to the root directory of - # the Vagrant gem. - def source_root - @source_root ||= File.expand_path('../../', __FILE__) - end + # The source root is the path to the root directory of + # the Vagrant gem. + def self.source_root + @source_root ||= File.expand_path('../../', __FILE__) end - - class VagrantError < StandardError - def self.status_code(code = nil) - define_method(:status_code) { code } - end - end - - class CLIMissingEnvironment < VagrantError; status_code(1); end - class BoxNotFound < VagrantError; status_code(2); end end # Load them up. One day we'll convert this to autoloads. Today diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb new file mode 100644 index 000000000..56663c0aa --- /dev/null +++ b/lib/vagrant/errors.rb @@ -0,0 +1,10 @@ +module Vagrant + class VagrantError < StandardError + def self.status_code(code = nil) + define_method(:status_code) { code } + end + end + + class CLIMissingEnvironment < VagrantError; status_code(1); end + class BoxNotFound < VagrantError; status_code(2); end +end