class Fiesta::Report
Public Instance Methods
announce(config = {})
click to toggle source
# File lib/fiesta/report.rb, line 20 def announce(config = {}) return Logger.warn("Announcement blank, nothing posted to Slack") if nothing_to_announce? Announcement.new(text, config).post end
create_release(name = nil, revision: nil)
click to toggle source
# File lib/fiesta/report.rb, line 25 def create_release(name = nil, revision: nil) return Logger.warn "No new stories, skipping GitHub release" if stories.none? Release.new(repo: repo, name: name, stories: stories, revision: revision).post end
stories()
click to toggle source
# File lib/fiesta/report.rb, line 31 def stories @_stories ||= fetch_stories end
Private Instance Methods
default_branch()
click to toggle source
# File lib/fiesta/report.rb, line 80 def default_branch github.repo(repo).default_branch end
editor()
click to toggle source
# File lib/fiesta/report.rb, line 61 def editor Editor.new(template, comment: comment) end
fetch_stories()
click to toggle source
# File lib/fiesta/report.rb, line 37 def fetch_stories if auto_compose? merged_pull_requests.map { |pr| AutoComposedStory.new(pr) } else merged_pull_requests.map { |pr| Story.new(pr) } end end
github()
click to toggle source
# File lib/fiesta/report.rb, line 90 def github @_github ||= Github.client end
last_released_at()
click to toggle source
# File lib/fiesta/report.rb, line 84 def last_released_at if @last_released_at TimestampNormalizer.new(@last_released_at).run.iso8601 end end
merged_pull_requests()
click to toggle source
# File lib/fiesta/report.rb, line 73 def merged_pull_requests github.search_issues("base:#{default_branch} repo:#{repo} merged:>#{last_released_at}").items rescue Octokit::UnprocessableEntity => e Logger.warn "Unable to access GitHub. Message given was: #{e.message}" [] end
nothing_to_announce?()
click to toggle source
# File lib/fiesta/report.rb, line 45 def nothing_to_announce? stories.none? || text.nil? || text.empty? end
render_text()
click to toggle source
# File lib/fiesta/report.rb, line 53 def render_text if auto_compose? template else editor.compose end end
stories_with_release_notes()
click to toggle source
# File lib/fiesta/report.rb, line 69 def stories_with_release_notes stories.find_all(&:release_note) end
template()
click to toggle source
# File lib/fiesta/report.rb, line 65 def template Template.new(stories_with_release_notes).render end
text()
click to toggle source
# File lib/fiesta/report.rb, line 49 def text @_text ||= render_text end