Class: Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/cli.rb

Instance Method Summary collapse

Instance Method Details

#remain_pull_requestsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cli.rb', line 20

def remain_pull_requests
  repo_list = options.repos || REPOS
  client = connector(options)
  repo_list = client.list_repos(options.user).map(&:full_name) if repo_list.empty? && options.user
  results = ResponCore::PullRequests::RemainRequests.new(repo_list: repo_list, reviewers: options.reviewers, client: client, pr_count: options.pr_count).execute

  system('clear')
  puts ''

  if options.json?
    pp results
  else
    puts ResponCore::Formatters::Cli::PullRequests::RemainRequests.format(results, display_url: options.display_url)
  end
end

#reviews_efficiencyObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cli.rb', line 45

def reviews_efficiency
  repo_list = options.repos || REPOS
  client = connector(options)
  repo_list = client.list_repos(options.user).map(&:full_name) if repo_list.empty? && options.user
  results = ResponCore::PullRequests::ReviewsEfficiency.new(repo_list: repo_list, reviewers: options.reviewers, client: client, pr_count: options.pr_count).execute

  system('clear')
  puts ''

  if options.json?
    pp results
  else
    puts ResponCore::Formatters::Cli::PullRequests::ReviewsEfficiency.format(results, display_url: options.display_url)
  end
end

#shuffle_requests_reviewerObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/cli.rb', line 72

def shuffle_requests_reviewer
  repo_list = options.repos || REPOS
  client = connector(options)
  results = ResponCore::PullRequests::ShuffleRequestReviewer.new(repo_list: repo_list, client: client, pr_count: options.pr_count, pull_requests: options.pull_requests,
                                                                 reviewers: options.reviewers, exclude_reviewers: options.exclude_reviewers, mode: options.mode).execute

  if options.json?
    pp results
  else
    results.each do |record|
      record.each do |repo, result|
        puts "assigne reviewer for #{repo}"
        puts ResponCore::Formatters::Cli::PullRequests::RemainRequests.format(result, display_url: options.display_url)
      end
    end
  end
end