Class: Git::ReleaseNotes
- Inherits:
-
Object
- Object
- Git::ReleaseNotes
- Defined in:
- lib/git/release_notes.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #annotate! ⇒ Object
-
#initialize(options = {}) ⇒ ReleaseNotes
constructor
A new instance of ReleaseNotes.
Methods included from Commands
#assert_is_git_repo, #get_branch, #get_tags, #is_git_repo?, #needs_commit?, #next_version, #valid_version_regexp
Methods included from CLI
Constructor Details
#initialize(options = {}) ⇒ ReleaseNotes
Returns a new instance of ReleaseNotes.
8 9 10 11 |
# File 'lib/git/release_notes.rb', line 8 def initialize( = {}) = @limit = [:limit].nil? ? 20 : [:limit] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/git/release_notes.rb', line 7 def end |
Instance Method Details
#annotate! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/git/release_notes.rb', line 13 def annotate! assert_is_git_repo = .reverse error "No version tags available." if .empty? if [:all] start_index = 0 end_index = .length - 1 else start_tag = [:from] || ask("Start at which tag?", [0], ) start_index = .index(start_tag) end_tag = [:to] || ask("End at which tag?", [start_index + 1] || [start_index], ) end_index = .index(end_tag) + 1 # include end tag end start_index.upto(end_index-1) do |i| start = [i] finish = [i+1] range = '' range << "refs/tags/#{finish}.." if finish # log until end tag if there is an end tag range << "refs/tags/#{start}" log = `git log --no-merges --pretty=format:"%h %s" #{range}`.strip.split("\n") next if log.empty? puts "#{start}" puts "=" * start.length puts @limit ? log[0,@limit] : log puts " ... and #{log.size - @limit} more." if @limit && log.size > @limit puts end end |