class Repo
Attributes
directory[RW]
Public Class Methods
new(directory)
click to toggle source
# File lib/repos_report/repo.rb, line 6 def initialize(directory) @directory = directory end
Public Instance Methods
concise_status(whitespace_padding)
click to toggle source
# File lib/repos_report/repo.rb, line 14 def concise_status(whitespace_padding) set_git_variables # Not needed unless this method is run if issues.any? message_with_issues(whitespace_padding).red else message_with_no_issues(whitespace_padding).green end end
project_name_length()
click to toggle source
# File lib/repos_report/repo.rb, line 10 def project_name_length project_name.length end
Private Instance Methods
issues()
click to toggle source
# File lib/repos_report/repo.rb, line 46 def issues issue_array = [] issue_array << 'UNPUSHED COMMITS' if @origin_master_output.include? 'ahead' issue_array << 'UNPULLED COMMITS' if @origin_master_output.include? 'behind' issue_array << 'NO REMOTE ORIGIN' unless @git_remote_output.include? 'origin' issue_array << 'UNCOMMITTED CHANGES' if @git_status_output =~ uncommitted_changes_regex issue_array end
message_with_issues(whitespace_padding)
click to toggle source
# File lib/repos_report/repo.rb, line 38 def message_with_issues(whitespace_padding) project_name.ljust(whitespace_padding) + issues.join(', ') end
message_with_no_issues(whitespace_padding)
click to toggle source
# File lib/repos_report/repo.rb, line 42 def message_with_no_issues(whitespace_padding) project_name.ljust(whitespace_padding) + 'ALL GOOD' end
project_name()
click to toggle source
# File lib/repos_report/repo.rb, line 28 def project_name @directory.split("/").last end
set_git_variables()
click to toggle source
# File lib/repos_report/repo.rb, line 32 def set_git_variables @origin_master_output ||= `cd #{@directory}; git for-each-ref --format="%(upstream:track) %(upstream:short)" | grep origin/master` @git_remote_output ||= `cd #{@directory}; git remote` @git_status_output ||= `cd #{@directory}; git status` end
uncommitted_changes_regex()
click to toggle source
# File lib/repos_report/repo.rb, line 55 def uncommitted_changes_regex /(Changes not staged for commit)|(Changes to be committed)|(Untracked files)/ end