Class: GemContribute::CLI::Issues

Inherits:
Object
  • Object
show all
Includes:
Workflow
Defined in:
lib/gem_contribute/cli/issues.rb

Overview

‘gem-contribute issues <gem|all>` — list open “good first issue” issues.

With a gem name: lists issues for that gem. With “all”: iterates every github.com gem in Gemfile.lock.

Issue numbers appear prominently so they can be passed directly to ‘fix <gem>/<issue#>`.

Constant Summary collapse

DEFAULT_LABEL =
"good first issue"

Instance Method Summary collapse

Constructor Details

#initialize(stdout: $stdout, stderr: $stderr, output: nil, resolver: Resolver.new, adapter: HostAdapters::GitHubAdapter.new, lockfile_path: "Gemfile.lock") ⇒ Issues

Returns a new instance of Issues.



17
18
19
20
21
22
23
24
25
# File 'lib/gem_contribute/cli/issues.rb', line 17

def initialize(stdout: $stdout, stderr: $stderr, output: nil,
               resolver: Resolver.new,
               adapter: HostAdapters::GitHubAdapter.new,
               lockfile_path: "Gemfile.lock")
  @output = output || Output::Standard.new(out: stdout, err: stderr)
  @resolver = resolver
  @adapter = adapter
  @lockfile_path = lockfile_path
end

Instance Method Details

#run(argv) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/gem_contribute/cli/issues.rb', line 27

def run(argv)
  target = argv.shift
  return print_usage if target.nil?

  @claim_index = IssueAnnouncer.fetch_claim_index(@adapter)
  status = target == "all" ? run_all : run_single(target)
  RateLimitFooter.print(adapter: @adapter, output: @output)
  status
rescue AdapterError => e
  @output.error("gem-contribute: #{e.message}")
  1
end