Module: Printer

Defined in:
lib/printer.rb

Instance Method Summary collapse

Instance Method Details

#github_issue_info(story) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/printer.rb', line 41

def github_issue_info story
  line = ""
  story['linked_issues'].each do |issue|
    line += ":ISSUE##{issue['number']}"
    line +=":Milestone #{issue['milestone']['title']}" if issue['milestone']
  end
  line
end

#github_pr_info(story) ⇒ Object



35
36
37
38
39
# File 'lib/printer.rb', line 35

def github_pr_info story
  line = ":#{story['number']}:#{story['title']}"
  line += github_issue_info story if story['linked_issues']
  line
end

#include_dependencies(dependencies) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/printer.rb', line 50

def include_dependencies dependencies
    release_notes = title "Dependencies"
    dependencies.each do |dependency|
      release_notes += dependency
      release_notes += "\n"
    end
    release_notes
end

#planbox_info(story) ⇒ Object



31
32
33
# File 'lib/printer.rb', line 31

def planbox_info story
  "#{story['id']}:#{story['status']}:#{story['name']}:#{story['project_name']}:#{story['project_alias']}"
end


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/printer.rb', line 2

def print stories
  end_of_pbs = false
  release_notes = "ID:STATUS:TITLE:PROJECT_NAME:PROJECT_ALIAS:PR:TITLE\n"
  dependencies = []
  stories.each do |story|
    if !end_of_pbs and story['name'].nil?
      end_of_pbs = true
      release_notes += title "Unmatched PRs"
      release_notes += "PR:TITLE\n"
    end

    dependency = pull_dependency(story)
    dependencies << dependency unless dependency.nil?

    line = ""
    line += planbox_info story unless end_of_pbs
    line += github_pr_info story unless story['number'].nil?

    release_notes += line + "\n"
  end

  # print dependency blocks
  unless dependencies.empty?
    release_notes += include_dependencies dependencies
  end

  puts release_notes
end

#title(text) ⇒ Object



59
60
61
# File 'lib/printer.rb', line 59

def title text
  "\n---- #{text} ----\n\n"
end