From 398e254c398f03be526797c1a91cbceaf2fbecdd Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 20 May 2010 16:09:00 -0700 Subject: [PATCH] Moved error_and_exit and wrap_output to their own mixins --- lib/vagrant/util/error_helper.rb | 15 +++++++++++++++ lib/vagrant/util/output_helper.rb | 11 +++++++++++ test/vagrant/util/error_helper_test.rb | 5 +++++ test/vagrant/util/output_helper_test.rb | 5 +++++ 4 files changed, 36 insertions(+) create mode 100644 lib/vagrant/util/error_helper.rb create mode 100644 lib/vagrant/util/output_helper.rb create mode 100644 test/vagrant/util/error_helper_test.rb create mode 100644 test/vagrant/util/output_helper_test.rb diff --git a/lib/vagrant/util/error_helper.rb b/lib/vagrant/util/error_helper.rb new file mode 100644 index 000000000..235217611 --- /dev/null +++ b/lib/vagrant/util/error_helper.rb @@ -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 diff --git a/lib/vagrant/util/output_helper.rb b/lib/vagrant/util/output_helper.rb new file mode 100644 index 000000000..ffdca3678 --- /dev/null +++ b/lib/vagrant/util/output_helper.rb @@ -0,0 +1,11 @@ +module Vagrant + module Util + module OutputHelper + def wrap_output + puts "=====================================================================" + yield + puts "=====================================================================" + end + end + end +end diff --git a/test/vagrant/util/error_helper_test.rb b/test/vagrant/util/error_helper_test.rb new file mode 100644 index 000000000..7b8fc525a --- /dev/null +++ b/test/vagrant/util/error_helper_test.rb @@ -0,0 +1,5 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class ErrorHelperUtilTest < Test::Unit::TestCase + # TODO +end diff --git a/test/vagrant/util/output_helper_test.rb b/test/vagrant/util/output_helper_test.rb new file mode 100644 index 000000000..06f6ee9dc --- /dev/null +++ b/test/vagrant/util/output_helper_test.rb @@ -0,0 +1,5 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class OutputHelperUtilTest < Test::Unit::TestCase + # TODO +end