Module: Octonaut::Printers::Repositories
- Included in:
- Octonaut::Printer
- Defined in:
- lib/octonaut/printers/repositories.rb
Constant Summary collapse
- REPOSITORY_FIELDS =
{ "id" => "ID", "name" => "NAME", "full_name" => "FULL NAME", "description" => "DESCRIPTION", "default_branch" => "DEFAULT BRANCH", "homepage" => "HOMEPAGE", "language" => "PRIMARY LANGUAGE", "open_issues" => "OPEN ISSUES", "fork" => "FORK", "forks_count" => "FORKS", "watchers" => "STARS", "private" => "PRIVATE", "has_downloads" => "DOWNLOADS ENABLED", "has_issues" => "ISSUES ENABLED", "has_wiki" => "WIKI ENABLED", "created_at" => "CREATED", "pushed_at" => "LAST PUSH", "updated_at" => "UPDATED" }
Instance Method Summary collapse
- #ls_repos(repos, options = {}) ⇒ Object
- #print_csv_repos(repos, options = {}) ⇒ Object
- #print_repo_table(repo, options = {}) ⇒ Object
- #print_repos(repos, options = {}) ⇒ Object
Instance Method Details
#ls_repos(repos, options = {}) ⇒ Object
44 45 46 |
# File 'lib/octonaut/printers/repositories.rb', line 44 def ls_repos(repos, = {}) repos.each {|r| puts r.full_name } end |
#print_csv_repos(repos, options = {}) ⇒ Object
39 40 41 42 |
# File 'lib/octonaut/printers/repositories.rb', line 39 def print_csv_repos(repos, = {}) [:fields] = REPOSITORY_FIELDS print_csv repos, end |
#print_repo_table(repo, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/octonaut/printers/repositories.rb', line 26 def print_repo_table(repo, = {}) data = {} REPOSITORY_FIELDS.each do |field, heading| data[heading] = repo[field] end print_table(data) end |
#print_repos(repos, options = {}) ⇒ Object
35 36 37 |
# File 'lib/octonaut/printers/repositories.rb', line 35 def print_repos(repos, = {}) [:csv] ? print_csv_repos(repos) : ls_repos(repos) end |