Skip to content

Commit

Permalink
Add link to git changes in changelog
Browse files Browse the repository at this point in the history
Fixes #128
  • Loading branch information
lautis committed Jan 22, 2018
1 parent 4212a8e commit 2948d54
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ def changelog_tail
end
end

def compare_url(from, to)
"https://github.com/mishoo/UglifyJS2/compare/#{from}...#{to}"
end

def previous_version
match = File.read("CHANGELOG.md").scan(/- update UglifyJS to \[(.*)\]\(/)
match ? match[0][0].chomp : nil
end

# rubocop:disable Metrics/BlockLength
namespace :uglifyjs do
desc "Update UglifyJS source to version specified in VERSION environment variable"
Expand Down Expand Up @@ -65,7 +74,10 @@ namespace :uglifyjs do

desc "Add UglifyJS version bump to changelog"
task :changelog do
item = "- update UglifyJS to #{version}"
url = compare_url("v#{previous_version}", "v#{version}")
es_url = compare_url("harmony-v#{previous_version}", "harmony-v#{version}")
item = "- update UglifyJS to [#{version}](#{url})" \
"\n- update uglify-es to [#{version}](#{es_url})"
changelog = "#{HEADER}\n\n#{item}\n#{changelog_tail}"
File.write("CHANGELOG.md", changelog)
end
Expand Down

0 comments on commit 2948d54

Please sign in to comment.