Skip to content

Commit

Permalink
Added a small message at the end of the list method to show the numbe…
Browse files Browse the repository at this point in the history
…r of repositories listed.
  • Loading branch information
Ryan Bigg authored and lachlanhardy committed Oct 9, 2008
1 parent f327b46 commit 354328b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/gitjour/application.rb
Expand Up @@ -42,6 +42,7 @@ def run(*args)
private

def service_list_display(service_list, *rest)
@total_services = 0
lines = []
service_list.inject({}) do |service_by_repository, service|
service_by_repository[service.repository] ||= []
Expand All @@ -52,6 +53,7 @@ def service_list_display(service_list, *rest)
end.each do |(repository, services)|
local_services = services.select { |s| s.host == Socket.gethostname + "." }
services -= local_services unless rest.include?("--local")
@total_services += services.size
lines << "=== #{repository} #{services.length > 1 ? "(#{services.length} copies)" : ""}" if services.size >= 1
services.sort_by {|s| s.host}.each do |service|
lines << "\t#{service.name} #{service.url}"
Expand All @@ -62,6 +64,7 @@ def service_list_display(service_list, *rest)

def list(*rest)
puts service_list_display(service_list, *rest)
puts "#{@total_services} repositories shown."
end

def serve(path=Dir.pwd, *rest)
Expand Down
2 changes: 1 addition & 1 deletion lib/gitjour/version.rb
Expand Up @@ -2,7 +2,7 @@ module Gitjour #:nodoc:
module VERSION #:nodoc:
MAJOR = 8
MINOR = 0
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end
end

0 comments on commit 354328b

Please sign in to comment.