Skip to content

Commit 777a594

Browse files
committed
docs: update homebrew tap name from tools to git-analyzer
1 parent d0304cd commit 777a594

File tree

3 files changed

+68
-18
lines changed

3 files changed

+68
-18
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- 'v*'
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
build:
1013
name: Build and Release
@@ -16,34 +19,40 @@ jobs:
1619
target: x86_64-unknown-linux-gnu
1720
artifact_name: git-analyzer
1821
asset_name: git-analyzer-linux-x86_64
19-
- os: macos-latest
22+
- os: macos-13 # Intel macOS runner
2023
target: x86_64-apple-darwin
2124
artifact_name: git-analyzer
2225
asset_name: git-analyzer-macos-x86_64
23-
- os: macos-latest
26+
- os: macos-14 # Apple Silicon macOS runner
2427
target: aarch64-apple-darwin
2528
artifact_name: git-analyzer
2629
asset_name: git-analyzer-macos-aarch64
2730

2831
steps:
2932
- uses: actions/checkout@v4
3033

34+
- name: Install system dependencies (Ubuntu)
35+
if: matrix.os == 'ubuntu-latest'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libssl-dev pkg-config
39+
3140
- name: Install Rust
3241
uses: dtolnay/rust-toolchain@stable
3342
with:
3443
targets: ${{ matrix.target }}
3544

36-
- name: Build
37-
run: cargo build --release --target ${{ matrix.target }}
45+
- name: Build (native compilation)
46+
run: cargo build --release
3847

3948
- name: Strip binary (Linux and macOS)
4049
if: matrix.os != 'windows-latest'
41-
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
50+
run: strip target/release/${{ matrix.artifact_name }}
4251

4352
- name: Create tarball
4453
run: |
45-
cd target/${{ matrix.target }}/release
46-
tar czf ../../../${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
54+
cd target/release
55+
tar czf ../../${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
4756
4857
- name: Upload Release Asset
4958
uses: softprops/action-gh-release@v1

HOMEBREW_SETUP.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ Create your own Homebrew tap:
7373
```bash
7474
# Create a new repository for your tap
7575
# Repository name MUST be homebrew-<tap-name>
76-
# Example: homebrew-tools
76+
# Example: homebrew-git-analyzer
7777

7878
# Clone your tap repository
79-
git clone https://github.com/alexfilatov/homebrew-tools.git
80-
cd homebrew-tools
79+
git clone https://github.com/alexfilatov/homebrew-git-analyzer.git
80+
cd homebrew-git-analyzer
8181

8282
# Copy the formula
8383
cp ../git-analyzer/Formula/git-analyzer.rb Formula/
@@ -90,7 +90,7 @@ git push origin main
9090

9191
Users can then install with:
9292
```bash
93-
brew tap alexfilatov/tools
93+
brew tap alexfilatov/git-analyzer
9494
brew install git-analyzer
9595
```
9696

@@ -106,7 +106,7 @@ For inclusion in the main Homebrew repository:
106106

107107
```bash
108108
# Test installation from your tap
109-
brew tap alexfilatov/tools
109+
brew tap alexfilatov/git-analyzer
110110
brew install git-analyzer
111111

112112
# Test the binary
@@ -115,7 +115,7 @@ git-analyzer contributors --url https://github.com/octocat/Hello-World.git
115115

116116
# Test uninstallation
117117
brew uninstall git-analyzer
118-
brew untap alexfilatov/tools
118+
brew untap alexfilatov/git-analyzer
119119
```
120120

121121
## 📁 Final Repository Structure
@@ -214,6 +214,6 @@ end
214214

215215
**🎉 Once set up, users can install your tool with just:**
216216
```bash
217-
brew tap alexfilatov/tools
217+
brew tap alexfilatov/git-analyzer
218218
brew install git-analyzer
219219
```

src/main.rs

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,56 @@ fn analyze_activity(repo_path: &PathBuf, json_output: bool) -> Result<()> {
360360
}
361361

362362
println!("\n📊 Commit Activity by Hour:");
363-
for hour in 0..24 {
364-
let count = hourly_commits.get(&hour).unwrap_or(&0);
365-
println!("{:02}:00 - {:02}:59: {} commits", hour, hour, count);
366-
}
363+
display_hourly_chart(&hourly_commits);
367364
}
368365

369366
Ok(())
370367
}
371368

369+
fn display_hourly_chart(hourly_commits: &HashMap<u8, u32>) {
370+
let max_commits = hourly_commits.values().max().unwrap_or(&0);
371+
let max_bar_width = 50; // Maximum width of the bar chart
372+
373+
for hour in 0..24 {
374+
let count = hourly_commits.get(&hour).unwrap_or(&0);
375+
let bar_width = if *max_commits > 0 {
376+
((count * max_bar_width) / max_commits).max(if *count > 0 { 1 } else { 0 })
377+
} else {
378+
0
379+
};
380+
381+
let bar = "█".repeat(bar_width as usize);
382+
let empty_bar = "░".repeat((max_bar_width - bar_width) as usize);
383+
384+
// Add time period indicators
385+
let period_indicator = match hour {
386+
0..=5 => "🌙", // Night
387+
6..=8 => "🌅", // Early morning
388+
9..=17 => "☀️", // Day/Work hours
389+
18..=21 => "🌆", // Evening
390+
_ => "🌙", // Late night
391+
};
392+
393+
println!("{} {:02}:00-{:02}:59 │{}{} {} commits",
394+
period_indicator,
395+
hour,
396+
(hour + 1) % 24,
397+
bar,
398+
empty_bar,
399+
count
400+
);
401+
}
402+
403+
println!("\nLegend: 🌙 Night 🌅 Morning ☀️ Day 🌆 Evening");
404+
println!("Scale: Each █ represents {} commit(s)",
405+
if *max_commits > max_bar_width {
406+
(*max_commits as f32 / max_bar_width as f32).ceil() as u32
407+
} else {
408+
1
409+
}
410+
);
411+
}
412+
372413
fn collect_activity_data(repo: &Repository) -> Result<(HashMap<String, u32>, HashMap<u8, u32>)> {
373414
let mut monthly_commits: HashMap<String, u32> = HashMap::new();
374415
let mut hourly_commits: HashMap<u8, u32> = HashMap::new();

0 commit comments

Comments
 (0)