Class: GitBump::Release
- Inherits:
-
Object
- Object
- GitBump::Release
- Defined in:
- lib/git_bump.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sha1 ⇒ Object
readonly
Returns the value of attribute sha1.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #body ⇒ Object
- #format ⇒ Object
-
#initialize(tag, sha1, name, version) ⇒ Release
constructor
A new instance of Release.
- #inverse_diff(context = 1) ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/git_bump.rb', line 23 def name @name end |
#sha1 ⇒ Object (readonly)
Returns the value of attribute sha1.
23 24 25 |
# File 'lib/git_bump.rb', line 23 def sha1 @sha1 end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
23 24 25 |
# File 'lib/git_bump.rb', line 23 def tag @tag end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
23 24 25 |
# File 'lib/git_bump.rb', line 23 def version @version end |
Instance Method Details
#body ⇒ Object
29 30 31 |
# File 'lib/git_bump.rb', line 29 def body @body ||= %x{git log -1 --pretty=format:%b #{sha1}} end |
#format ⇒ Object
33 34 35 |
# File 'lib/git_bump.rb', line 33 def format body[/(?:\n |.)*/].sub(/\A([-* ]*)(.*?)(\.?)\z/m, '\1%s\3') unless body.empty? end |
#inverse_diff(context = 1) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/git_bump.rb', line 37 def inverse_diff(context = 1) unless defined?(@inverse_diff) @inverse_diff = if !%x{git rev-parse --verify -q #{sha1}^}.empty? %x{git diff -U#{context} #{sha1}..#{sha1}^} end end @inverse_diff end |