Class: Yapt::GitLogShiv
- Inherits:
-
Object
- Object
- Yapt::GitLogShiv
- Defined in:
- lib/yapt.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
-
#tracker_ids ⇒ Object
readonly
Returns the value of attribute tracker_ids.
Class Method Summary collapse
Instance Method Summary collapse
- #display ⇒ Object
- #github_link ⇒ Object
-
#initialize(message) ⇒ GitLogShiv
constructor
A new instance of GitLogShiv.
Constructor Details
#initialize(message) ⇒ GitLogShiv
Returns a new instance of GitLogShiv.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/yapt.rb', line 52 def initialize() lines = .split("\n") @sha = lines.first[/\w+$/].strip = lines[1] = [/:[^<]+/].sub(/\A:/,'').strip = lines[3..-1].join("\n") tracker_directives = .scan(/\[.*\d+\]/) @tracker_ids = [] tracker_directives.each do |directive| @tracker_ids << directive[/\d+/] .gsub!(directive,'') end = .strip end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
51 52 53 |
# File 'lib/yapt.rb', line 51 def end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
51 52 53 |
# File 'lib/yapt.rb', line 51 def end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
51 52 53 |
# File 'lib/yapt.rb', line 51 def sha @sha end |
#tracker_ids ⇒ Object (readonly)
Returns the value of attribute tracker_ids.
51 52 53 |
# File 'lib/yapt.rb', line 51 def tracker_ids @tracker_ids end |
Class Method Details
.find(since_until) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/yapt.rb', line 44 def self.find(since_until) result = `git log #{since_until}` commits = result.split(/^commit/).reverse.collect {|c| "commit#{c}" } commits.pop if commits.last == 'commit' commits.collect {|c| new(c) } end |
Instance Method Details
#display ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/yapt.rb', line 71 def display output = '' tracker_ids.each do |id| story = Story.find(id) output << View.new([story]).display("for_git_display").strip + "\n" end output << "Git commit:\n #{message} by #{author}\n #{github_link}\n\n" output end |
#github_link ⇒ Object
67 68 69 |
# File 'lib/yapt.rb', line 67 def github_link "#{Yapt.github_url_base}/commit/#{sha}" end |