mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Moved error_and_exit and wrap_output to their own mixins
This commit is contained in:
parent
a1794dca80
commit
398e254c39
4 changed files with 36 additions and 0 deletions
15
lib/vagrant/util/error_helper.rb
Normal file
15
lib/vagrant/util/error_helper.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module Vagrant
|
||||
module Util
|
||||
module ErrorHelper
|
||||
def error_and_exit(key, data = {})
|
||||
abort <<-error
|
||||
=====================================================================
|
||||
Vagrant experienced an error!
|
||||
|
||||
#{Translator.t(key, data).chomp}
|
||||
=====================================================================
|
||||
error
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
11
lib/vagrant/util/output_helper.rb
Normal file
11
lib/vagrant/util/output_helper.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module Vagrant
|
||||
module Util
|
||||
module OutputHelper
|
||||
def wrap_output
|
||||
puts "====================================================================="
|
||||
yield
|
||||
puts "====================================================================="
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
5
test/vagrant/util/error_helper_test.rb
Normal file
5
test/vagrant/util/error_helper_test.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
||||
|
||||
class ErrorHelperUtilTest < Test::Unit::TestCase
|
||||
# TODO
|
||||
end
|
||||
5
test/vagrant/util/output_helper_test.rb
Normal file
5
test/vagrant/util/output_helper_test.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
||||
|
||||
class OutputHelperUtilTest < Test::Unit::TestCase
|
||||
# TODO
|
||||
end
|
||||
Loading…
Reference in a new issue