class Chef::Taste::Changelog::GithubChangelog
The class for computing the changelog for cookbooks hosted in Github.
Attributes
from_version[R]
The version to compare from
repo[R]
The Github repository
to_version[R]
The version to compare to
Public Class Methods
new(repo, from_version, to_version)
click to toggle source
Constructor
@param repo [String] the Github repo @param from_version
[String] the version to compare from @param to_version
[String] the version to compare to
@return [GithubChangelog] the Github changelog object
# File lib/chef/taste/changelog.rb, line 77 def initialize(repo, from_version, to_version) @repo = repo @from_version = from_version @to_version = to_version end
Public Instance Methods
compare_url(from_tag, to_tag)
click to toggle source
Returns the compare URL for comparing two tags on Github
@param from_tag [String] the tag to compare from @param to_tag [String] the tag to compare to
@return [String] the Github URL to compare given two tags
# File lib/chef/taste/changelog.rb, line 106 def compare_url(from_tag, to_tag) "https://github.com/#{repo}/compare/#{from_tag}...#{to_tag}" end
compute()
click to toggle source
Computes the changelog URL for Github repositories
@return [String] the computed changelog URL
# File lib/chef/taste/changelog.rb, line 87 def compute tags = Octokit.tags(repo) from_tag = nil to_tag = nil tags.each do |tag| tag_name = tag.name from_tag = tag_name if tag_name =~ /^v?#{from_version}$/ to_tag = tag_name if tag_name =~ /^v?#{to_version}$/ end compare_url(from_tag, to_tag) if from_tag && to_tag end