Class: Geet::Services::ListMilestones

Inherits:
Object
  • Object
show all
Defined in:
lib/geet/services/list_milestones.rb

Instance Method Summary collapse

Constructor Details

#initialize(repository, out: $stdout) ⇒ ListMilestones

Returns a new instance of ListMilestones.



6
7
8
9
# File 'lib/geet/services/list_milestones.rb', line 6

def initialize(repository, out: $stdout)
  @repository = repository
  @out = out
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/geet/services/list_milestones.rb', line 11

def execute
  milestones = find_milestones
  all_milestone_entries = find_all_milestone_entries(milestones)

  @out.puts

  all_milestone_entries.each do |milestone, milestone_entries|
    @out.puts milestone_description(milestone)

    milestone_entries.fetch(:issues).each do |issue|
      @out.puts "  #{issue.number}. #{issue.title} (#{issue.link})"
    end

    milestone_entries.fetch(:prs).each do |pr|
      @out.puts "  #{pr.number}. #{pr.title} (#{pr.link})"
    end
  end

  all_milestone_entries.keys
end