Module: Git::Multi::Report
- Defined in:
- lib/git/multi/report.rb
Constant Summary collapse
- TICK =
['2714'.hex].pack('U*').green.freeze
- CROSS =
['2718'.hex].pack('U*').red.freeze
- ARROW =
['2794'.hex].pack('U*').blue.freeze
Class Method Summary collapse
- .for(*multi_repos) ⇒ Object
- .home_status(home) ⇒ Object
- .owner_status(message, workarea, owner) ⇒ Object
- .project_status(message, superproject) ⇒ Object
- .workarea_status(workarea) ⇒ Object
Class Method Details
.for(*multi_repos) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/git/multi/report.rb', line 61 def for(*multi_repos) multi_repos.each do |multi_repo| case (user = org = project = multi_repo) when *USERS owner_status("user \"#{user}\"", Git::Multi::WORKAREA, user) when *ORGANIZATIONS owner_status("org \"#{org}\"", Git::Multi::WORKAREA, org) when *SUPERPROJECTS project_status("superproject \"#{project}\"", project) else raise ArgumentError, multi_repo end end end |
.home_status(home) ⇒ Object
10 11 12 |
# File 'lib/git/multi/report.rb', line 10 def home_status(home) directory_status(['${HOME}', home], home) end |
.owner_status(message, workarea, owner) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/git/multi/report.rb', line 18 def owner_status(, workarea, owner) directory_status( [ , File.join(abbreviate(workarea, :workarea), owner), ], File.join(workarea, owner) ) github_count = Git::Multi.repositories_for(owner).count cloned_count = Git::Multi.cloned_repositories_for(owner).count missing_count = (github_count - cloned_count) subdir_count = Dir.new(workarea).git_repos(owner).count surplus_count = (subdir_count - cloned_count) setting_status(["\tGitHub ", "#{github_count} repositories"]) setting_status(["\tcloned ", cloned_count, "(#{missing_count} missing)"]) Git::Multi.missing_repositories_for(owner).each do |missing| setting_status(["\tmissing", missing.full_name], valid: false, optional: false) end Git::Multi.excluded_repositories_for(owner).each do |excluded| setting_status(["\texcluded", excluded.full_name], valid: false, optional: false) end setting_status(["\tsubdirs", subdir_count, "(#{surplus_count} surplus)"]) end |
.project_status(message, superproject) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/git/multi/report.rb', line 44 def project_status(, superproject) github_count = Git::Multi.repositories_for(superproject).count if github_count.zero? setting_status([, 'listed but not configured'], valid: false, optional: false) else setting_status([], valid: true) Git::Multi.repositories_for(superproject).each do |repo| if File.directory? repo.local_path setting_status(["\tcloned ", repo.full_name], valid: true) else setting_status(["\tmissing", repo.full_name], valid: false, optional: false) end end end end |
.workarea_status(workarea) ⇒ Object
14 15 16 |
# File 'lib/git/multi/report.rb', line 14 def workarea_status(workarea) directory_status(['${WORKAREA}', abbreviate(workarea, :home)], workarea) end |