gitalytics 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23ec8f357392488c8e0448555e52964f905b723d
4
- data.tar.gz: f70ec4ccce5ed624a54975f514908bdaaddac4ff
3
+ metadata.gz: 42ce0238a2282e8e07b38afc990e971c93083d3f
4
+ data.tar.gz: 4f3eb1308a8ed7c6b32a11987bfaa5eb022b8c40
5
5
  SHA512:
6
- metadata.gz: 7729801e99f39eff2f1beaa305997438b466ac82da113f306340ee1327724aa30b7ca8a969b13dd3004ff9a0a75dda21a5d53e00faf1e70b894d2e12581d0c60
7
- data.tar.gz: acca7a0f6e4a96a6a85867a1381dad0cf27b3eafff4c4eb88b66ae8ac88854cd0d23a5b391c9431869e6ccedc9628defb7722ffe24c0f85203d65ba8be9047d2
6
+ metadata.gz: 071ad7c30c498c430540f53b3478e76b7f069e71768e30f70f6eb86b5353110c5d542b49f37a36486a01e203501b7e16cd44b97496a45a28f5d60807d0764d79
7
+ data.tar.gz: 791dc2e44997462d29fd24c0ac40165eaff230cb59d5c108bb8f1910b8b40bb2a4a83db52e3b0afd950bd5da128d17d919651af6cabcc09647196095a82f32e4
@@ -87,6 +87,11 @@
87
87
  text-align: center;
88
88
  }
89
89
 
90
+ .dashboard-box a {
91
+ color: #555;
92
+ text-decoration: none;
93
+ }
94
+
90
95
  .dashboard-box .glyphicon {
91
96
  font-size: 48px;
92
97
  }
@@ -132,9 +137,11 @@
132
137
  <div class="row">
133
138
  <div class="col-md-4">
134
139
  <div class="dashboard-box">
135
- <span class="glyphicon glyphicon-user"></span><br>
136
- <%= @users.count %>
137
- authors
140
+ <a href="#authors" data-open-tab="authors">
141
+ <span class="glyphicon glyphicon-user"></span><br>
142
+ <%= @users.count %>
143
+ authors
144
+ </a>
138
145
  </div>
139
146
  </div>
140
147
  <div class="col-md-4">
@@ -182,7 +189,7 @@
182
189
  <p class="lead">Compare the quantity of commits made by each of your repository contributors.<br/> Check who is writing most of the code of your project and maybe give him/her a prize! ;)</p>
183
190
  <% @users.each do |user| %>
184
191
  <a href="#" title="<%= user.name %> <small><%= user.email %></small>" class="user-avatar" data-content="<%= user.summary %>">
185
- <img class="dp img-circle" src="<%= "http://www.gravatar.com/avatar/#{user.gravatar}" %>" style="width: 100px; height:100px; border-color:<%= user.rgba %>"></a>
192
+ <img class="dp img-circle" src="<%= "http://www.gravatar.com/avatar/#{user.gravatar}?d=mm" %>" style="width: 100px; height:100px; border-color:<%= user.rgba %>"></a>
186
193
  <% end %>
187
194
  </div>
188
195
 
@@ -229,7 +236,7 @@
229
236
 
230
237
  // Data for Insertions vs. Deletions Bar Chart
231
238
  var data = {
232
- labels: [<%= @users.map{|d| "'#{d.name}'" }.join(',') %>],
239
+ labels: [<%= @users.map{|d| "'#{d.escaped_name}'" }.join(',') %>],
233
240
  datasets: [
234
241
  {
235
242
  data: [<%= @users.map{|d| "#{d.total_insertions}" }.join(',') %>],
@@ -263,6 +270,12 @@
263
270
  };
264
271
  var ctx = document.getElementById("usersRadarChart").getContext("2d");
265
272
  var usersRadarChart = new Chart(ctx).Radar(data);
273
+
274
+ // Makes dashboard items link to tabs
275
+ $('a[data-open-tab]').click(function(e) {
276
+ e.preventDefault();
277
+ $('a[href="#' + $(this).attr('data-open-tab') + '"]').click();
278
+ });
266
279
  </script>
267
280
  </body>
268
281
  </html>
@@ -7,7 +7,7 @@ require 'commit'
7
7
 
8
8
  class Gitalytics
9
9
 
10
- VERSION = '1.2.1'
10
+ VERSION = '1.2.2'
11
11
 
12
12
  def analyze(options)
13
13
  data = GitLog.parse_git_log
@@ -33,7 +33,9 @@ class Gitalytics
33
33
  erb = ERB.new(template_file)
34
34
  output_file = "gitalytics_result.html"
35
35
  File.open(output_file, 'w+') do |file|
36
- @users = data[:users]
36
+ @users = data[:users].sort do |x, y|
37
+ y.commits.length <=> x.commits.length
38
+ end
37
39
  @commits = data[:commits]
38
40
  file.write(erb.result(binding))
39
41
  end
@@ -16,7 +16,7 @@ module GitLog
16
16
  commits << parse_block(hash, block_string, users)
17
17
  end
18
18
 
19
- {users: users, commits: commits}
19
+ { users: users, commits: commits }
20
20
  end
21
21
 
22
22
  def get_log
@@ -1,14 +1,19 @@
1
1
  require 'digest/md5'
2
+ require 'CGI'
2
3
 
3
4
  class User
4
5
 
5
6
  attr_accessor :name, :email, :commits, :colors
6
7
 
7
8
  def initialize(name, email)
8
- self.name = name
9
- self.email = email
9
+ self.name = name
10
+ self.email = email
10
11
  self.commits = []
11
- self.colors = [rand(255), rand(255), rand(255)].join(', ')
12
+ self.colors = [rand(255), rand(255), rand(255)].join(', ')
13
+ end
14
+
15
+ def escaped_name
16
+ CGI.escapeHTML(name)
12
17
  end
13
18
 
14
19
  def gravatar
@@ -49,9 +54,7 @@ class User
49
54
 
50
55
  def weekday_commits
51
56
  days = Array.new(7) {0}
52
- commits.each do |c|
53
- days[c.date.wday] += 1
54
- end
57
+ commits.each { |c| days[c.date.wday] += 1 }
55
58
  days
56
59
  end
57
60
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitalytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gonzalo Robaina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-18 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Get usefull analytics from your git log
14
14
  email: gonzalor@gmail.com
@@ -17,12 +17,12 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - assets/gitalytics.html.erb
20
21
  - bin/gitalytics
22
+ - lib/commit.rb
21
23
  - lib/gitalytics.rb
22
24
  - lib/gitlog.rb
23
25
  - lib/user.rb
24
- - lib/commit.rb
25
- - assets/gitalytics.html.erb
26
26
  homepage: http://rubygems.org/gems/gitalytics
27
27
  licenses:
28
28
  - MIT
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  version: '0'
44
44
  requirements: []
45
45
  rubyforge_project:
46
- rubygems_version: 2.1.10
46
+ rubygems_version: 2.4.6
47
47
  signing_key:
48
48
  specification_version: 4
49
49
  summary: Git Analytics