lib/pdk/util/changelog_generator.rb in pdk-2.1.0 vs lib/pdk/util/changelog_generator.rb in pdk-2.1.1

- old
+ new

@@ -108,9 +108,22 @@ end version.join('.') end + # Returns the top most version from the CHANGELOG file + def self.latest_version + latest = nil + changelog_content.each_line do |line| + line.strip! + if line.start_with?('## [') + latest = line[line.index('[') + 1..line.index(']') - 1].delete('v') + break # stops after the top version is extracted + end + end + latest + end + def self.changelog_file # Default Changelog file is CHANGELOG.md, but also search for the .MD prefix as well. @changelog_file ||= ['CHANGELOG.md', 'CHANGELOG.MD'].map { |file| PDK::Util::Filesystem.expand_path(file) }.find { |path| PDK::Util::Filesystem.file?(path) } end