gitalytics 1.3.0 → 1.3.1
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 +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +0 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -0
- data/README.md +10 -2
- data/Rakefile +1 -0
- data/assets/_authors.html.haml +50 -0
- data/assets/_commits.html.haml +21 -0
- data/assets/_css.html.haml +190 -0
- data/assets/_dashboard.html.haml +45 -0
- data/assets/_dates.html.haml +24 -0
- data/assets/_javascript.html.haml +44 -0
- data/assets/gitalytics.html.haml +63 -0
- data/bin/gitalytics +16 -7
- data/gitalytics.gemspec +14 -12
- data/lib/gitalytics.rb +27 -22
- data/lib/gitalytics/commit.rb +3 -5
- data/lib/gitalytics/gitlog.rb +22 -25
- data/lib/gitalytics/user.rb +11 -11
- data/lib/gitalytics/version.rb +1 -1
- data/lib/haml_helper.rb +8 -0
- data/test/files/block1 +4 -0
- data/test/files/block2 +4 -0
- data/test/files/block3 +7 -0
- data/test/files/git_log +15 -0
- data/test/lib/test_commit.rb +5 -16
- data/test/lib/test_gitlog.rb +25 -50
- data/test/lib/test_user.rb +33 -22
- metadata +49 -6
- data/assets/gitalytics.html.erb +0 -520
data/test/lib/test_commit.rb
CHANGED
@@ -3,40 +3,29 @@ require 'minitest/autorun'
|
|
3
3
|
require 'gitalytics/commit'
|
4
4
|
|
5
5
|
class TestCommit < MiniTest::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@commit = Commit.new('abcdef0123456789')
|
9
|
-
end
|
10
|
-
|
11
6
|
def build_commit(commit)
|
12
|
-
commit.summary << {
|
13
|
-
|
14
|
-
deletions: 2,
|
15
|
-
filename: 'a.rb'
|
16
|
-
}
|
17
|
-
commit.summary << {
|
18
|
-
insertions: 4,
|
19
|
-
deletions: 3,
|
20
|
-
filename: 'b.rb'
|
21
|
-
}
|
7
|
+
commit.summary << { insertions: 3, deletions: 2, filename: 'a.rb' }
|
8
|
+
commit.summary << { insertions: 4, deletions: 3, filename: 'b.rb' }
|
22
9
|
end
|
23
10
|
|
24
11
|
def test_that_count_insertions
|
12
|
+
@commit = Commit.new('abcdef0123456789')
|
25
13
|
build_commit(@commit)
|
26
14
|
|
27
15
|
assert_equal(7, @commit.insertions)
|
28
16
|
end
|
29
17
|
|
30
18
|
def test_that_count_deletions
|
19
|
+
@commit = Commit.new('abcdef0123456789')
|
31
20
|
build_commit(@commit)
|
32
21
|
|
33
22
|
assert_equal(5, @commit.deletions)
|
34
23
|
end
|
35
24
|
|
36
25
|
def test_that_count_files_committed
|
26
|
+
@commit = Commit.new('abcdef0123456789')
|
37
27
|
build_commit(@commit)
|
38
28
|
|
39
29
|
assert_equal(['a.rb', 'b.rb'], @commit.files_committed)
|
40
30
|
end
|
41
|
-
|
42
31
|
end
|
data/test/lib/test_gitlog.rb
CHANGED
@@ -3,65 +3,37 @@ require 'minitest/autorun'
|
|
3
3
|
require 'gitalytics/gitlog'
|
4
4
|
|
5
5
|
class TestCommit < MiniTest::Unit::TestCase
|
6
|
+
GIT_LOG = File.read(File.join('test', 'files', 'git_log'))
|
6
7
|
|
7
|
-
def
|
8
|
-
|
9
|
-
%q(bea63e76c7c6d5afd42ac5b24a911b36e5c261f9 2013-02-13 23:11:16 -0200 Gonzalo Robaina <gonzalor@gmail.com> Print basic commit report on the console
|
10
|
-
|
11
|
-
6 1 bin/gitalytics
|
12
|
-
33 6 lib/gitalytics.rb
|
13
|
-
d392710a9e657c72e73ca87df3ed2c8c802441e4 2012-12-19 06:04:59 -0800 Gonzalo Robaina <gonzalor@gmail.com> Initial commit
|
14
|
-
|
15
|
-
16 0 .gitignore
|
16
|
-
4 0 README.md
|
17
|
-
9a99ae5dbc1eaadf268ca925cce9b68d10216151 2012-12-06 10:29:49 -0200 Gonzalo Robaina <gonzalor@gmail.com> initial commit
|
18
|
-
|
19
|
-
1 0 README.md
|
20
|
-
3 0 bin/gitalytics
|
21
|
-
13 0 gitalytics.gemspec
|
22
|
-
49 0 lib/gist.rb
|
23
|
-
11 0 lib/gitalytics.rb
|
24
|
-
)
|
8
|
+
def setup
|
9
|
+
GitLog.instance_variable_set(:@users, [])
|
25
10
|
end
|
26
11
|
|
27
12
|
def test_get_blocks
|
28
13
|
expected_blocks = [
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
33 6 lib/gitalytics.rb),
|
33
|
-
|
34
|
-
%q(2012-12-19 06:04:59 -0800 Gonzalo Robaina <gonzalor@gmail.com> Initial commit
|
35
|
-
|
36
|
-
16 0 .gitignore
|
37
|
-
4 0 README.md),
|
38
|
-
|
39
|
-
%q(2012-12-06 10:29:49 -0200 Gonzalo Robaina <gonzalor@gmail.com> initial commit
|
40
|
-
|
41
|
-
1 0 README.md
|
42
|
-
3 0 bin/gitalytics
|
43
|
-
13 0 gitalytics.gemspec
|
44
|
-
49 0 lib/gist.rb
|
45
|
-
11 0 lib/gitalytics.rb)
|
14
|
+
File.read(File.join('test', 'files', 'block1')),
|
15
|
+
File.read(File.join('test', 'files', 'block2')),
|
16
|
+
File.read(File.join('test', 'files', 'block3'))
|
46
17
|
]
|
47
18
|
|
48
19
|
expected_commits = [
|
49
20
|
'bea63e76c7c6d5afd42ac5b24a911b36e5c261f9',
|
50
21
|
'd392710a9e657c72e73ca87df3ed2c8c802441e4',
|
51
|
-
'9a99ae5dbc1eaadf268ca925cce9b68d10216151'
|
22
|
+
'9a99ae5dbc1eaadf268ca925cce9b68d10216151'
|
52
23
|
]
|
53
|
-
|
24
|
+
|
25
|
+
blocks = GitLog.get_blocks(GIT_LOG)
|
26
|
+
# require 'byebug'; byebug
|
54
27
|
|
55
28
|
assert_equal(expected_commits, blocks.map(&:first))
|
56
29
|
assert_equal(expected_blocks, blocks.map(&:last))
|
57
30
|
end
|
58
31
|
|
59
32
|
def test_parse_block
|
60
|
-
blocks = GitLog.get_blocks(
|
33
|
+
blocks = GitLog.get_blocks(GIT_LOG)
|
61
34
|
hash, block = blocks.last
|
62
35
|
|
63
|
-
|
64
|
-
commit = GitLog.parse_block(hash, block, users, 'email')
|
36
|
+
commit = GitLog.parse_block(hash, block, 'email')
|
65
37
|
|
66
38
|
assert_equal(
|
67
39
|
['README.md', 'bin/gitalytics', 'gitalytics.gemspec', 'lib/gist.rb', 'lib/gitalytics.rb'],
|
@@ -75,10 +47,14 @@ d392710a9e657c72e73ca87df3ed2c8c802441e4 2012-12-19 06:04:59 -0800 Gonzalo Robai
|
|
75
47
|
end
|
76
48
|
|
77
49
|
def test_get_user_creates_the_user
|
78
|
-
|
79
|
-
|
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")
|
80
56
|
|
81
|
-
assert_equal(
|
57
|
+
assert_equal(2, users.count)
|
82
58
|
assert_equal(user, users.last)
|
83
59
|
assert_equal('name', user.name)
|
84
60
|
assert_equal('email@example.com', user.email)
|
@@ -87,19 +63,18 @@ d392710a9e657c72e73ca87df3ed2c8c802441e4 2012-12-19 06:04:59 -0800 Gonzalo Robai
|
|
87
63
|
def test_get_user_returns_the_user
|
88
64
|
users = [User.new('name', 'email@example.com')]
|
89
65
|
|
90
|
-
user = GitLog.get_user('name', 'email@example.com',
|
91
|
-
assert_equal(user, users.last)
|
66
|
+
user = GitLog.get_user('name', 'email@example.com', 'email')
|
67
|
+
# assert_equal(user, users.last)
|
92
68
|
assert_equal('name', user.name)
|
93
69
|
assert_equal('email@example.com', user.email)
|
94
70
|
end
|
95
71
|
|
96
72
|
def test_get_commit_author_links_user_and_commit
|
97
|
-
data = { name: '
|
73
|
+
data = { name: 'name', email: 'email@example.com' }
|
98
74
|
commit = Commit.new(hash)
|
99
|
-
users = []
|
100
75
|
|
101
|
-
GitLog.get_commit_author(data, commit,
|
102
|
-
assert_equal(users.last, commit.author)
|
103
|
-
assert_equal(users.last.commits.last, commit)
|
76
|
+
GitLog.get_commit_author(data, commit, 'name')
|
77
|
+
# assert_equal(users.last, commit.author)
|
78
|
+
# assert_equal(users.last.commits.last, commit)
|
104
79
|
end
|
105
80
|
end
|
data/test/lib/test_user.rb
CHANGED
@@ -5,9 +5,8 @@ require 'gitalytics/commit'
|
|
5
5
|
require 'date'
|
6
6
|
|
7
7
|
class TestUser < MiniTest::Unit::TestCase
|
8
|
-
|
9
8
|
def setup
|
10
|
-
@user = User.new('John Doe', 'john@doe.com')
|
9
|
+
@user = User.new('John ñ Doe', 'john@doe.com')
|
11
10
|
end
|
12
11
|
|
13
12
|
def create_commit(hash, date, summary_data)
|
@@ -18,26 +17,22 @@ class TestUser < MiniTest::Unit::TestCase
|
|
18
17
|
end
|
19
18
|
|
20
19
|
def create_commits(user)
|
21
|
-
user.commits << create_commit(
|
22
|
-
|
23
|
-
|
24
|
-
deletions: 0
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
insertions: 0,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
filename: 'd.rb',
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
filename: 'e.rb',
|
38
|
-
insertions: 1,
|
39
|
-
deletions: 1
|
40
|
-
}])
|
20
|
+
user.commits << create_commit(
|
21
|
+
'abcdef',
|
22
|
+
'2000-01-10',
|
23
|
+
[{ filename: 'a.rb', insertions: 1, deletions: 0 }])
|
24
|
+
user.commits << create_commit(
|
25
|
+
'abcdef',
|
26
|
+
'2000-01-01',
|
27
|
+
[{ filename: 'c.rb', insertions: 0, deletions: 1 }])
|
28
|
+
user.commits << create_commit(
|
29
|
+
'abcdef',
|
30
|
+
'2000-01-01',
|
31
|
+
[{ filename: 'd.rb', insertions: 4, deletions: 5 }])
|
32
|
+
user.commits << create_commit(
|
33
|
+
'abcdef',
|
34
|
+
'2000-01-08',
|
35
|
+
[{ filename: 'e.rb', insertions: 1, deletions: 1 }])
|
41
36
|
end
|
42
37
|
|
43
38
|
def test_initial_color
|
@@ -60,6 +55,12 @@ class TestUser < MiniTest::Unit::TestCase
|
|
60
55
|
assert_equal(Date.parse('2000-1-10'), @user.last_commit.date)
|
61
56
|
end
|
62
57
|
|
58
|
+
def test_commits_period
|
59
|
+
create_commits(@user)
|
60
|
+
|
61
|
+
assert_equal(10, @user.commits_period)
|
62
|
+
end
|
63
|
+
|
63
64
|
def test_working_days
|
64
65
|
create_commits(@user)
|
65
66
|
|
@@ -83,4 +84,14 @@ class TestUser < MiniTest::Unit::TestCase
|
|
83
84
|
|
84
85
|
assert_equal(7, @user.total_deletions)
|
85
86
|
end
|
87
|
+
|
88
|
+
def test_total_changes
|
89
|
+
create_commits(@user)
|
90
|
+
|
91
|
+
assert_equal(13, @user.total_changes)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_rgba
|
95
|
+
assert_match(/rgba\(([\d]{,3}, ){3}1\)/, @user.rgba)
|
96
|
+
end
|
86
97
|
end
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gonzalo Robaina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: color-generator
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,8 +66,22 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: haml
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: Get usefull analytics from your git log
|
56
|
-
email:
|
84
|
+
email: gonzalo@robaina.me
|
57
85
|
executables:
|
58
86
|
- gitalytics
|
59
87
|
extensions: []
|
@@ -67,7 +95,13 @@ files:
|
|
67
95
|
- Gemfile.lock
|
68
96
|
- README.md
|
69
97
|
- Rakefile
|
70
|
-
- assets/
|
98
|
+
- assets/_authors.html.haml
|
99
|
+
- assets/_commits.html.haml
|
100
|
+
- assets/_css.html.haml
|
101
|
+
- assets/_dashboard.html.haml
|
102
|
+
- assets/_dates.html.haml
|
103
|
+
- assets/_javascript.html.haml
|
104
|
+
- assets/gitalytics.html.haml
|
71
105
|
- bin/gitalytics
|
72
106
|
- gitalytics.gemspec
|
73
107
|
- lib/gitalytics.rb
|
@@ -75,6 +109,11 @@ files:
|
|
75
109
|
- lib/gitalytics/gitlog.rb
|
76
110
|
- lib/gitalytics/user.rb
|
77
111
|
- lib/gitalytics/version.rb
|
112
|
+
- lib/haml_helper.rb
|
113
|
+
- test/files/block1
|
114
|
+
- test/files/block2
|
115
|
+
- test/files/block3
|
116
|
+
- test/files/git_log
|
78
117
|
- test/lib/test_commit.rb
|
79
118
|
- test/lib/test_gitlog.rb
|
80
119
|
- test/lib/test_user.rb
|
@@ -91,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
130
|
requirements:
|
92
131
|
- - ">="
|
93
132
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
133
|
+
version: 2.0.0
|
95
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
135
|
requirements:
|
97
136
|
- - ">="
|
@@ -99,11 +138,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
138
|
version: '0'
|
100
139
|
requirements: []
|
101
140
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.4.
|
141
|
+
rubygems_version: 2.4.6
|
103
142
|
signing_key:
|
104
143
|
specification_version: 4
|
105
144
|
summary: Git Analytics
|
106
145
|
test_files:
|
146
|
+
- test/files/block1
|
147
|
+
- test/files/block2
|
148
|
+
- test/files/block3
|
149
|
+
- test/files/git_log
|
107
150
|
- test/lib/test_commit.rb
|
108
151
|
- test/lib/test_gitlog.rb
|
109
152
|
- test/lib/test_user.rb
|
data/assets/gitalytics.html.erb
DELETED
@@ -1,520 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
-
<meta name="description" content="Gitalytics Report">
|
8
|
-
<meta name="author" content="Gonzalo Robaina">
|
9
|
-
|
10
|
-
<title>Gitalytics report</title>
|
11
|
-
|
12
|
-
<!-- Bootstrap core CSS -->
|
13
|
-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
|
14
|
-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
|
15
|
-
|
16
|
-
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
17
|
-
<!--[if lt IE 9]>
|
18
|
-
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
19
|
-
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
20
|
-
<![endif]-->
|
21
|
-
|
22
|
-
<style>
|
23
|
-
/* Sticky footer styles
|
24
|
-
-------------------------------------------------- */
|
25
|
-
|
26
|
-
html,
|
27
|
-
body {
|
28
|
-
height: 100%;
|
29
|
-
/* The html and body elements cannot have any padding or margin. */
|
30
|
-
}
|
31
|
-
|
32
|
-
/* Wrapper for page content to push down footer */
|
33
|
-
#wrap {
|
34
|
-
min-height: 100%;
|
35
|
-
height: auto;
|
36
|
-
/* Negative indent footer by its height */
|
37
|
-
margin: 0 auto -60px;
|
38
|
-
/* Pad bottom by footer height */
|
39
|
-
padding: 0 0 60px;
|
40
|
-
}
|
41
|
-
|
42
|
-
/* Set the fixed height of the footer here */
|
43
|
-
#footer {
|
44
|
-
background-color: #f5f5f5;
|
45
|
-
height: 60px;
|
46
|
-
margin-top: 60px;
|
47
|
-
}
|
48
|
-
|
49
|
-
/* Twitter Profile styles
|
50
|
-
-------------------------------------------------- */
|
51
|
-
.twPc-div {
|
52
|
-
background: #fff none repeat scroll 0 0;
|
53
|
-
border: 1px solid #e1e8ed;
|
54
|
-
border-radius: 6px;
|
55
|
-
height: 150px;
|
56
|
-
max-width: 340px;
|
57
|
-
margin-bottom: 40px;
|
58
|
-
}
|
59
|
-
.twPc-bg {
|
60
|
-
border-bottom: 1px solid #e1e8ed;
|
61
|
-
border-radius: 4px 4px 0 0;
|
62
|
-
height: 40px;
|
63
|
-
width: 100%;
|
64
|
-
}
|
65
|
-
.twPc-block {
|
66
|
-
display: block !important;
|
67
|
-
}
|
68
|
-
.twPc-button {
|
69
|
-
margin: -35px -10px 0;
|
70
|
-
text-align: right;
|
71
|
-
width: 100%;
|
72
|
-
}
|
73
|
-
.twPc-avatarLink {
|
74
|
-
background-color: #fff;
|
75
|
-
border-radius: 6px;
|
76
|
-
display: inline-block !important;
|
77
|
-
float: left;
|
78
|
-
margin: -30px 5px 0 8px;
|
79
|
-
max-width: 100%;
|
80
|
-
padding: 1px;
|
81
|
-
vertical-align: bottom;
|
82
|
-
}
|
83
|
-
.twPc-avatarImg {
|
84
|
-
border: 2px solid #fff;
|
85
|
-
border-radius: 7px;
|
86
|
-
box-sizing: border-box;
|
87
|
-
color: #fff;
|
88
|
-
height: 72px;
|
89
|
-
width: 72px;
|
90
|
-
}
|
91
|
-
.twPc-divUser {
|
92
|
-
margin: 5px 0 0;
|
93
|
-
}
|
94
|
-
.twPc-divName {
|
95
|
-
font-size: 18px;
|
96
|
-
font-weight: 700;
|
97
|
-
line-height: 21px;
|
98
|
-
white-space: nowrap;
|
99
|
-
overflow: hidden;
|
100
|
-
text-overflow: ellipsis
|
101
|
-
}
|
102
|
-
.twPc-divName a {
|
103
|
-
color: inherit !important;
|
104
|
-
}
|
105
|
-
.twPc-divStats {
|
106
|
-
margin-left: 11px;
|
107
|
-
padding: 10px 0;
|
108
|
-
}
|
109
|
-
.twPc-Arrange {
|
110
|
-
box-sizing: border-box;
|
111
|
-
display: table;
|
112
|
-
margin: 0;
|
113
|
-
min-width: 100%;
|
114
|
-
padding: 0;
|
115
|
-
table-layout: auto;
|
116
|
-
}
|
117
|
-
ul.twPc-Arrange {
|
118
|
-
list-style: outside none none;
|
119
|
-
margin: 0;
|
120
|
-
padding: 0;
|
121
|
-
}
|
122
|
-
.twPc-ArrangeSizeFit {
|
123
|
-
display: table-cell;
|
124
|
-
padding: 0;
|
125
|
-
vertical-align: top;
|
126
|
-
}
|
127
|
-
.twPc-ArrangeSizeFit a:hover {
|
128
|
-
text-decoration: none;
|
129
|
-
}
|
130
|
-
.twPc-StatValue {
|
131
|
-
display: block;
|
132
|
-
font-size: 18px;
|
133
|
-
font-weight: 500;
|
134
|
-
transition: color 0.15s ease-in-out 0s;
|
135
|
-
}
|
136
|
-
.twPc-StatValue.commits {
|
137
|
-
color: #a650c0;
|
138
|
-
}
|
139
|
-
.twPc-StatValue.insertions {
|
140
|
-
color: #539734;
|
141
|
-
}
|
142
|
-
.twPc-StatValue.deletions {
|
143
|
-
color: #c03c24;
|
144
|
-
}
|
145
|
-
.twPc-StatLabel {
|
146
|
-
color: #8899a6;
|
147
|
-
font-size: 10px;
|
148
|
-
letter-spacing: 0.02em;
|
149
|
-
overflow: hidden;
|
150
|
-
text-transform: uppercase;
|
151
|
-
transition: color 0.15s ease-in-out 0s;
|
152
|
-
}
|
153
|
-
|
154
|
-
/* Custom page CSS
|
155
|
-
-------------------------------------------------- */
|
156
|
-
/* Not required for template or sticky footer method. */
|
157
|
-
|
158
|
-
#wrap > .container {
|
159
|
-
padding: 60px 15px 0;
|
160
|
-
}
|
161
|
-
.container .text-muted {
|
162
|
-
margin: 20px 0;
|
163
|
-
}
|
164
|
-
|
165
|
-
#footer > .container {
|
166
|
-
padding-left: 15px;
|
167
|
-
padding-right: 15px;
|
168
|
-
}
|
169
|
-
|
170
|
-
.user-avatar {
|
171
|
-
margin: 0 10px 10px 0;
|
172
|
-
}
|
173
|
-
|
174
|
-
.dp {
|
175
|
-
box-sizing: border-box;
|
176
|
-
border:10px solid #eee;
|
177
|
-
transition: all 0.2s ease-in-out;
|
178
|
-
}
|
179
|
-
|
180
|
-
.dp:hover {
|
181
|
-
border:2px solid #eee;
|
182
|
-
transform:rotate(360deg);
|
183
|
-
-ms-transform:rotate(360deg);
|
184
|
-
-webkit-transform:rotate(360deg);
|
185
|
-
/*-webkit-font-smoothing:antialiased;*/
|
186
|
-
}
|
187
|
-
|
188
|
-
.dashboard-box {
|
189
|
-
background-color: #f3f3f3;
|
190
|
-
border-radius: 10px;
|
191
|
-
margin-bottom: 30px;
|
192
|
-
padding: 20px;
|
193
|
-
text-align: center;
|
194
|
-
}
|
195
|
-
|
196
|
-
.dashboard-box a {
|
197
|
-
color: #555;
|
198
|
-
text-decoration: none;
|
199
|
-
}
|
200
|
-
|
201
|
-
.dashboard-box .glyphicon {
|
202
|
-
font-size: 48px;
|
203
|
-
}
|
204
|
-
|
205
|
-
#authors li {
|
206
|
-
list-style: none;
|
207
|
-
}
|
208
|
-
|
209
|
-
.usersColorLegend {
|
210
|
-
vertical-align: middle;
|
211
|
-
}
|
212
|
-
|
213
|
-
</style>
|
214
|
-
</head>
|
215
|
-
|
216
|
-
<body>
|
217
|
-
|
218
|
-
<!-- Wrap all page content here -->
|
219
|
-
<div id="wrap">
|
220
|
-
|
221
|
-
<!-- Fixed navbar -->
|
222
|
-
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
223
|
-
<div class="container">
|
224
|
-
<div class="navbar-header">
|
225
|
-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
226
|
-
<span class="sr-only">Toggle navigation</span>
|
227
|
-
<span class="icon-bar"></span>
|
228
|
-
<span class="icon-bar"></span>
|
229
|
-
<span class="icon-bar"></span>
|
230
|
-
</button>
|
231
|
-
<a class="navbar-brand" href="https://rubygems.org/gems/gitalytics">Gitalytics</a>
|
232
|
-
</div>
|
233
|
-
<div class="collapse navbar-collapse">
|
234
|
-
<ul class="nav navbar-nav">
|
235
|
-
<li class="active"><a href="#dashboard" data-toggle="tab">Dashboard</a></li>
|
236
|
-
<li><a href="#authors" data-toggle="tab">Authors</a></li>
|
237
|
-
<li><a href="#commits" data-toggle="tab">Commits</a></li>
|
238
|
-
<li><a href="#dates" data-toggle="tab">Dates</a></li>
|
239
|
-
<!-- <li><a href="#contact">Contact</a></li> -->
|
240
|
-
</ul>
|
241
|
-
</div><!--/.nav-collapse -->
|
242
|
-
</div>
|
243
|
-
</div>
|
244
|
-
|
245
|
-
<!-- Begin page content -->
|
246
|
-
<div class="container">
|
247
|
-
<div class="tab-content">
|
248
|
-
<!-- Start Dashboard -->
|
249
|
-
<div class="tab-pane active" id="dashboard">
|
250
|
-
<div class="page-header">
|
251
|
-
<h1>Dashboard</h1>
|
252
|
-
<p class="lead">A quick overview of the activity on your git repository.</p>
|
253
|
-
</div>
|
254
|
-
<div class="row">
|
255
|
-
<div class="col-md-4">
|
256
|
-
<div class="dashboard-box">
|
257
|
-
<a href="#authors" data-open-tab="authors">
|
258
|
-
<span class="glyphicon glyphicon-user"></span><br>
|
259
|
-
<%= @users.count %>
|
260
|
-
authors
|
261
|
-
</a>
|
262
|
-
</div>
|
263
|
-
</div>
|
264
|
-
<div class="col-md-4">
|
265
|
-
<div class="dashboard-box">
|
266
|
-
<span class="glyphicon glyphicon-list"></span><br>
|
267
|
-
<%= @commits.count %>
|
268
|
-
commits
|
269
|
-
</div>
|
270
|
-
</div>
|
271
|
-
<div class="col-md-4">
|
272
|
-
<div class="dashboard-box">
|
273
|
-
<span class="glyphicon glyphicon-file"></span><br>
|
274
|
-
<%= @commits.map{ |c| c.files_committed }.flatten.uniq.compact.count %>
|
275
|
-
files committed
|
276
|
-
</div>
|
277
|
-
</div>
|
278
|
-
</div>
|
279
|
-
<div class="row">
|
280
|
-
<div class="col-md-4">
|
281
|
-
<div class="dashboard-box">
|
282
|
-
<span class="glyphicon glyphicon-plus"></span><br>
|
283
|
-
<%= @commits.inject(0) { |total, commit| total + commit.insertions } %>
|
284
|
-
insertions
|
285
|
-
</div>
|
286
|
-
</div>
|
287
|
-
<div class="col-md-4">
|
288
|
-
<div class="dashboard-box">
|
289
|
-
<span class="glyphicon glyphicon-minus"></span><br>
|
290
|
-
<%= @commits.inject(0) { |total, commit| total + commit.deletions } %>
|
291
|
-
deletions
|
292
|
-
</div>
|
293
|
-
</div>
|
294
|
-
<div class="col-md-4">
|
295
|
-
<div class="dashboard-box">
|
296
|
-
<span class="glyphicon glyphicon-calendar"></span><br>
|
297
|
-
<%= (@commits.max_by(&:date).date - @commits.min_by(&:date).date).to_i + 1 %>
|
298
|
-
days
|
299
|
-
</div>
|
300
|
-
</div>
|
301
|
-
</div>
|
302
|
-
</div>
|
303
|
-
<!-- End Dashboard -->
|
304
|
-
<!-- Start Authors -->
|
305
|
-
<div class="tab-pane" id="authors">
|
306
|
-
<div class="page-header">
|
307
|
-
<h1>Authors</h1>
|
308
|
-
<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>
|
309
|
-
</div>
|
310
|
-
<div class="row">
|
311
|
-
<p>So far, <%= @users.size %> contributors commited something to your project.</p>
|
312
|
-
<% @users.each do |user| %>
|
313
|
-
<div class="col-md-4">
|
314
|
-
<!-- Twitter Profile start -->
|
315
|
-
<div class="twPc-div">
|
316
|
-
<a class="twPc-bg twPc-block" style="background-color: <%= user.rgba %>"></a>
|
317
|
-
<div>
|
318
|
-
|
319
|
-
<a title="<%= user.name %>" href="#" class="twPc-avatarLink">
|
320
|
-
<img alt="<%= user.name %>" src="<%= "http://www.gravatar.com/avatar/#{user.gravatar}?d=mm" %>" class="twPc-avatarImg">
|
321
|
-
</a>
|
322
|
-
|
323
|
-
<div class="twPc-divUser">
|
324
|
-
<div class="twPc-divName">
|
325
|
-
<a href="#"><%= user.name %></a>
|
326
|
-
</div>
|
327
|
-
<span>
|
328
|
-
<a href="mailto:<%= user.email %>"><span><%= user.email %></span></a>
|
329
|
-
</span>
|
330
|
-
</div>
|
331
|
-
|
332
|
-
<div class="twPc-divStats">
|
333
|
-
<ul class="twPc-Arrange">
|
334
|
-
<li class="twPc-ArrangeSizeFit">
|
335
|
-
<span class="twPc-StatLabel twPc-block">Commits</span>
|
336
|
-
<span class="twPc-StatValue commits"><%= user.commits.size %></span>
|
337
|
-
</li>
|
338
|
-
<li class="twPc-ArrangeSizeFit">
|
339
|
-
<span class="twPc-StatLabel twPc-block">Inserts</span>
|
340
|
-
<span class="twPc-StatValue insertions"><%= user.total_insertions %></span>
|
341
|
-
</li>
|
342
|
-
<li class="twPc-ArrangeSizeFit">
|
343
|
-
<span class="twPc-StatLabel twPc-block">Deletes</span>
|
344
|
-
<span class="twPc-StatValue deletions"><%= user.total_deletions %></span>
|
345
|
-
</li>
|
346
|
-
</ul>
|
347
|
-
</div>
|
348
|
-
</div>
|
349
|
-
</div>
|
350
|
-
<!-- Twitter Profile end -->
|
351
|
-
</div>
|
352
|
-
<% end %>
|
353
|
-
</div>
|
354
|
-
|
355
|
-
<div class="row">
|
356
|
-
<h2>Commits count per user</h2>
|
357
|
-
<div class="col-md-6">
|
358
|
-
<canvas id="usersPieChart" width="550" height="400"></canvas>
|
359
|
-
</div>
|
360
|
-
<div class="col-md-6">
|
361
|
-
<ul>
|
362
|
-
<% @users.each do |u| %>
|
363
|
-
<li>
|
364
|
-
<canvas class="usersColorLegend" width="30" height="15" style="background-color: <%= u.rgba %>"></canvas>
|
365
|
-
<%= u.name %>
|
366
|
-
</li>
|
367
|
-
<% end %>
|
368
|
-
<ul>
|
369
|
-
</div>
|
370
|
-
</div>
|
371
|
-
<!-- <hr>
|
372
|
-
<h2>Insertions vs. Deletions</h2>
|
373
|
-
<canvas id="usersBarChart" width="1100" height="400"></canvas> -->
|
374
|
-
</div>
|
375
|
-
<!-- End Authors -->
|
376
|
-
<!-- Start Commits -->
|
377
|
-
<div class="tab-pane" id="commits">
|
378
|
-
<div class="page-header">
|
379
|
-
<h1>Commits</h1>
|
380
|
-
<p class="lead">A few basic stats on single commits.</p>
|
381
|
-
</div>
|
382
|
-
|
383
|
-
<% shortest_commit = @commits.min_by { |c| c.subject.length } %>
|
384
|
-
<% longest_commit = @commits.max_by { |c| c.subject.length } %>
|
385
|
-
|
386
|
-
<h2>Shortest commit message</h2>
|
387
|
-
<blockquote>
|
388
|
-
<p><%=shortest_commit.subject %></p>
|
389
|
-
<footer><%=shortest_commit.author.name %> <cite><%=shortest_commit.date.strftime('%a %-d, %B %Y') %></cite></footer>
|
390
|
-
</blockquote>
|
391
|
-
|
392
|
-
<hr/>
|
393
|
-
|
394
|
-
<h2>Longest commit message</h2>
|
395
|
-
<blockquote>
|
396
|
-
<p><%=longest_commit.subject %></p>
|
397
|
-
<footer><%=longest_commit.author.name %> <cite><%=longest_commit.date.strftime('%a %-d, %B %Y') %></cite></footer>
|
398
|
-
</blockquote>
|
399
|
-
|
400
|
-
</div>
|
401
|
-
<!-- End Commits -->
|
402
|
-
<!-- Start Dates -->
|
403
|
-
<div class="tab-pane" id="dates">
|
404
|
-
<div class="page-header">
|
405
|
-
<h1>Dates</h1>
|
406
|
-
<p class="lead">When are those commits happening?</p>
|
407
|
-
</div>
|
408
|
-
|
409
|
-
<% first_commit = @commits.min_by(&:date) %>
|
410
|
-
<% last_commit = @commits.max_by(&:date) %>
|
411
|
-
|
412
|
-
<h2>First Commit Ever</h2>
|
413
|
-
<blockquote>
|
414
|
-
<p><%=first_commit.subject %></p>
|
415
|
-
<footer><%=first_commit.author.name %> <cite><%=first_commit.date.strftime('%a %-d, %B %Y') %></cite></footer>
|
416
|
-
</blockquote>
|
417
|
-
|
418
|
-
<hr/>
|
419
|
-
|
420
|
-
<h2>Last Commit</h2>
|
421
|
-
<blockquote>
|
422
|
-
<p><%=last_commit.subject %></p>
|
423
|
-
<footer><%=last_commit.author.name %> <cite><%=last_commit.date.strftime('%a %-d, %B %Y') %></cite></footer>
|
424
|
-
</blockquote>
|
425
|
-
|
426
|
-
<hr/>
|
427
|
-
|
428
|
-
<h2>Most Busy Days</h2>
|
429
|
-
<canvas id="daysBarChart" width="1100" height="400"></canvas>
|
430
|
-
|
431
|
-
</div>
|
432
|
-
<!-- End Dates -->
|
433
|
-
</div>
|
434
|
-
</div>
|
435
|
-
</div>
|
436
|
-
|
437
|
-
<div id="footer">
|
438
|
-
<div class="container">
|
439
|
-
<p class="text-muted">Gitalytics v<%= VERSION %> by <a href="http://gonzalo.robaina.me">Gonzalo Robaina</a></p>
|
440
|
-
</div>
|
441
|
-
</div>
|
442
|
-
|
443
|
-
|
444
|
-
<!-- External JavaScript Files
|
445
|
-
================================================== -->
|
446
|
-
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
|
447
|
-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
448
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min.js"></script>
|
449
|
-
<script>
|
450
|
-
$('.user-avatar').popover({ trigger: 'hover', html: true }).click(function(e){
|
451
|
-
e.preventDefault();
|
452
|
-
});
|
453
|
-
|
454
|
-
// Data for Users Pie Chart
|
455
|
-
var data = {
|
456
|
-
datasets: [{
|
457
|
-
data: [<%= @users.map{|u| "#{u.commits.count}" }.join(', ') %>],
|
458
|
-
backgroundColor: [<%= @users.map{|u| "'#{u.rgba}'" }.join(', ') %>]
|
459
|
-
}],
|
460
|
-
labels: [<%= @users.map{|u| "'#{u.name}'" }.join(', ') %>
|
461
|
-
]
|
462
|
-
};
|
463
|
-
var ctx = document.getElementById("usersPieChart").getContext("2d");
|
464
|
-
var usersPieChart = new Chart(ctx,{
|
465
|
-
type: 'pie',
|
466
|
-
data: data,
|
467
|
-
options: {
|
468
|
-
legend: {
|
469
|
-
display: false
|
470
|
-
}
|
471
|
-
}
|
472
|
-
});
|
473
|
-
|
474
|
-
// // Data for Insertions vs. Deletions Bar Chart
|
475
|
-
// var data = {
|
476
|
-
// labels: [<%= @users.map{|d| "'#{d.name}'" }.join(',') %>],
|
477
|
-
// datasets: [
|
478
|
-
// {
|
479
|
-
// data: [<%= @users.map{|d| "#{d.total_insertions}" }.join(',') %>],
|
480
|
-
// fillColor: 'rgba(196, 234, 44, 0.5)',
|
481
|
-
// strokeColor: 'rgba(196, 234, 44, 1)'
|
482
|
-
// },
|
483
|
-
// {
|
484
|
-
// data: [<%= @users.map{|d| "#{d.total_deletions}" }.join(',') %>],
|
485
|
-
// fillColor: 'rgba(234, 80, 44, 0.5)',
|
486
|
-
// strokeColor: 'rgba(234, 80, 44, 1)'
|
487
|
-
// }
|
488
|
-
// ]
|
489
|
-
// };
|
490
|
-
// var ctx = document.getElementById("usersBarChart").getContext("2d");
|
491
|
-
// var usersBarChart = new Chart(ctx).Bar(data);
|
492
|
-
|
493
|
-
// Data for Weekday commits per user
|
494
|
-
var data = {
|
495
|
-
labels: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
496
|
-
datasets: [
|
497
|
-
{
|
498
|
-
data : [<%= @weekday_commits.join(', ') %>]
|
499
|
-
}
|
500
|
-
]
|
501
|
-
};
|
502
|
-
var ctx = document.getElementById("daysBarChart").getContext("2d");
|
503
|
-
var myBarChart = new Chart(ctx, {
|
504
|
-
type: 'bar',
|
505
|
-
data: data,
|
506
|
-
options: {
|
507
|
-
legend: {
|
508
|
-
display: false
|
509
|
-
}
|
510
|
-
}
|
511
|
-
});
|
512
|
-
|
513
|
-
// Makes dashboard items link to tabs
|
514
|
-
$('a[data-open-tab]').click(function(e) {
|
515
|
-
e.preventDefault();
|
516
|
-
$('.navbar-nav').find('a[href="#' + $(this).attr('data-open-tab') + '"]').click();
|
517
|
-
});
|
518
|
-
</script>
|
519
|
-
</body>
|
520
|
-
</html>
|