Sha256: c09a130ccd4e9655f1dff5f8567356ecee6a03b427e2fcc54c71d1096715d311
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require "fileutils" # Helper method to insert text after a line that matches the regex def insert_after_line(file, insert, regex = /^## Next/) tempfile = File.open("#{file}.tmp", "w") f = File.new(file) f.each do |line| tempfile << line next unless line =~ regex tempfile << "\n" tempfile << insert tempfile << "\n" end f.close tempfile.close FileUtils.mv("#{file}.tmp", file) end # Extracts all changes that have been made after the latest pushed tag def changes_since_last_tag `git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%t - %s%n%b%n"` end # Extracts all github users contributed since last tag def users_since_last_tag `git --no-pager log $(git describe --tags --abbrev=0)..HEAD --grep="Merge" --pretty=format:"%s" | cut -d' ' -f 6 | cut -d/ -f1 | sort | uniq` end namespace :changelog do task :generate do insert_after_line("CHANGELOG.md", changes_since_last_tag, /^## Next/) printf("Users contributed since last release:\n") contributors = users_since_last_tag.split("\n").map { |name| "@" + name } printf("Huge thanks to all our contributors 🎆\n") printf("Special thanks to: " + contributors.join(" ") + "\n") printf("\nI'll merge this and release the gem once all tests pass.\n") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-google-2.7.0 | tasks/changelog.rake |
vagrant-google-2.6.0 | tasks/changelog.rake |