gitalytics 1.3.1 → 1.4.0

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.
data/Gemfile.lock DELETED
@@ -1,51 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- gitalytics (1.3.1)
5
- color-generator
6
- haml
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- byebug (9.0.5)
12
- color-generator (0.0.4)
13
- coveralls (0.7.0)
14
- multi_json (~> 1.3)
15
- rest-client
16
- simplecov (>= 0.7)
17
- term-ansicolor
18
- thor
19
- docile (1.1.2)
20
- haml (4.0.7)
21
- tilt
22
- mime-types (2.0)
23
- minitest (5.9.0)
24
- multi_json (1.8.4)
25
- rake (10.1.0)
26
- rest-client (1.6.7)
27
- mime-types (>= 1.16)
28
- simplecov (0.8.2)
29
- docile (~> 1.1.0)
30
- multi_json
31
- simplecov-html (~> 0.8.0)
32
- simplecov-html (0.8.0)
33
- term-ansicolor (1.2.2)
34
- tins (~> 0.8)
35
- thor (0.18.1)
36
- tilt (2.0.5)
37
- tins (0.13.1)
38
-
39
- PLATFORMS
40
- ruby
41
-
42
- DEPENDENCIES
43
- bundler (~> 1.7)
44
- byebug
45
- coveralls
46
- gitalytics!
47
- minitest
48
- rake
49
-
50
- BUNDLED WITH
51
- 1.12.5
@@ -1,50 +0,0 @@
1
- / Start Authors
2
- #authors.tab-pane
3
- .page-header
4
- %h1 Authors
5
- %p.lead
6
- Compare the quantity of commits made by each of your repository contributors.
7
- %br/
8
- Check who is writing most of the code of your project and maybe give him/her a prize! ;)
9
- .row
10
- %p
11
- So far, #{users.size} contributors commited something to your project.
12
- - users.each do |user|
13
- .col-md-4
14
- / Twitter Profile start
15
- .twPc-div
16
- %a.twPc-bg.twPc-block{style: "background-color: #{user.rgba}"}
17
- %div
18
- %a.twPc-avatarLink{href: "#", title: "#{user.name}"}
19
- %img.twPc-avatarImg{alt: "#{user.name}", src: "http://www.gravatar.com/avatar/#{user.gravatar}?d=mm"}/
20
- .twPc-divUser
21
- .twPc-divName
22
- %a{href: "#"}= user.name
23
- %span
24
- %a{href: "mailto:#{user.email}"}
25
- %span= user.email
26
- .twPc-divStats
27
- %ul.twPc-Arrange
28
- %li.twPc-ArrangeSizeFit
29
- %span.twPc-StatLabel.twPc-block Commits
30
- %span.twPc-StatValue.commits= user.commits.size
31
- %li.twPc-ArrangeSizeFit
32
- %span.twPc-StatLabel.twPc-block Inserts
33
- %span.twPc-StatValue.insertions= user.total_insertions
34
- %li.twPc-ArrangeSizeFit
35
- %span.twPc-StatLabel.twPc-block Deletes
36
- %span.twPc-StatValue.deletions= user.total_deletions
37
- / Twitter Profile end
38
- .row
39
- %h2 Commits count per user
40
- .col-md-6
41
- %canvas#usersPieChart{height: "400", width: "550"}
42
- .col-md-6
43
- %ul
44
- - users.each do |u|
45
- %li
46
- %canvas.usersColorLegend{height: "15", style: "background-color: #{u.rgba}", width: "30"}
47
- = u.name
48
- %ul
49
-
50
- / End Authors
@@ -1,21 +0,0 @@
1
- / Start Commits
2
- #commits.tab-pane
3
- .page-header
4
- %h1 Commits
5
- %p.lead A few basic stats on single commits.
6
- - shortest_commit = commits.min_by { |c| c.subject.length }
7
- - longest_commit = commits.max_by { |c| c.subject.length }
8
- %h2 Shortest commit message
9
- %blockquote
10
- %p= shortest_commit.subject
11
- %footer
12
- = shortest_commit.author.name
13
- %cite= shortest_commit.date.strftime('%a %-d, %B %Y')
14
- %hr/
15
- %h2 Longest commit message
16
- %blockquote
17
- %p= longest_commit.subject
18
- %footer
19
- = longest_commit.author.name
20
- %cite= longest_commit.date.strftime('%a %-d, %B %Y')
21
- / End Commits
@@ -1,190 +0,0 @@
1
- :css
2
- /* Sticky footer styles
3
- -------------------------------------------------- */
4
-
5
- html,
6
- body {
7
- height: 100%;
8
- /* The html and body elements cannot have any padding or margin. */
9
- }
10
-
11
- /* Wrapper for page content to push down footer */
12
- #wrap {
13
- min-height: 100%;
14
- height: auto;
15
- /* Negative indent footer by its height */
16
- margin: 0 auto -60px;
17
- /* Pad bottom by footer height */
18
- padding: 0 0 60px;
19
- }
20
-
21
- /* Set the fixed height of the footer here */
22
- #footer {
23
- background-color: #f5f5f5;
24
- height: 60px;
25
- margin-top: 60px;
26
- }
27
-
28
- /* Twitter Profile styles
29
- -------------------------------------------------- */
30
- .twPc-div {
31
- background: #fff none repeat scroll 0 0;
32
- border: 1px solid #e1e8ed;
33
- border-radius: 6px;
34
- height: 150px;
35
- max-width: 340px;
36
- margin-bottom: 40px;
37
- }
38
- .twPc-bg {
39
- border-bottom: 1px solid #e1e8ed;
40
- border-radius: 4px 4px 0 0;
41
- height: 40px;
42
- width: 100%;
43
- }
44
- .twPc-block {
45
- display: block !important;
46
- }
47
- .twPc-button {
48
- margin: -35px -10px 0;
49
- text-align: right;
50
- width: 100%;
51
- }
52
- .twPc-avatarLink {
53
- background-color: #fff;
54
- border-radius: 6px;
55
- display: inline-block !important;
56
- float: left;
57
- margin: -30px 5px 0 8px;
58
- max-width: 100%;
59
- padding: 1px;
60
- vertical-align: bottom;
61
- }
62
- .twPc-avatarImg {
63
- border: 2px solid #fff;
64
- border-radius: 7px;
65
- box-sizing: border-box;
66
- color: #fff;
67
- height: 72px;
68
- width: 72px;
69
- }
70
- .twPc-divUser {
71
- margin: 5px 0 0;
72
- }
73
- .twPc-divName {
74
- font-size: 18px;
75
- font-weight: 700;
76
- line-height: 21px;
77
- white-space: nowrap;
78
- overflow: hidden;
79
- text-overflow: ellipsis
80
- }
81
- .twPc-divName a {
82
- color: inherit !important;
83
- }
84
- .twPc-divStats {
85
- margin-left: 11px;
86
- padding: 10px 0;
87
- }
88
- .twPc-Arrange {
89
- box-sizing: border-box;
90
- display: table;
91
- margin: 0;
92
- min-width: 100%;
93
- padding: 0;
94
- table-layout: auto;
95
- }
96
- ul.twPc-Arrange {
97
- list-style: outside none none;
98
- margin: 0;
99
- padding: 0;
100
- }
101
- .twPc-ArrangeSizeFit {
102
- display: table-cell;
103
- padding: 0;
104
- vertical-align: top;
105
- }
106
- .twPc-ArrangeSizeFit a:hover {
107
- text-decoration: none;
108
- }
109
- .twPc-StatValue {
110
- display: block;
111
- font-size: 18px;
112
- font-weight: 500;
113
- transition: color 0.15s ease-in-out 0s;
114
- }
115
- .twPc-StatValue.commits {
116
- color: #a650c0;
117
- }
118
- .twPc-StatValue.insertions {
119
- color: #539734;
120
- }
121
- .twPc-StatValue.deletions {
122
- color: #c03c24;
123
- }
124
- .twPc-StatLabel {
125
- color: #8899a6;
126
- font-size: 10px;
127
- letter-spacing: 0.02em;
128
- overflow: hidden;
129
- text-transform: uppercase;
130
- transition: color 0.15s ease-in-out 0s;
131
- }
132
-
133
- /* Custom page CSS
134
- -------------------------------------------------- */
135
- /* Not required for template or sticky footer method. */
136
-
137
- #wrap > .container {
138
- padding: 60px 15px 0;
139
- }
140
- .container .text-muted {
141
- margin: 20px 0;
142
- }
143
-
144
- #footer > .container {
145
- padding-left: 15px;
146
- padding-right: 15px;
147
- }
148
-
149
- .user-avatar {
150
- margin: 0 10px 10px 0;
151
- }
152
-
153
- .dp {
154
- box-sizing: border-box;
155
- border:10px solid #eee;
156
- transition: all 0.2s ease-in-out;
157
- }
158
-
159
- .dp:hover {
160
- border:2px solid #eee;
161
- transform:rotate(360deg);
162
- -ms-transform:rotate(360deg);
163
- -webkit-transform:rotate(360deg);
164
- /*-webkit-font-smoothing:antialiased;*/
165
- }
166
-
167
- .dashboard-box {
168
- background-color: #f3f3f3;
169
- border-radius: 10px;
170
- margin-bottom: 30px;
171
- padding: 20px;
172
- text-align: center;
173
- }
174
-
175
- .dashboard-box a {
176
- color: #555;
177
- text-decoration: none;
178
- }
179
-
180
- .dashboard-box .glyphicon {
181
- font-size: 48px;
182
- }
183
-
184
- #authors li {
185
- list-style: none;
186
- }
187
-
188
- .usersColorLegend {
189
- vertical-align: middle;
190
- }
@@ -1,45 +0,0 @@
1
- / Start Dashboard
2
- #dashboard.tab-pane.active
3
- .page-header
4
- %h1 Dashboard
5
- %p.lead A quick overview of the activity on your git repository.
6
- .row
7
- .col-md-4
8
- .dashboard-box
9
- %a{"data-open-tab" => "authors", href: "#authors"}
10
- %span.glyphicon.glyphicon-user
11
- %br/
12
- = users.count
13
- authors
14
- .col-md-4
15
- .dashboard-box
16
- %span.glyphicon.glyphicon-list
17
- %br/
18
- = commits.count
19
- commits
20
- .col-md-4
21
- .dashboard-box
22
- %span.glyphicon.glyphicon-file
23
- %br/
24
- = commits.map{ |c| c.files_committed }.flatten.uniq.compact.count
25
- files committed
26
- .row
27
- .col-md-4
28
- .dashboard-box
29
- %span.glyphicon.glyphicon-plus
30
- %br/
31
- = commits.inject(0) { |total, commit| total + commit.insertions }
32
- insertions
33
- .col-md-4
34
- .dashboard-box
35
- %span.glyphicon.glyphicon-minus
36
- %br/
37
- = commits.inject(0) { |total, commit| total + commit.deletions }
38
- deletions
39
- .col-md-4
40
- .dashboard-box
41
- %span.glyphicon.glyphicon-calendar
42
- %br/
43
- = (commits.max_by(&:date).date - commits.min_by(&:date).date).to_i + 1
44
- days
45
- / End Dashboard
@@ -1,24 +0,0 @@
1
- / Start Dates
2
- #dates.tab-pane
3
- .page-header
4
- %h1 Dates
5
- %p.lead When are those commits happening?
6
- - first_commit = commits.min_by(&:date)
7
- - last_commit = commits.max_by(&:date)
8
- %h2 First Commit Ever
9
- %blockquote
10
- %p= first_commit.subject
11
- %footer
12
- = first_commit.author.name
13
- %cite= first_commit.date.strftime('%a %-d, %B %Y')
14
- %hr/
15
- %h2 Last Commit
16
- %blockquote
17
- %p= last_commit.subject
18
- %footer
19
- = last_commit.author.name
20
- %cite= last_commit.date.strftime('%a %-d, %B %Y')
21
- %hr/
22
- %h2 Most Busy Days
23
- %canvas#daysBarChart{height: "400", width: "1100"}
24
- / End Dates
@@ -1,44 +0,0 @@
1
- :javascript
2
- $('.user-avatar').popover({ trigger: 'hover', html: true }).click(function(e){
3
- e.preventDefault();
4
- });
5
-
6
- // Data for Users Pie Chart
7
- var data = {
8
- datasets: [{
9
- data: [#{users.map{|u| "#{u.commits.count}" }.join(', ')}],
10
- backgroundColor: [#{users.map{|u| "'#{u.rgba}'" }.join(', ')}]
11
- }],
12
- labels: [#{users.map{|u| "'#{u.name}'" }.join(', ')}
13
- ]
14
- };
15
- var ctx = document.getElementById("usersPieChart").getContext("2d");
16
- var usersPieChart = new Chart(ctx,{
17
- type: 'pie',
18
- data: data,
19
- options: {
20
- legend: { display: false }
21
- }
22
- });
23
-
24
- // Data for Weekday commits per user
25
- var data = {
26
- labels: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
27
- datasets: [
28
- { data : [#{weekday_commits.join(', ')}] }
29
- ]
30
- };
31
- var ctx = document.getElementById("daysBarChart").getContext("2d");
32
- var myBarChart = new Chart(ctx, {
33
- type: 'bar',
34
- data: data,
35
- options: {
36
- legend: { display: false }
37
- }
38
- });
39
-
40
- // Makes dashboard items link to tabs
41
- $('a[data-open-tab]').click(function(e) {
42
- e.preventDefault();
43
- $('.navbar-nav').find('a[href="#' + $(this).attr('data-open-tab') + '"]').click();
44
- });
@@ -1,63 +0,0 @@
1
- - require 'haml_helper'
2
- !!!
3
- %html{lang: "en"}
4
- %head
5
- %meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
6
- %meta{charset: "utf-8"}/
7
- %meta{content: "IE=edge", "http-equiv" => "X-UA-Compatible"}/
8
- %meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
9
- %meta{content: "Gitalytics Report", name: "description"}/
10
- %meta{content: "Gonzalo Robaina", name: "author"}/
11
- %title Gitalytics report
12
- / Bootstrap core CSS
13
- %link{crossorigin: "anonymous", href: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css", integrity: "sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7", rel: "stylesheet"}/
14
- %link{crossorigin: "anonymous", href: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css", integrity: "sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r", rel: "stylesheet"}/
15
- / HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
16
- /[if lt IE 9]
17
- <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
18
- <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
19
- = render :css
20
- %body
21
- / Wrap all page content here
22
- #wrap
23
- / Fixed navbar
24
- .navbar.navbar-default.navbar-fixed-top{role: "navigation"}
25
- .container
26
- .navbar-header
27
- %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
28
- %span.sr-only Toggle navigation
29
- %span.icon-bar
30
- %span.icon-bar
31
- %span.icon-bar
32
- %a.navbar-brand{href: "https://rubygems.org/gems/gitalytics"} Gitalytics
33
- .collapse.navbar-collapse
34
- %ul.nav.navbar-nav
35
- %li.active
36
- %a{data: {toggle: :tab}, href: "#dashboard"} Dashboard
37
- %li
38
- %a{data: {toggle: :tab}, href: "#authors"} Authors
39
- %li
40
- %a{data: {toggle: :tab}, href: "#commits"} Commits
41
- %li
42
- %a{data: {toggle: :tab}, href: "#dates"} Dates
43
- / <li><a href="#contact">Contact</a></li>
44
- / /.nav-collapse
45
- / Begin page content
46
- .container
47
- .tab-content
48
- = render :dashboard, users: @users, commits: @commits
49
- = render :authors, users: @users
50
- = render :commits, commits: @commits
51
- = render :dates, commits: @commits
52
- #footer
53
- .container
54
- %p.text-muted
55
- Gitalytics v#{Gitalytics::VERSION} by
56
- %a{href: "http://gonzalo.robaina.me"} Gonzalo Robaina
57
- /
58
- External JavaScript Files
59
- \==================================================
60
- %script{src: "https://code.jquery.com/jquery-2.2.4.min.js"}
61
- %script{crossorigin: "anonymous", integrity: "sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS", src: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"}
62
- %script{src: "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min.js"}
63
- = render :javascript, { users: @users, weekday_commits: @weekday_commits }
data/lib/haml_helper.rb DELETED
@@ -1,8 +0,0 @@
1
- module Haml::Helpers
2
- def render(partial, locals = {})
3
- dir = File.dirname(__FILE__)
4
- filepath = File.join(dir, '..', 'assets', "_#{partial}.html.haml")
5
- file = File.read(filepath)
6
- Haml::Engine.new(file).render(Object.new, locals)
7
- end
8
- end
data/test/files/block1 DELETED
@@ -1,4 +0,0 @@
1
- 2013-02-13 23:11:16 -0200 Gonzalo Robaina <gonzalor@gmail.com> Print basic commit report on the console
2
-
3
- 6 1 bin/gitalytics
4
- 33 6 lib/gitalytics.rb
data/test/files/block2 DELETED
@@ -1,4 +0,0 @@
1
- 2012-12-19 06:04:59 -0800 Gonzalo Robaina <gonzalor@gmail.com> Initial commit
2
-
3
- 16 0 .gitignore
4
- 4 0 README.md
data/test/files/block3 DELETED
@@ -1,7 +0,0 @@
1
- 2012-12-06 10:29:49 -0200 Gonzalo Robaina <gonzalor@gmail.com> initial commit
2
-
3
- 1 0 README.md
4
- 3 0 bin/gitalytics
5
- 13 0 gitalytics.gemspec
6
- 49 0 lib/gist.rb
7
- 11 0 lib/gitalytics.rb
data/test/files/git_log DELETED
@@ -1,15 +0,0 @@
1
- bea63e76c7c6d5afd42ac5b24a911b36e5c261f9 2013-02-13 23:11:16 -0200 Gonzalo Robaina <gonzalor@gmail.com> Print basic commit report on the console
2
-
3
- 6 1 bin/gitalytics
4
- 33 6 lib/gitalytics.rb
5
- d392710a9e657c72e73ca87df3ed2c8c802441e4 2012-12-19 06:04:59 -0800 Gonzalo Robaina <gonzalor@gmail.com> Initial commit
6
-
7
- 16 0 .gitignore
8
- 4 0 README.md
9
- 9a99ae5dbc1eaadf268ca925cce9b68d10216151 2012-12-06 10:29:49 -0200 Gonzalo Robaina <gonzalor@gmail.com> initial commit
10
-
11
- 1 0 README.md
12
- 3 0 bin/gitalytics
13
- 13 0 gitalytics.gemspec
14
- 49 0 lib/gist.rb
15
- 11 0 lib/gitalytics.rb
@@ -1,31 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'test_helper.rb')
2
- require 'minitest/autorun'
3
- require 'gitalytics/commit'
4
-
5
- class TestCommit < MiniTest::Unit::TestCase
6
- def build_commit(commit)
7
- commit.summary << { insertions: 3, deletions: 2, filename: 'a.rb' }
8
- commit.summary << { insertions: 4, deletions: 3, filename: 'b.rb' }
9
- end
10
-
11
- def test_that_count_insertions
12
- @commit = Commit.new('abcdef0123456789')
13
- build_commit(@commit)
14
-
15
- assert_equal(7, @commit.insertions)
16
- end
17
-
18
- def test_that_count_deletions
19
- @commit = Commit.new('abcdef0123456789')
20
- build_commit(@commit)
21
-
22
- assert_equal(5, @commit.deletions)
23
- end
24
-
25
- def test_that_count_files_committed
26
- @commit = Commit.new('abcdef0123456789')
27
- build_commit(@commit)
28
-
29
- assert_equal(['a.rb', 'b.rb'], @commit.files_committed)
30
- end
31
- end
@@ -1,80 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'test_helper.rb')
2
- require 'minitest/autorun'
3
- require 'gitalytics/gitlog'
4
-
5
- class TestCommit < MiniTest::Unit::TestCase
6
- GIT_LOG = File.read(File.join('test', 'files', 'git_log'))
7
-
8
- def setup
9
- GitLog.instance_variable_set(:@users, [])
10
- end
11
-
12
- def test_get_blocks
13
- expected_blocks = [
14
- File.read(File.join('test', 'files', 'block1')),
15
- File.read(File.join('test', 'files', 'block2')),
16
- File.read(File.join('test', 'files', 'block3'))
17
- ]
18
-
19
- expected_commits = [
20
- 'bea63e76c7c6d5afd42ac5b24a911b36e5c261f9',
21
- 'd392710a9e657c72e73ca87df3ed2c8c802441e4',
22
- '9a99ae5dbc1eaadf268ca925cce9b68d10216151'
23
- ]
24
-
25
- blocks = GitLog.get_blocks(GIT_LOG)
26
- # require 'byebug'; byebug
27
-
28
- assert_equal(expected_commits, blocks.map(&:first))
29
- assert_equal(expected_blocks, blocks.map(&:last))
30
- end
31
-
32
- def test_parse_block
33
- blocks = GitLog.get_blocks(GIT_LOG)
34
- hash, block = blocks.last
35
-
36
- commit = GitLog.parse_block(hash, block, 'email')
37
-
38
- assert_equal(
39
- ['README.md', 'bin/gitalytics', 'gitalytics.gemspec', 'lib/gist.rb', 'lib/gitalytics.rb'],
40
- commit.files_committed
41
- )
42
- assert_equal(77, commit.insertions)
43
- assert_equal(0, commit.deletions)
44
- assert_equal('Gonzalo Robaina', commit.author.name)
45
- assert_equal('gonzalor@gmail.com', commit.author.email)
46
- assert_equal('initial commit', commit.subject)
47
- end
48
-
49
- def test_get_user_creates_the_user
50
- blocks = GitLog.get_blocks(GIT_LOG)
51
- hash, block = blocks.last
52
- GitLog.parse_block(hash, block, 'email')
53
-
54
- user = GitLog.get_user('name', 'email@example.com', 'name')
55
- users = GitLog.instance_variable_get("@users")
56
-
57
- assert_equal(2, users.count)
58
- assert_equal(user, users.last)
59
- assert_equal('name', user.name)
60
- assert_equal('email@example.com', user.email)
61
- end
62
-
63
- def test_get_user_returns_the_user
64
- users = [User.new('name', 'email@example.com')]
65
-
66
- user = GitLog.get_user('name', 'email@example.com', 'email')
67
- # assert_equal(user, users.last)
68
- assert_equal('name', user.name)
69
- assert_equal('email@example.com', user.email)
70
- end
71
-
72
- def test_get_commit_author_links_user_and_commit
73
- data = { name: 'name', email: 'email@example.com' }
74
- commit = Commit.new(hash)
75
-
76
- GitLog.get_commit_author(data, commit, 'name')
77
- # assert_equal(users.last, commit.author)
78
- # assert_equal(users.last.commits.last, commit)
79
- end
80
- end