Sha256: 7471bcb2685b85a5fa39f9ba8b3faee412232f39833973ac6ca9683df89f0915
Contents?: true
Size: 1.27 KB
Versions: 10
Compression:
Stored size: 1.27 KB
Contents
module CookbookRelease class Changelog DEFAULT_OPTS = { expand_major: true, expand_risky: true, short_sha: true } def initialize(git, opts = {}) @git = git @opts = DEFAULT_OPTS.merge(opts) end def raw changelog.map(&:to_s_oneline) end def html result = [] result << <<-EOH <html> <body> EOH result << changelog.map do |c| full_body ||= @opts[:expand_major] && c.major? full_body ||= @opts[:expand_risky] && c.risky? full_body ||= @opts[:expand_commit] && (c[:subject] =~ @opts[:expand_commit] || c[:body] =~ @opts[:expand_commit]) c.to_s_html(full_body) end.map { |c| " <p>#{c}</p>" } result << <<-EOH </body> </html> EOH result.join("\n") end def markdown changelog.map do |c| full_body ||= @opts[:expand_major] && c.major? full_body ||= @opts[:expand_risky] && c.risky? full_body ||= @opts[:expand_commit] && (c[:subject] =~ @opts[:expand_commit] || c[:body] =~ @opts[:expand_commit]) c.to_s_markdown(full_body) end.join("\n") end private def changelog ref = ENV['RELEASE_BRANCH'] || 'origin/master' @git.compute_changelog(ref, @opts[:short_sha]) end end end
Version data entries
10 entries across 10 versions & 1 rubygems