From f8bed390c30ac23e5e40e0d92596acf490f36ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Marcilhacy?= Date: Tue, 12 Jul 2011 11:54:28 +0200 Subject: [PATCH] Clean print --- lib/bump.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/bump.rb b/lib/bump.rb index 8554b46..b90ad36 100644 --- a/lib/bump.rb +++ b/lib/bump.rb @@ -17,9 +17,9 @@ def initialize(bump) @bump = bump rescue InvalidBumpError - print "Invalid bump. Choose between #{BUMPS.join(',')}." + display_message "Invalid bump. Choose between #{BUMPS.join(',')}." rescue Exception - print "Something wrong happened" + display_message "Something wrong happened" end end @@ -29,14 +29,14 @@ def run current_version = find_current_version(gemspec) next_version = find_next_version(current_version) system(%(ruby -i -pe "gsub(/#{current_version}/, '#{next_version}')" #{gemspec})) - print "Bump version #{current_version} to #{next_version}" + display_message "Bump version #{current_version} to #{next_version}" rescue UnfoundVersionError - print "Unable to find your gem version" + display_message "Unable to find your gem version" rescue UnfoundGemspecError - print "Unable to find gemspec file" + display_message "Unable to find gemspec file" rescue TooManyGemspecsFoundError - print "More than one gemspec file" + display_message "More than one gemspec file" end end @@ -70,6 +70,10 @@ def find_next_version(current_version) end end + def display_message(message) + print(message); puts; + end + end end