Class: Chef::Taste::Changelog::GithubChangelog
- Inherits:
-
Object
- Object
- Chef::Taste::Changelog::GithubChangelog
- Defined in:
- lib/chef/taste/changelog.rb
Overview
The class for computing the changelog for cookbooks hosted in Github.
Instance Attribute Summary collapse
-
#from_version ⇒ Object
readonly
The version to compare from.
-
#repo ⇒ Object
readonly
The Github repository.
-
#to_version ⇒ Object
readonly
The version to compare to.
Instance Method Summary collapse
-
#compare_url(from_tag, to_tag) ⇒ String
Returns the compare URL for comparing two tags on Github.
-
#compute ⇒ String
Computes the changelog URL for Github repositories.
-
#initialize(repo, from_version, to_version) ⇒ GithubChangelog
constructor
Constructor.
Constructor Details
#initialize(repo, from_version, to_version) ⇒ GithubChangelog
Constructor
72 73 74 75 76 |
# File 'lib/chef/taste/changelog.rb', line 72 def initialize(repo, from_version, to_version) @repo = repo @from_version = from_version @to_version = to_version end |
Instance Attribute Details
#from_version ⇒ Object (readonly)
The version to compare from
59 60 61 |
# File 'lib/chef/taste/changelog.rb', line 59 def from_version @from_version end |
#repo ⇒ Object (readonly)
The Github repository
56 57 58 |
# File 'lib/chef/taste/changelog.rb', line 56 def repo @repo end |
#to_version ⇒ Object (readonly)
The version to compare to
62 63 64 |
# File 'lib/chef/taste/changelog.rb', line 62 def to_version @to_version end |
Instance Method Details
#compare_url(from_tag, to_tag) ⇒ String
Returns the compare URL for comparing two tags on Github
101 102 103 |
# File 'lib/chef/taste/changelog.rb', line 101 def compare_url(from_tag, to_tag) "https://github.com/#{repo}/compare/#{from_tag}...#{to_tag}" end |
#compute ⇒ String
Computes the changelog URL for Github repositories
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/chef/taste/changelog.rb', line 82 def compute = Octokit.(repo) from_tag = nil to_tag = nil .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 |