Moved errors out into its own file so that vagrant.rb doesn't get too cluttered
This commit is contained in:
parent
cc2dcf4d8f
commit
004ba551a6
|
@ -1,6 +1,7 @@
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'virtualbox'
|
require 'virtualbox'
|
||||||
require "vagrant/util/glob_loader"
|
require 'vagrant/errors'
|
||||||
|
require 'vagrant/util/glob_loader'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
# TODO: Move more classes over to the autoload model. We'll
|
# TODO: Move more classes over to the autoload model. We'll
|
||||||
|
@ -13,24 +14,13 @@ module Vagrant
|
||||||
autoload :GroupBase, 'vagrant/command/group_base'
|
autoload :GroupBase, 'vagrant/command/group_base'
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
|
||||||
# The source root is the path to the root directory of
|
# The source root is the path to the root directory of
|
||||||
# the Vagrant gem.
|
# the Vagrant gem.
|
||||||
def source_root
|
def self.source_root
|
||||||
@source_root ||= File.expand_path('../../', __FILE__)
|
@source_root ||= File.expand_path('../../', __FILE__)
|
||||||
end
|
end
|
||||||
end
|
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
|
# 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.
|
# is not that day. Low hanging fruit for anyone wishing to do it.
|
||||||
libdir = File.expand_path("lib/vagrant", Vagrant.source_root)
|
libdir = File.expand_path("lib/vagrant", Vagrant.source_root)
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue