git_stats 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,4 +53,8 @@ en:
53
53
  close: Close
54
54
  binary: Binary
55
55
  text: Text
56
- general: General
56
+ general: General
57
+ details: Details
58
+ insertions_by_date: Lines added by date
59
+ deletions_by_date: Lines deleted by date
60
+ changed_lines_by_date: Changed lines by date
@@ -7,10 +7,10 @@ module GitStats
7
7
  @authors = authors
8
8
  end
9
9
 
10
- def commits_sum_by_author_by_date(limit = 4)
10
+ def commits_sum_by_author_by_date(limit = 4, authors = nil)
11
11
  Chart.new do |f|
12
12
  f.multi_date_chart(
13
- data: @authors.sort_by { |author| -author.commits.size }[0..limit].map { |author| {name: author.name, data: author.commits_sum_by_date} },
13
+ data: (authors || @authors.sort_by { |author| -author.commits.size }[0..limit]).map { |author| {name: author.name, data: author.commits_sum_by_date} },
14
14
  title: :lines_by_date.t,
15
15
  y_text: :lines.t
16
16
  )
@@ -18,10 +18,10 @@ module GitStats
18
18
  end
19
19
 
20
20
  [:insertions, :deletions, :changed_lines].each do |method|
21
- define_method "#{method}_by_author_by_date" do |limit = 4|
21
+ define_method "#{method}_by_author_by_date" do |limit = 4, authors = nil|
22
22
  Chart.new do |f|
23
23
  f.multi_date_chart(
24
- data: @authors.sort_by { |author| -author.send(method) }[0..limit].map { |author| {name: author.name, data: author.send("#{method}_by_date")} },
24
+ data: (authors || @authors.sort_by { |author| -author.send(method) }[0..limit]).map { |author| {name: author.name, data: author.send("#{method}_by_date")} },
25
25
  title: :lines_by_date.t,
26
26
  y_text: :lines.t
27
27
  )
@@ -11,20 +11,20 @@ module GitStats
11
11
  prepare_static_content
12
12
  prepare_assets
13
13
 
14
- all_templates.each do |template|
14
+ all_templates.reject {|t| t =~ /author_details/}.each do |template|
15
15
  output = Template.new(template, @layout).render(@view_data, author: @view_data.repo, links: links)
16
16
  write(output, "#@out_path/#{template}.html")
17
17
  end
18
18
 
19
- render_authors_activity
19
+ render_authors
20
20
  end
21
21
 
22
- def render_authors_activity
22
+ def render_authors
23
23
  done = []
24
24
  @view_data.repo.authors.sort_by { |a| -a.commits.size }.each do |author|
25
25
  next if done.include? author.dirname
26
26
  done << author.dirname
27
- all_templates('activity/').each do |template|
27
+ (all_templates('activity/') + all_templates('author_details')).each do |template|
28
28
  output = Template.new(template, @layout).render(@view_data,
29
29
  author: author,
30
30
  links: links,
@@ -35,11 +35,11 @@ module GitStats
35
35
  end
36
36
 
37
37
  def all_templates(root = '')
38
- Dir["../../../../templates/#{root}**/[^_]*.haml".absolute_path].map {
38
+ (Dir["../../../../templates/#{root}**/[^_]*.haml".absolute_path].map {
39
39
  |f| Pathname.new(f)
40
40
  }.map { |f|
41
41
  f.relative_path_from(Pathname.new('../../../../templates'.absolute_path)).sub_ext('')
42
- }.map(&:to_s) - %w(layout)
42
+ }.map(&:to_s) - %w(layout))
43
43
  end
44
44
 
45
45
  private
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module GitStats
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
@@ -0,0 +1,35 @@
1
+ .tabbable.tabs-left
2
+ %ul.nav.nav-tabs
3
+ %li{class: page == :commits_by_date ? "active" : ""}
4
+ %a{href: 'commits_by_date.html'}= :commits_by_date.t
5
+ %li{class: page == :changed_lines_by_date ? "active" : ""}
6
+ %a{href: 'changed_lines_by_date.html'}= :changed_lines_by_date.t
7
+ %li{class: page == :insertions_by_date ? "active" : ""}
8
+ %a{href: 'insertions_by_date.html'}= :insertions_by_date.t
9
+ %li{class: page == :deletions_by_date ? "active" : ""}
10
+ %a{href: 'deletions_by_date.html'}= :deletions_by_date.t
11
+
12
+ .tab-content
13
+ .tab-pane.active
14
+ .page-header
15
+ %h1.pagination-centered= page.t
16
+
17
+ -if page == :commits_by_date
18
+ = high_stock("charts.commits_sum_by_author_by_date", charts.commits_sum_by_author_by_date(4, [author]))
19
+ %small
20
+ %center= "5 #{:best_authors_shown.t}"
21
+
22
+ -elsif page == :changed_lines_by_date
23
+ = high_stock("charts.changed_lines_by_author_by_date", charts.changed_lines_by_author_by_date(4, [author]))
24
+ %small
25
+ %center= "5 #{:best_authors_shown.t}"
26
+
27
+ -elsif page == :insertions_by_date
28
+ = high_stock("charts.insertions_by_author_by_date", charts.insertions_by_author_by_date(4, [author]))
29
+ %small
30
+ %center= "5 #{:best_authors_shown.t}"
31
+
32
+ -elsif page == :deletions_by_date
33
+ = high_stock("charts.deletions_by_author_by_date", charts.deletions_by_author_by_date(4, [author]))
34
+ %small
35
+ %center= "5 #{:best_authors_shown.t}"
@@ -0,0 +1 @@
1
+ = render_partial('author_details/_author_details', page: :changed_lines_by_date, author: author)
@@ -0,0 +1 @@
1
+ = render_partial('author_details/_author_details', page: :commits_by_date, author: author)
@@ -0,0 +1 @@
1
+ = render_partial('author_details/_author_details', page: :deletions_by_date, author: author)
@@ -0,0 +1 @@
1
+ = render_partial('author_details/_author_details', page: :insertions_by_date, author: author)
@@ -38,7 +38,9 @@
38
38
  %td= I18n.localize(author.commits.first.try(:date), format: :long) rescue ""
39
39
  %td= I18n.localize(author.commits.last.try(:date), format: :long) rescue ""
40
40
  %td
41
- %a.btn{:href => "#{author.dirname}/activity/by_date.html"}= :show_more.t
41
+ %a.btn{:href => "#{author.dirname}/activity/by_date.html"}= :activity.t
42
+ %td
43
+ %a.btn{:href => "#{author.dirname}/author_details/commits_by_date.html"}= :details.t
42
44
 
43
45
  -elsif page == :commits_count_by_author
44
46
  = high_chart("charts.commits_count_by_author", charts.commits_count_by_author(4))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
12
+ date: 2013-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -191,6 +191,11 @@ files:
191
191
  - templates/assets/bootstrap/js/bootstrap.min.js
192
192
  - templates/assets/highstock.js
193
193
  - templates/assets/jquery.min.js
194
+ - templates/author_details/_author_details.haml
195
+ - templates/author_details/changed_lines_by_date.haml
196
+ - templates/author_details/commits_by_date.haml
197
+ - templates/author_details/deletions_by_date.haml
198
+ - templates/author_details/insertions_by_date.haml
194
199
  - templates/authors/_authors.haml
195
200
  - templates/authors/best_authors.haml
196
201
  - templates/authors/changed_lines_by_author_by_date.haml
@@ -224,9 +229,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
229
  - - ! '>='
225
230
  - !ruby/object:Gem::Version
226
231
  version: '0'
227
- segments:
228
- - 0
229
- hash: -3906747656175915771
230
232
  requirements: []
231
233
  rubyforge_project:
232
234
  rubygems_version: 1.8.24