Module: Printer
- Defined in:
- lib/printer.rb
Instance Method Summary collapse
- #github_issue_info(story) ⇒ Object
- #github_pr_info(story) ⇒ Object
- #html(stories) ⇒ Object
- #include_dependencies(dependencies) ⇒ Object
- #planbox_info(story) ⇒ Object
- #print(stories) ⇒ Object
- #title(text) ⇒ Object
Instance Method Details
#github_issue_info(story) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/printer.rb', line 52 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
46 47 48 49 50 |
# File 'lib/printer.rb', line 46 def github_pr_info story line = ":#{story['number']}:#{story['title']}" line += github_issue_info story if story['linked_issues'] line end |
#html(stories) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/printer.rb', line 5 def html stories $stories = stories file_path = File.('../../templates/template.html.haml', __FILE__) template = File.read(file_path) engine = Haml::Engine.new(template) File.write 'releasenotes.html',engine.render end |
#include_dependencies(dependencies) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/printer.rb', line 61 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
42 43 44 |
# File 'lib/printer.rb', line 42 def planbox_info story "#{story['id']}:#{story['status']}:#{story['name']}:#{story['project_name']}:#{story['project_alias']}" end |
#print(stories) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/printer.rb', line 13 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
70 71 72 |
# File 'lib/printer.rb', line 70 def title text "\n---- #{text} ----\n\n" end |