lib/chef/taste/changelog.rb in chef-taste-1.0.0 vs lib/chef/taste/changelog.rb in chef-taste-1.1.0
- old
+ new
@@ -37,13 +37,15 @@
# @param dep [Dependency] the dependent cookbook
#
# @return [String] the goo.gl shortened URL for the changelog
#
def compute(dep)
+ # The source url is of the form https://HOSTING_PROVIDER/USER/REPO
+ matched = dep.source_url.match(%r(^(https?:\/\/)?(.*?)\/(.*?)\/(.*?)$))
changelog_url =
- if dep.source_url =~ /^(https?:\/\/)?github.com\/(.*)\/(.*)$/
- GithubChangelog.new("#{$2}/#{$3}", dep.version_used, dep.latest).compute
+ if matched[2] == 'github.com'
+ GithubChangelog.new("#{matched[3]}/#{matched[4]}", dep.version_used, dep.latest).compute
else
nil
end
Googl.shorten(changelog_url).short_url unless changelog_url.nil?
end
@@ -83,11 +85,11 @@
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}/
+ 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
# Returns the compare URL for comparing two tags on Github