branch_base 0.1.2 → 0.1.3
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/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 +1 -1
- 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: 2e8975df88b472de6656de7de0d8e12f001d75199ac700cda2f5ad000ee77195
|
4
|
+
data.tar.gz: 9c5eb74b754b008a63a212fb2c0a383dc47706d8e086a797d96520b8bf917e2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48fc53438c183e89d834dc29570b69acde47b100cadcc007a8726c348d26f2e7823ccbb542bc296e9dd6324903c6dea3efc548524306d5321088d4ddc416f715
|
7
|
+
data.tar.gz: c198e8cff780a0758dfff5e97dfb87eb73cd60b40e105d80d83416c3359052584002c4c17ac88a640eb8b2d54c6d06cd9771d267f4fd4bd05bb86a80b0d4fa5c
|
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
|
-

|
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
|
-

|
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,7 +57,7 @@ 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
|
-
erb_template = File.read("./internal/template.html.erb")
|
60
|
+
erb_template = File.read("./lib/internal/template.html.erb")
|
61
61
|
erb = ERB.new(erb_template)
|
62
62
|
generated_html = erb.result(binding)
|
63
63
|
|
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.3
|
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
|