Sha256: 75eb854b15cd9a9e0e63222e5eb3a309dce583bffd84eace9e5135acc1cf08d7
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
module Danger module Changelog # A CHANGELOG.md file reader. class ChangelogFile attr_reader :filename, :bad_lines, :exists def initialize(filename = 'CHANGELOG.md') @filename = filename @exists = File.exist?(filename) parse if @exists end # Any bad_lines? def bad_lines? !!bad_lines && bad_lines.any? end def exists? !!@exists end def your_contribution_here? !!@your_contribution_here end def bad? bad_lines? || !your_contribution_here? end def good? !bad? end private # Parse CHANGELOG file. def parse @your_contribution_here = false @bad_lines = [] File.open(filename).each_line do |line| next if line.strip.empty? changelog_line = ChangelogLineParser.parse(line) if changelog_line.nil? || changelog_line.invalid? @bad_lines << line next end # notice your contribution here if changelog_line.is_a?(ChangelogPlaceholderLine) @your_contribution_here = true next end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
danger-changelog-0.2.1 | lib/changelog/changelog_file.rb |