Skip to content

Commit

Permalink
Clean print
Browse files Browse the repository at this point in the history
  • Loading branch information
Grégory Marcilhacy committed Jul 12, 2011
1 parent 9d385a7 commit f8bed39
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/bump.rb
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -70,6 +70,10 @@ def find_next_version(current_version)
end
end

def display_message(message)
print(message); puts;
end

end

end

0 comments on commit f8bed39

Please sign in to comment.