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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2471c7a229d7e1331755a315df23e8c6b5593b07c90121e241aa8eed21ef64d
4
- data.tar.gz: a90207e0507186e6d69a856ac174bcfd689bda0340af60f3f7bad741a44f15a5
3
+ metadata.gz: 2e8975df88b472de6656de7de0d8e12f001d75199ac700cda2f5ad000ee77195
4
+ data.tar.gz: 9c5eb74b754b008a63a212fb2c0a383dc47706d8e086a797d96520b8bf917e2e
5
5
  SHA512:
6
- metadata.gz: c0c35367d3aee1e3c25140c8e9ccca2c553f19f22a1aa613dc308fa096dce43b8cdc2dcb3bb281914faa21e4d93af522f3914dd6ecc8c75106adcbb78fd00226
7
- data.tar.gz: cc652482ee17f5e2714f841ef6383c07ed84ec25f4cefc6e30d8a9dc0f52d4cab3567223c59331857126a34ab6ae6adeff6b9786624600f14efc79698a82dd08
6
+ metadata.gz: 48fc53438c183e89d834dc29570b69acde47b100cadcc007a8726c348d26f2e7823ccbb542bc296e9dd6324903c6dea3efc548524306d5321088d4ddc416f715
7
+ data.tar.gz: c198e8cff780a0758dfff5e97dfb87eb73cd60b40e105d80d83416c3359052584002c4c17ac88a640eb8b2d54c6d06cd9771d267f4fd4bd05bb86a80b0d4fa5c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- branch_base (0.1.2)
4
+ branch_base (0.1.3)
5
5
  rugged
6
6
  sqlite3
7
7
  thor (~> 1.0)
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
- ![](./internal/screenshot.png)
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
- ![](./internal/git-wrapped.png)
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
- └─ commits ───── commit_files ── files
129
- │ │ │
130
- ├─ branches ───────┘ │
131
- │ │
132
- └─ commit_parents ────────────────┘
134
+ └─ files (via latest_commit in commits)
133
135
  ```
134
136
 
135
- **Table Descriptions**:
137
+ In this schema:
136
138
 
137
- - `repositories`: Contains details about the repositories.
138
- - `commits`: Stores individual commits. Each commit is linked to a repository.
139
- - `branches`: Branch information linked to their latest commits.
140
- - `files`: Information about files changed in commits. We don't store file contents.
141
- - `commit_files`: Associates commits with files, including changes.
142
- - `commit_parents`: Tracks parent-child relationships between commits.
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
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BranchBase
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
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
- FROM commits
33
- WHERE substr(commits.timestamp, 1, 4) = '2023'
34
- GROUP BY author
35
- ORDER BY commit_count DESC
36
- LIMIT 10;
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
- CASE strftime('%w', substr(timestamp, 1, 10))
41
- WHEN '0' THEN 'Sunday'
42
- WHEN '1' THEN 'Monday'
43
- WHEN '2' THEN 'Tuesday'
44
- WHEN '3' THEN 'Wednesday'
45
- WHEN '4' THEN 'Thursday'
46
- WHEN '5' THEN 'Friday'
47
- WHEN '6' THEN 'Saturday'
48
- END as day_of_week,
49
- COUNT(*) as commit_count
50
- FROM commits
51
- WHERE substr(timestamp, 1, 4) = '2023'
52
- GROUP BY day_of_week
53
- ORDER BY commit_count DESC;
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
- FROM commits
58
- WHERE substr(commits.timestamp, 1, 4) = '2023'
59
- GROUP BY month
60
- ORDER BY commit_count DESC
61
- LIMIT 12;
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
- FROM commits
66
- JOIN commit_files ON commits.commit_hash = commit_files.commit_hash
67
- WHERE substr(commits.timestamp, 1, 4) = '2023'
68
- GROUP BY commits.commit_hash
69
- ORDER BY files_changed DESC
70
- LIMIT 10;
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
- FROM commit_files
75
- JOIN files ON commit_files.file_id = files.file_id
76
- JOIN commits ON commit_files.commit_hash = commits.commit_hash
77
- WHERE substr(commits.timestamp, 1, 4) = '2023'
78
- GROUP BY files.file_path
79
- ORDER BY edit_count DESC
80
- LIMIT 10;
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 %> </title>
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: #0C0A00;
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: #0C0A00;
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: 1200px;
31
+ max-width: 1250px;
32
32
  margin: 20px auto;
33
- background-color: #0C0A00;
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 Statistics - <%= @repo_name.capitalize %></h1>
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] %>: <%= item[1] %><%= item[2].nil? ? "" : "(#{item[2]})"%></li>
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.2
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
Binary file
Binary file
Binary file