branch_base 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +17 -15
- data/assets/git-wrapped.png +0 -0
- data/assets/screenshot.png +0 -0
- data/lib/branch_base/cli.rb +4 -2
- data/lib/branch_base/version.rb +1 -1
- data/lib/branch_base.rb +37 -43
- data/{internal → lib/internal}/template.html.erb +23 -8
- metadata +4 -5
- data/internal/git-wrapped.png +0 -0
- data/internal/screenshot.jpg +0 -0
- data/internal/screenshot.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc2fd31ad2a015dc7193e8969d004ab5b47a4de51bb6b070affaf06a53a9ccfc
|
4
|
+
data.tar.gz: 38390be061f730fd42260dbd469bd13d2c00a1f76a4034c0503c1f2def4b8730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65d38708fa5b79e534cb46b7c3c49215bc926a4e6113d78e2b06ec80a232c7087377a947362a27cb76e09423e026ee4c00dbef4140dccb8b2d72ceade09e1f0c
|
7
|
+
data.tar.gz: 429969c6cabff024eec2dc804bdec41956bddfab2f4c1c497a0a2d17e92d115f1239bb3376709911083bf3157e9af042b018a6f72fc055d8336899d4acf2a898
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
You can now easily run, any kind of analytics on your Git directory using the SQLite database.
|
9
9
|
|
10
|
-
![](./
|
10
|
+
![](./assets/screenshot.png)
|
11
11
|
|
12
12
|
## Features ✨
|
13
13
|
|
@@ -35,7 +35,7 @@ $ branch_base git-wrapped ~/src/rails
|
|
35
35
|
2023-12-03 11:40:53 -0500: INFO - BranchBase: Git wrapped HTML stored in /Users/shayon/src/rails/git-wrapped.html
|
36
36
|
```
|
37
37
|
|
38
|
-
![](./
|
38
|
+
![](./assets/git-wrapped.png)
|
39
39
|
|
40
40
|
## Example SQL Queries 📊
|
41
41
|
|
@@ -123,23 +123,25 @@ This command will create a SQLite database with the repository's data in the pat
|
|
123
123
|
The SQLite database of the follow tables:
|
124
124
|
|
125
125
|
```
|
126
|
-
repositories
|
126
|
+
repositories ──────────────────────┬───────────────── files
|
127
|
+
│ │
|
128
|
+
├─ commits ────── commit_files ──┘
|
129
|
+
│ │
|
130
|
+
│ ├─ branch_commits ── branches
|
131
|
+
│ │
|
132
|
+
│ └─ commit_parents
|
127
133
|
│
|
128
|
-
└─
|
129
|
-
│ │ │
|
130
|
-
├─ branches ───────┘ │
|
131
|
-
│ │
|
132
|
-
└─ commit_parents ────────────────┘
|
134
|
+
└─ files (via latest_commit in commits)
|
133
135
|
```
|
134
136
|
|
135
|
-
|
137
|
+
In this schema:
|
136
138
|
|
137
|
-
- `repositories
|
138
|
-
- `commits
|
139
|
-
- `
|
140
|
-
- `
|
141
|
-
- `
|
142
|
-
- `
|
139
|
+
- `repositories` has direct relationships with `commits` and `files` via `repo_id`
|
140
|
+
- `commits` is central, connecting to `commit_files`, `branch_commits`, and `commit_parents`, via `commit_hash`
|
141
|
+
- `commit_files` provides a link between `commits` and `files`.
|
142
|
+
- `branch_commits` joins `branches` with `commits`, via `branch_id` and `commit_hash`
|
143
|
+
- `branches` are linked back to `repositories`.
|
144
|
+
- `files` also connects back to `commits` through the `latest_commit`.
|
143
145
|
|
144
146
|
## Contributing 🤝
|
145
147
|
|
Binary file
|
Binary file
|
data/lib/branch_base/cli.rb
CHANGED
@@ -57,8 +57,10 @@ module BranchBase
|
|
57
57
|
File.write(json_full_path, JSON.pretty_generate(@results))
|
58
58
|
BranchBase.logger.info("Git wrapped JSON stored in #{json_full_path}")
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
gem_root = Gem::Specification.find_by_name("branch_base").gem_dir
|
61
|
+
template_file_path =
|
62
|
+
File.join(gem_root, "lib", "internal", "template.html.erb")
|
63
|
+
erb = ERB.new(File.read(template_file_path))
|
62
64
|
generated_html = erb.result(binding)
|
63
65
|
|
64
66
|
html_full_path = "#{full_repo_path}/git-wrapped.html"
|
data/lib/branch_base/version.rb
CHANGED
data/lib/branch_base.rb
CHANGED
@@ -29,57 +29,51 @@ module BranchBase
|
|
29
29
|
queries = {
|
30
30
|
"top_contributors_of_the_year" =>
|
31
31
|
"SELECT author, COUNT(*) AS commit_count
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
",
|
32
|
+
FROM commits
|
33
|
+
WHERE substr(commits.timestamp, 1, 4) = '2023'
|
34
|
+
GROUP BY author
|
35
|
+
ORDER BY commit_count DESC
|
36
|
+
LIMIT 10;",
|
38
37
|
"commits_per_day_of_the_week" =>
|
39
38
|
"SELECT
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
",
|
39
|
+
CASE strftime('%w', substr(timestamp, 1, 10))
|
40
|
+
WHEN '0' THEN 'Sunday'
|
41
|
+
WHEN '1' THEN 'Monday'
|
42
|
+
WHEN '2' THEN 'Tuesday'
|
43
|
+
WHEN '3' THEN 'Wednesday'
|
44
|
+
WHEN '4' THEN 'Thursday'
|
45
|
+
WHEN '5' THEN 'Friday'
|
46
|
+
WHEN '6' THEN 'Saturday'
|
47
|
+
END as day_of_week,
|
48
|
+
COUNT(*) as commit_count
|
49
|
+
FROM commits
|
50
|
+
WHERE substr(timestamp, 1, 4) = '2023'
|
51
|
+
GROUP BY day_of_week
|
52
|
+
ORDER BY commit_count DESC;",
|
55
53
|
"most_active_months" =>
|
56
54
|
"SELECT substr(commits.timestamp, 1, 7) AS month, COUNT(*) AS commit_count
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
",
|
55
|
+
FROM commits
|
56
|
+
WHERE substr(commits.timestamp, 1, 4) = '2023'
|
57
|
+
GROUP BY month
|
58
|
+
ORDER BY commit_count DESC
|
59
|
+
LIMIT 12;",
|
63
60
|
"commits_with_most_significant_number_of_changes" =>
|
64
61
|
"SELECT commits.commit_hash, COUNT(commit_files.file_id) AS files_changed
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
",
|
62
|
+
FROM commits
|
63
|
+
JOIN commit_files ON commits.commit_hash = commit_files.commit_hash
|
64
|
+
WHERE substr(commits.timestamp, 1, 4) = '2023'
|
65
|
+
GROUP BY commits.commit_hash
|
66
|
+
ORDER BY files_changed DESC
|
67
|
+
LIMIT 10;",
|
72
68
|
"most_edited_files" =>
|
73
69
|
"SELECT files.file_path, COUNT(*) AS edit_count
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
;
|
82
|
-
",
|
70
|
+
FROM commit_files
|
71
|
+
JOIN files ON commit_files.file_id = files.file_id
|
72
|
+
JOIN commits ON commit_files.commit_hash = commits.commit_hash
|
73
|
+
WHERE substr(commits.timestamp, 1, 4) = '2023'
|
74
|
+
GROUP BY files.file_path
|
75
|
+
ORDER BY edit_count DESC
|
76
|
+
LIMIT 10;",
|
83
77
|
}
|
84
78
|
|
85
79
|
queries.transform_values { |query| database.execute(query) }
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="UTF-8" />
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
-
<title>Git Wrapped Statistics - <%= @repo_name.capitalize
|
6
|
+
<title>Git Wrapped Statistics - <%= @repo_name.capitalize %></title>
|
7
7
|
<style>
|
8
8
|
body {
|
9
9
|
font-family: "Fira Code", monospace;
|
10
|
-
background-color: #
|
10
|
+
background-color: #0c0a00;
|
11
11
|
color: #c1c1c1;
|
12
12
|
margin: 0;
|
13
13
|
padding: 0;
|
@@ -15,7 +15,7 @@
|
|
15
15
|
}
|
16
16
|
|
17
17
|
header {
|
18
|
-
background-color: #
|
18
|
+
background-color: #0c0a00;
|
19
19
|
color: #fff;
|
20
20
|
text-align: center;
|
21
21
|
padding: 20px;
|
@@ -28,9 +28,9 @@
|
|
28
28
|
}
|
29
29
|
|
30
30
|
.container {
|
31
|
-
max-width:
|
31
|
+
max-width: 1250px;
|
32
32
|
margin: 20px auto;
|
33
|
-
background-color: #
|
33
|
+
background-color: #0c0a00;
|
34
34
|
border-radius: 10px;
|
35
35
|
overflow: hidden;
|
36
36
|
display: grid;
|
@@ -50,13 +50,28 @@
|
|
50
50
|
}
|
51
51
|
|
52
52
|
ul {
|
53
|
-
/* list-style: none; */
|
54
53
|
padding: 0;
|
54
|
+
margin-left: 10px;
|
55
55
|
}
|
56
56
|
|
57
57
|
li {
|
58
58
|
margin-bottom: 10px;
|
59
59
|
font-size: 18px;
|
60
|
+
color: #fff;
|
61
|
+
padding-left: 10px;
|
62
|
+
position: relative;
|
63
|
+
transition: all 0.3s ease;
|
64
|
+
text-wrap: wrap;
|
65
|
+
}
|
66
|
+
|
67
|
+
li:hover {
|
68
|
+
transform: translateX(5px);
|
69
|
+
color: #DF826C;
|
70
|
+
}
|
71
|
+
|
72
|
+
.highlight {
|
73
|
+
font-weight: bold;
|
74
|
+
color: #DF826C;
|
60
75
|
}
|
61
76
|
</style>
|
62
77
|
<link
|
@@ -66,7 +81,7 @@
|
|
66
81
|
</head>
|
67
82
|
<body>
|
68
83
|
<header>
|
69
|
-
<h1>Git Wrapped
|
84
|
+
<h1>Git Wrapped - <%= @repo_name.capitalize %></h1>
|
70
85
|
</header>
|
71
86
|
<div class="container">
|
72
87
|
<% @results.each do |key, values| %>
|
@@ -74,7 +89,7 @@
|
|
74
89
|
<h2><%= @emojis[key] %> <%= key.gsub('_', ' ').split.map(&:capitalize).join(' ') %></h2>
|
75
90
|
<ul>
|
76
91
|
<% values.each do |item| %>
|
77
|
-
<li><%= item[0]
|
92
|
+
<li><span class="highlight"><%= item[0] %></span>: <%= item[1] %><%= item[2].nil? ? "" : "(#{item[2]})"%></li>
|
78
93
|
<% end %>
|
79
94
|
</ul>
|
80
95
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: branch_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shayon Mukherjee
|
@@ -255,17 +255,16 @@ files:
|
|
255
255
|
- LICENSE.txt
|
256
256
|
- README.md
|
257
257
|
- Rakefile
|
258
|
+
- assets/git-wrapped.png
|
259
|
+
- assets/screenshot.png
|
258
260
|
- branch_base.gemspec
|
259
|
-
- internal/git-wrapped.png
|
260
|
-
- internal/screenshot.jpg
|
261
|
-
- internal/screenshot.png
|
262
|
-
- internal/template.html.erb
|
263
261
|
- lib/branch_base.rb
|
264
262
|
- lib/branch_base/cli.rb
|
265
263
|
- lib/branch_base/database.rb
|
266
264
|
- lib/branch_base/repository.rb
|
267
265
|
- lib/branch_base/sync.rb
|
268
266
|
- lib/branch_base/version.rb
|
267
|
+
- lib/internal/template.html.erb
|
269
268
|
- package.json
|
270
269
|
- scripts/branch_base
|
271
270
|
- scripts/release_branch_base.sh
|
data/internal/git-wrapped.png
DELETED
Binary file
|
data/internal/screenshot.jpg
DELETED
Binary file
|
data/internal/screenshot.png
DELETED
Binary file
|