Class: GitPm::LinesByAuthor
- Inherits:
-
Object
- Object
- GitPm::LinesByAuthor
- Defined in:
- lib/git_pm/lines_by_author.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ LinesByAuthor
constructor
A new instance of LinesByAuthor.
- #run! ⇒ Object
Constructor Details
#initialize(options) ⇒ LinesByAuthor
Returns a new instance of LinesByAuthor.
3 4 5 |
# File 'lib/git_pm/lines_by_author.rb', line 3 def initialize() @branch = .shift || "master" end |
Instance Method Details
#run! ⇒ Object
7 8 9 10 11 12 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 43 44 45 |
# File 'lib/git_pm/lines_by_author.rb', line 7 def run! exclude = [] if File.directory?("vendor") exclude << "vendor" end if File.directory?("3rdparty") exclude << "3rdparty" end data = GitData.blame(@branch, exclude) fields = [] = [] = 0 data.sort_by { |k, v| v[:lines] }.each { |value| = value.first d = value.last fields << << d[:lines] += 1 } graph = SVG::Graph::BarHorizontal.new({ :height => 40*, :width => 640+20*, :fields => fields, :rotate_y_labels => false }) graph.add_data({ :data => , :title => 'Lines by author', }) graph.burn() end |