Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't display "requested by" if no one requested it before. Closes #20

  • Loading branch information...
commit 7f361729c868eb903a70365f3111886639454062 1 parent 2ce50a8
@defunkt defunkt authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/rip/package_manager.rb
View
12 lib/rip/package_manager.rb
@@ -14,17 +14,23 @@ def initialize(name, bad_version, requester, real_version, owners)
def message
message = []
message << "version conflict!"
- message << "#{@name} requested at #{@bad_version} by #{@requester}"
+
+ requested = "#{@name} requested at #{@bad_version}"
+ requested += " by #{@requester}" if @requester
+ message << requested
if @owners.size == 1
owners = @owners[0]
elsif @owners.size == 2
owners = "#{@owners[0]} and #{@owners[1]}"
- else
+ elsif @owners.size > 2
owners = [ @owners[0...-1], "and #{@owners[-1]}" ].join(', ')
end
- message << "#{@name} previously requested at #{@real_version} by #{owners}"
+ previously_requested = "#{@name} previously requested at #{@real_version}"
+ previously_requested += " by #{owners}" if owners
+ message << previously_requested
+
message.join("\n")
end
alias_method :to_s, :message
Please sign in to comment.
Something went wrong with that request. Please try again.