Commit 49c033cd authored by Fabio Pelosin's avatar Fabio Pelosin

[Gemspec] Include the changelog of RCs in the post install message

parent ef6130be
......@@ -49,11 +49,16 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA
changelog_path = File.expand_path('../CHANGELOG.md', __FILE__)
if File.exists?(changelog_path)
title_token = '## '
current_verison_title = title_token + Pod::VERSION.to_s
full_changelog = File.open(changelog_path, "r:UTF-8") { |f| f.read }
current_version_index = full_changelog.index(/^#{current_verison_title}/)
previous_version_index = full_changelog.index(/^#{title_token}/, current_version_index + title_token.length)
relevant = full_changelog[current_version_index..previous_version_index-1]
s.post_install_message = "\nCHANGELOG:\n\n" + relevant + "\n"
current_verison_title = title_token + Pod::VERSION.to_s
text = File.open(changelog_path, "r:UTF-8") { |f| f.read }
lines = text.split("\n")
current_version_index = lines.find_index { |line| line =~ (/^#{current_verison_title}/) }
previous_version_lines = lines[(current_version_index+1)...-1]
previous_version_index = current_version_index + previous_version_lines.find_index { |line| line =~ (/^#{title_token}/) && !line.include?('rc') }
relevant = lines[current_version_index..previous_version_index]
s.post_install_message = "\nCHANGELOG:\n\n" + relevant.join("\n") + "\n"
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment