fortrangoingonforty/fortress / 33e7109

Browse files

Add packaging for AUR, Homebrew, and RPM

- Add fortress.rb Homebrew formula with shell integration
- Add fortress.spec RPM spec file for repos.musicsian.com
- Add build-rpm.sh and deploy-to-repo.sh scripts
- Update PKGBUILD and .SRCINFO with release checksums
- Add comprehensive DEPLOYMENT.md guide
- Add Makefile.packaging for convenience commands

All three package formats now ready for v0.1.0 release!
Authored by espadonne
SHA
33e7109db81b22d8d0a1ff3d855f4ef31263f5ed
Parents
a9e28cc
Tree
d46a378

9 changed files

StatusFile+-
M .SRCINFO 1 1
A DEPLOYMENT.md 275 0
A Makefile.packaging 62 0
A PACKAGING_SUMMARY.md 111 0
M PKGBUILD 1 1
A build-rpm.sh 50 0
A deploy-to-repo.sh 47 0
A fortress.rb 71 0
A fortress.spec 111 0
.SRCINFOmodified
@@ -12,6 +12,6 @@ pkgbase = fortress
1212
 	depends = glibc
1313
 	depends = gcc-libs
1414
 	source = fortress-0.1.0.tar.gz::https://github.com/FortranGoingOnForty/fortress/archive/v0.1.0.tar.gz
15
-	sha256sums = SKIP
15
+	sha256sums = e38b495296e87f7bee7140ed662a37ee23f2f428e459b9c455f846f856014d4e
1616
 
1717
 pkgname = fortress
DEPLOYMENT.mdadded
@@ -0,0 +1,275 @@
1
+# Fortress Deployment Guide
2
+
3
+This guide covers deploying fortress to AUR, Homebrew, and repos.musicsian.com.
4
+
5
+## Prerequisites
6
+
7
+### For RPM builds
8
+- `rpmbuild` (install via `dnf install rpm-build`)
9
+- `fpm` (Fortran Package Manager) - install via `cargo install fpm`
10
+- `createrepo_c` (for repository metadata)
11
+- GPG key configured for signing
12
+
13
+### For AUR
14
+- AUR account with SSH key configured
15
+- `makepkg` (part of Arch Linux base-devel)
16
+- `updpkgsums` (to update checksums)
17
+
18
+### For Homebrew
19
+- Homebrew tap repository (or PR to homebrew-core)
20
+- Access to create GitHub releases
21
+
22
+## 1. AUR Deployment
23
+
24
+The AUR package is already configured in this repository.
25
+
26
+### Initial Setup (One-time)
27
+
28
+```bash
29
+# Clone your AUR repository
30
+git clone ssh://aur@aur.archlinux.org/fortress.git fortress-aur
31
+cd fortress-aur
32
+
33
+# Copy files from fortress repo
34
+cp /path/to/fortress/{PKGBUILD,.SRCINFO,fortress.install} .
35
+```
36
+
37
+### Deploying Updates
38
+
39
+```bash
40
+cd fortress-aur
41
+
42
+# Update version in PKGBUILD
43
+vim PKGBUILD  # Update pkgver and pkgrel
44
+
45
+# Generate checksums
46
+updpkgsums
47
+
48
+# Generate .SRCINFO
49
+makepkg --printsrcinfo > .SRCINFO
50
+
51
+# Test build locally
52
+makepkg -si
53
+
54
+# Push to AUR
55
+git add PKGBUILD .SRCINFO fortress.install
56
+git commit -m "Update fortress to version X.Y.Z"
57
+git push
58
+```
59
+
60
+**Notes:**
61
+- Shell integration is automatic for bash and fish
62
+- Zsh users need to manually source `/usr/share/fortress/fortress.sh`
63
+- The `fortress.install` file shows post-install messages to users
64
+
65
+## 2. Homebrew Deployment
66
+
67
+Homebrew formulas can be deployed via a tap or submitted to homebrew-core.
68
+
69
+### Option A: Personal Tap (Easier)
70
+
71
+```bash
72
+# Create a tap repository (first time only)
73
+# Repository name must be: homebrew-<tapname>
74
+# Example: homebrew-fortran
75
+
76
+git clone https://github.com/yourusername/homebrew-fortran
77
+cd homebrew-fortran
78
+
79
+# Copy the formula
80
+cp /path/to/fortress/fortress.rb Formula/
81
+
82
+# Create a GitHub release first with the tarball
83
+# Update the sha256 in fortress.rb:
84
+shasum -a 256 fortress-0.1.0.tar.gz
85
+
86
+# Commit and push
87
+git add Formula/fortress.rb
88
+git commit -m "Add fortress 0.1.0"
89
+git push
90
+
91
+# Users install with:
92
+# brew tap yourusername/fortran
93
+# brew install fortress
94
+```
95
+
96
+### Option B: Submit to homebrew-core (Official)
97
+
98
+1. Fork https://github.com/Homebrew/homebrew-core
99
+2. Add `fortress.rb` to `Formula/`
100
+3. Submit a PR following Homebrew guidelines
101
+4. Wait for review and approval
102
+
103
+**Notes:**
104
+- Homebrew **cannot** automatically modify user dotfiles
105
+- Users must manually source the shell integration files
106
+- The caveats block provides clear installation instructions
107
+- Shell integration files are installed to `#{HOMEBREW_PREFIX}/share/fortress/`
108
+
109
+### Updating the Formula
110
+
111
+```bash
112
+# Update version and sha256
113
+vim Formula/fortress.rb
114
+
115
+# Test locally
116
+brew install --build-from-source ./Formula/fortress.rb
117
+brew test fortress
118
+brew audit --strict fortress
119
+
120
+# Commit and push
121
+git add Formula/fortress.rb
122
+git commit -m "fortress 0.2.0"
123
+git push
124
+```
125
+
126
+## 3. RPM Repository (repos.musicsian.com)
127
+
128
+### Build the RPM
129
+
130
+```bash
131
+cd /home/espadon/src/fortress
132
+
133
+# Ensure fpm is installed
134
+cargo install fpm  # If not already installed
135
+
136
+# Build the RPM
137
+./build-rpm.sh
138
+```
139
+
140
+This script will:
141
+1. Create a source tarball
142
+2. Build the RPM using rpmbuild
143
+3. Output RPMs to `~/rpmbuild/RPMS/`
144
+
145
+### Deploy to Repository
146
+
147
+```bash
148
+cd /home/espadon/src/fortress
149
+
150
+# Copy RPM to repo and prepare deployment
151
+./deploy-to-repo.sh
152
+
153
+# Change to repo directory
154
+cd ~/src/repos-musicsian-com
155
+
156
+# Add and commit
157
+git add RPMS/fortress-*.rpm fortress.repo
158
+git commit -m "Add fortress 0.1.0-1"
159
+git push
160
+
161
+# Deploy to server (signs RPMs, creates metadata, updates site)
162
+./deploy.sh
163
+```
164
+
165
+The `deploy.sh` script will:
166
+1. Stage files to a timestamped build directory
167
+2. Sign all RPM packages with GPG
168
+3. Generate repository metadata with createrepo_c
169
+4. Sign repository metadata
170
+5. Deploy to `/var/www/repos.musicsian.com/releases/`
171
+6. Update the `current` symlink
172
+7. Reload nginx
173
+8. Test the deployment
174
+
175
+### User Installation
176
+
177
+Users can install from your repo with:
178
+
179
+```bash
180
+# Add the repository
181
+sudo curl -o /etc/yum.repos.d/fortress.repo https://repos.musicsian.com/fortress.repo
182
+
183
+# Install fortress
184
+sudo dnf install fortress
185
+
186
+# The shell integration is automatic for bash and fish
187
+# Zsh users need to add to ~/.zshrc:
188
+source /usr/share/fortress/fortress.sh
189
+```
190
+
191
+## Shell Integration Comparison
192
+
193
+| Package Manager | Bash | Fish | Zsh |
194
+|----------------|------|------|-----|
195
+| AUR | ✅ Auto | ✅ Auto | ⚠️ Manual |
196
+| Homebrew | ⚠️ Manual | ⚠️ Manual | ⚠️ Manual |
197
+| RPM | ✅ Auto | ✅ Auto | ⚠️ Manual |
198
+
199
+**Auto**: Shell integration is automatically set up during installation
200
+**Manual**: User must manually source the integration file
201
+
202
+## Version Bumping Checklist
203
+
204
+When releasing a new version:
205
+
206
+- [ ] Update version in `fpm.toml`
207
+- [ ] Update version in `fortress.spec` (RPM)
208
+- [ ] Update version in `PKGBUILD` (AUR)
209
+- [ ] Update version in `fortress.rb` (Homebrew)
210
+- [ ] Create GitHub release with tarball
211
+- [ ] Update SHA256 checksums:
212
+  - [ ] `updpkgsums` for AUR
213
+  - [ ] Manual update in Homebrew formula
214
+- [ ] Update changelog in `fortress.spec`
215
+- [ ] Test build on all platforms
216
+- [ ] Deploy in order: AUR → RPM → Homebrew
217
+
218
+## Troubleshooting
219
+
220
+### RPM Build Fails - "fpm: command not found"
221
+
222
+```bash
223
+cargo install fpm
224
+# Add to PATH if needed:
225
+export PATH="$HOME/.cargo/bin:$PATH"
226
+```
227
+
228
+### AUR Build Fails - Checksum Mismatch
229
+
230
+```bash
231
+updpkgsums  # Regenerate checksums
232
+makepkg --printsrcinfo > .SRCINFO
233
+```
234
+
235
+### Homebrew Install Fails - Binary Not Found
236
+
237
+Check that the glob pattern in `fortress.rb` matches your build output:
238
+```ruby
239
+built_binary = Dir["build/gfortran_*/app/fortress"].first
240
+```
241
+
242
+### Shell Integration Not Working
243
+
244
+Make sure users restart their shell or source the integration file:
245
+```bash
246
+# Bash
247
+source /etc/profile.d/fortress.sh  # RPM
248
+source /usr/share/fortress/fortress.sh  # AUR
249
+source $(brew --prefix)/share/fortress/fortress.sh  # Homebrew
250
+
251
+# Fish
252
+source /usr/share/fish/vendor_functions.d/fortress.fish  # RPM/AUR
253
+source $(brew --prefix)/share/fortress/fortress.fish  # Homebrew
254
+```
255
+
256
+## Automation Ideas
257
+
258
+Consider setting up:
259
+- GitHub Actions to automatically build and test on releases
260
+- Automatic AUR updates via CI/CD
261
+- Homebrew bump-formula-pr for version updates
262
+- RPM builds in CI with artifact upload
263
+
264
+## Notes on Homebrew Shell Integration
265
+
266
+Homebrew **cannot** automatically set up shell integration because:
267
+1. Homebrew formulas run in a sandbox
268
+2. Writing to user home directories is not allowed
269
+3. System-wide profile.d directories vary by OS (macOS vs Linux)
270
+
271
+This is why the `caveats` block is important - it provides clear instructions users will see after installation.
272
+
273
+## License
274
+
275
+MIT - See LICENSE file for details
Makefile.packagingadded
@@ -0,0 +1,62 @@
1
+# Fortress Packaging Makefile
2
+# Quick commands for building and deploying packages
3
+
4
+.PHONY: help build-rpm deploy-rpm install-deps clean
5
+
6
+help:
7
+	@echo "Fortress Packaging Commands"
8
+	@echo "============================"
9
+	@echo ""
10
+	@echo "  make build-rpm      - Build RPM package"
11
+	@echo "  make deploy-rpm     - Deploy RPM to repos.musicsian.com"
12
+	@echo "  make install-deps   - Install required dependencies"
13
+	@echo "  make clean          - Clean build artifacts"
14
+	@echo ""
15
+	@echo "See DEPLOYMENT.md for full documentation"
16
+
17
+build-rpm:
18
+	@echo "Building RPM package..."
19
+	./build-rpm.sh
20
+
21
+deploy-rpm: build-rpm
22
+	@echo "Deploying to repos.musicsian.com..."
23
+	./deploy-to-repo.sh
24
+	@echo ""
25
+	@echo "Next: cd ~/src/repos-musicsian-com && ./deploy.sh"
26
+
27
+install-deps:
28
+	@echo "Installing dependencies..."
29
+	@command -v cargo >/dev/null 2>&1 || (echo "Error: cargo not found. Install Rust first." && exit 1)
30
+	@command -v fpm >/dev/null 2>&1 || cargo install fpm
31
+	@command -v rpmbuild >/dev/null 2>&1 || (echo "Warning: rpmbuild not found. Install with: sudo dnf install rpm-build" && exit 1)
32
+	@command -v createrepo_c >/dev/null 2>&1 || (echo "Warning: createrepo_c not found. Install with: sudo dnf install createrepo_c" && exit 1)
33
+	@echo "✓ All dependencies installed"
34
+
35
+clean:
36
+	@echo "Cleaning build artifacts..."
37
+	rm -rf ~/rpmbuild/BUILD/fortress-*
38
+	rm -rf ~/rpmbuild/BUILDROOT/fortress-*
39
+	@echo "✓ Cleaned"
40
+
41
+# AUR targets
42
+.PHONY: aur-update aur-test
43
+
44
+aur-update:
45
+	@echo "Note: Update PKGBUILD version manually first"
46
+	@echo "Then run: updpkgsums && makepkg --printsrcinfo > .SRCINFO"
47
+
48
+aur-test:
49
+	@echo "Testing AUR package build..."
50
+	cd /path/to/fortress-aur && makepkg -si
51
+
52
+# Homebrew targets
53
+.PHONY: brew-test brew-sha256
54
+
55
+brew-test:
56
+	@echo "Testing Homebrew formula..."
57
+	brew install --build-from-source ./fortress.rb
58
+	brew test fortress
59
+
60
+brew-sha256:
61
+	@echo "Calculate SHA256 for Homebrew formula:"
62
+	@[ -f fortress-$(VERSION).tar.gz ] && shasum -a 256 fortress-$(VERSION).tar.gz || echo "Error: Create tarball first"
PACKAGING_SUMMARY.mdadded
@@ -0,0 +1,111 @@
1
+# Fortress Packaging Summary
2
+
3
+## Quick Deployment Commands
4
+
5
+### AUR
6
+```bash
7
+cd fortress-aur
8
+# Update PKGBUILD version
9
+updpkgsums
10
+makepkg --printsrcinfo > .SRCINFO
11
+git add -A && git commit -m "Update to vX.Y.Z" && git push
12
+```
13
+
14
+### RPM (repos.musicsian.com)
15
+```bash
16
+cd /home/espadon/src/fortress
17
+./build-rpm.sh
18
+./deploy-to-repo.sh
19
+cd ~/src/repos-musicsian-com
20
+git add RPMS/fortress-*.rpm fortress.repo
21
+git commit -m "Add fortress X.Y.Z"
22
+./deploy.sh
23
+```
24
+
25
+### Homebrew
26
+```bash
27
+# Update fortress.rb with new version and sha256
28
+brew install --build-from-source ./fortress.rb
29
+brew test fortress
30
+# Push to tap or submit PR to homebrew-core
31
+```
32
+
33
+## Files Created
34
+
35
+### Packaging Files
36
+- **PKGBUILD** - AUR package definition (already existed)
37
+- **fortress.spec** - RPM spec file for CentOS/RHEL/Fedora
38
+- **fortress.rb** - Homebrew formula for macOS/Linux
39
+- **fortress.install** - AUR post-install script (already existed)
40
+
41
+### Repository Files
42
+- **fortress.repo** - YUM/DNF repository configuration file
43
+  - Located at: `~/src/repos-musicsian-com/fortress.repo`
44
+
45
+### Build Scripts
46
+- **build-rpm.sh** - Builds RPM package locally
47
+- **deploy-to-repo.sh** - Deploys RPM to repos.musicsian.com
48
+
49
+### Documentation
50
+- **DEPLOYMENT.md** - Complete deployment guide with all details
51
+- **PACKAGING_SUMMARY.md** - This file (quick reference)
52
+
53
+## Shell Integration Status
54
+
55
+| Platform | Bash | Fish | Zsh |
56
+|----------|------|------|-----|
57
+| AUR | Auto | Auto | Manual |
58
+| RPM | Auto | Auto | Manual |
59
+| Homebrew | Manual | Manual | Manual |
60
+
61
+**Auto**: Integration automatically set up during package installation
62
+**Manual**: User must add `source` line to their shell config
63
+
64
+## Homebrew Shell Integration Answer
65
+
66
+**Yes, we CAN automate shell integration on Homebrew, but with limitations:**
67
+
68
+✅ **What Homebrew CAN do:**
69
+- Install shell integration files to a known location
70
+- Display clear post-install instructions via `caveats`
71
+- Make setup a single copy-paste command
72
+
73
+❌ **What Homebrew CANNOT do:**
74
+- Automatically modify user dotfiles (~/.bashrc, ~/.zshrc, etc.)
75
+- Write to system-wide profile.d directories (permissions)
76
+- Auto-source files without user action
77
+
78
+**The Solution:**
79
+The Homebrew formula includes a `caveats` block that displays after installation:
80
+
81
+```
82
+==> Caveats
83
+Add to your ~/.bashrc or ~/.zshrc:
84
+  source /opt/homebrew/share/fortress/fortress.sh
85
+```
86
+
87
+This is the standard Homebrew approach and what users expect. It's a one-time manual step, but it's well-documented and simple.
88
+
89
+## Next Steps
90
+
91
+1. **Test the RPM build** (once fpm is installed):
92
+   ```bash
93
+   cd /home/espadon/src/fortress
94
+   cargo install fpm  # If not already installed
95
+   ./build-rpm.sh
96
+   ```
97
+
98
+2. **Create a GitHub release** with the source tarball for version 0.1.0
99
+
100
+3. **Update SHA256 checksums**:
101
+   - For AUR: Run `updpkgsums` in PKGBUILD directory
102
+   - For Homebrew: Run `shasum -a 256 fortress-0.1.0.tar.gz`
103
+
104
+4. **Deploy in order**:
105
+   - AUR (fastest, community repo)
106
+   - RPM (your own repo)
107
+   - Homebrew (via tap or homebrew-core PR)
108
+
109
+## Support
110
+
111
+See DEPLOYMENT.md for complete details, troubleshooting, and automation ideas.
PKGBUILDmodified
@@ -10,7 +10,7 @@ depends=('glibc' 'gcc-libs')
1010
 makedepends=('fpm' 'gcc-fortran')
1111
 install=fortress.install
1212
 source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
13
-sha256sums=('SKIP')  # Update with actual checksum when creating release
13
+sha256sums=('e38b495296e87f7bee7140ed662a37ee23f2f428e459b9c455f846f856014d4e')
1414
 
1515
 build() {
1616
     cd "$srcdir/$pkgname-$pkgver"
build-rpm.shadded
@@ -0,0 +1,50 @@
1
+#!/usr/bin/env bash
2
+# Build script for creating fortress RPM package
3
+set -euo pipefail
4
+
5
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+cd "$SCRIPT_DIR"
7
+
8
+# Get version from spec file
9
+VERSION=$(grep "^Version:" fortress.spec | awk '{print $2}')
10
+RELEASE=$(grep "^Release:" fortress.spec | awk '{print $2}' | cut -d'%' -f1)
11
+NAME="fortress"
12
+
13
+echo "======================================================================"
14
+echo "  Building $NAME-$VERSION-$RELEASE RPM"
15
+echo "======================================================================"
16
+echo ""
17
+
18
+# Create rpmbuild directories
19
+mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
20
+
21
+echo "▶ Creating source tarball..."
22
+# Create source tarball (excluding build artifacts and git)
23
+tar --exclude='.git' \
24
+    --exclude='build' \
25
+    --exclude='*.rpm' \
26
+    --exclude='*.tar.gz' \
27
+    --exclude='rpmbuild' \
28
+    --transform "s,^.,$NAME-$VERSION," \
29
+    -czf ~/rpmbuild/SOURCES/$NAME-$VERSION.tar.gz \
30
+    .
31
+
32
+echo "✓ Tarball created: ~/rpmbuild/SOURCES/$NAME-$VERSION.tar.gz"
33
+
34
+echo "▶ Copying spec file..."
35
+cp fortress.spec ~/rpmbuild/SPECS/
36
+
37
+echo "▶ Building RPM package..."
38
+rpmbuild -ba ~/rpmbuild/SPECS/fortress.spec
39
+
40
+echo ""
41
+echo "======================================================================"
42
+echo "  Build Complete!"
43
+echo "======================================================================"
44
+echo ""
45
+echo "RPMs created in:"
46
+ls -lh ~/rpmbuild/RPMS/*/$NAME-*.rpm 2>/dev/null || echo "  (No binary RPMs found)"
47
+echo ""
48
+echo "SRPMs created in:"
49
+ls -lh ~/rpmbuild/SRPMS/$NAME-*.rpm 2>/dev/null || echo "  (No source RPMs found)"
50
+echo ""
deploy-to-repo.shadded
@@ -0,0 +1,47 @@
1
+#!/usr/bin/env bash
2
+# Deploy fortress RPM to repos.musicsian.com
3
+set -euo pipefail
4
+
5
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+REPO_DIR="$HOME/src/repos-musicsian-com"
7
+
8
+# Get version from spec file
9
+VERSION=$(grep "^Version:" "$SCRIPT_DIR/fortress.spec" | awk '{print $2}')
10
+RELEASE=$(grep "^Release:" "$SCRIPT_DIR/fortress.spec" | awk '{print $2}' | cut -d'%' -f1)
11
+NAME="fortress"
12
+
13
+echo "======================================================================"
14
+echo "  Deploying $NAME-$VERSION-$RELEASE to repos.musicsian.com"
15
+echo "======================================================================"
16
+echo ""
17
+
18
+# Check if RPM exists
19
+RPM_FILE=$(find ~/rpmbuild/RPMS -name "$NAME-$VERSION-$RELEASE*.rpm" | head -1)
20
+if [ -z "$RPM_FILE" ]; then
21
+    echo "❌ Error: RPM not found. Did you run ./build-rpm.sh first?"
22
+    exit 1
23
+fi
24
+
25
+echo "▶ Found RPM: $RPM_FILE"
26
+
27
+# Copy RPM to repo
28
+echo "▶ Copying RPM to repo directory..."
29
+cp -v "$RPM_FILE" "$REPO_DIR/RPMS/"
30
+
31
+# Copy fortress.repo file if not already present
32
+if [ ! -f "$REPO_DIR/fortress.repo" ]; then
33
+    echo "▶ Creating fortress.repo file..."
34
+    cp -v "$REPO_DIR/fuss.repo" "$REPO_DIR/fortress.repo"
35
+    sed -i 's/fuss/fortress/g' "$REPO_DIR/fortress.repo"
36
+    sed -i 's/Tree utility for dirty git files/Terminal file explorer in Fortran/' "$REPO_DIR/fortress.repo"
37
+fi
38
+
39
+echo ""
40
+echo "✓ RPM deployed to: $REPO_DIR/RPMS/"
41
+echo ""
42
+echo "Next steps:"
43
+echo "  1. cd $REPO_DIR"
44
+echo "  2. git add RPMS/$NAME-*.rpm fortress.repo"
45
+echo "  3. git commit -m 'Add fortress $VERSION-$RELEASE'"
46
+echo "  4. ./deploy.sh  # This will sign, create metadata, and deploy to server"
47
+echo ""
fortress.rbadded
@@ -0,0 +1,71 @@
1
+class Fortress < Formula
2
+  desc "Command-line file explorer written in modern Fortran with cd-on-exit"
3
+  homepage "https://github.com/FortranGoingOnForty/fortress"
4
+  url "https://github.com/FortranGoingOnForty/fortress/archive/v0.1.0.tar.gz"
5
+  sha256 "e38b495296e87f7bee7140ed662a37ee23f2f428e459b9c455f846f856014d4e"
6
+  license "MIT"
7
+
8
+  depends_on "fpm" => :build
9
+  depends_on "gcc" # for gfortran
10
+
11
+  def install
12
+    # Build the binary
13
+    system "fpm", "build", "--flag", "-O2"
14
+
15
+    # Find the built binary (the gfortran_* directory name varies)
16
+    built_binary = Dir["build/gfortran_*/app/fortress"].first
17
+    raise "Could not find built binary" unless built_binary
18
+
19
+    # Install the binary
20
+    bin.install built_binary => "fortress-bin"
21
+
22
+    # Install shell integration files
23
+    (share/"fortress").install "fortress.sh"
24
+    (share/"fortress").install "fortress.fish"
25
+
26
+    # Install documentation
27
+    doc.install "README.md"
28
+    doc.install "USAGE.md" if File.exist?("USAGE.md")
29
+  end
30
+
31
+  def caveats
32
+    <<~EOS
33
+      FORTRESS has been installed!
34
+
35
+      The binary is installed as 'fortress-bin', but you'll want to use
36
+      the shell wrapper function for the cd-on-exit feature.
37
+
38
+      === Bash/Zsh Setup ===
39
+      Add to your ~/.bashrc or ~/.zshrc:
40
+        source #{HOMEBREW_PREFIX}/share/fortress/fortress.sh
41
+
42
+      Then restart your shell or run:
43
+        source ~/.bashrc  # or ~/.zshrc
44
+
45
+      === Fish Setup ===
46
+      Add to your ~/.config/fish/config.fish:
47
+        source #{HOMEBREW_PREFIX}/share/fortress/fortress.fish
48
+
49
+      Then restart your shell or run:
50
+        source ~/.config/fish/config.fish
51
+
52
+      === Usage ===
53
+      After setup, just run:
54
+        fortress
55
+
56
+      Press 'c' on any directory to cd there and exit.
57
+
58
+      Documentation: #{HOMEBREW_PREFIX}/share/doc/fortress/
59
+    EOS
60
+  end
61
+
62
+  test do
63
+    # Test that the binary exists and runs
64
+    assert_predicate bin/"fortress-bin", :exist?
65
+    assert_predicate bin/"fortress-bin", :executable?
66
+
67
+    # Test that shell integration files exist
68
+    assert_predicate share/"fortress/fortress.sh", :exist?
69
+    assert_predicate share/"fortress/fortress.fish", :exist?
70
+  end
71
+end
fortress.specadded
@@ -0,0 +1,111 @@
1
+Name:           fortress
2
+Version:        0.1.0
3
+Release:        1%{?dist}
4
+Summary:        A command-line file explorer written in modern Fortran with cd-on-exit
5
+
6
+License:        MIT
7
+URL:            https://github.com/FortranGoingOnForty/fortress
8
+Source0:        %{name}-%{version}.tar.gz
9
+
10
+BuildRequires:  gfortran >= 10.0
11
+BuildRequires:  gcc
12
+BuildRequires:  fpm
13
+Requires:       glibc
14
+Requires:       gcc-libs
15
+
16
+%description
17
+FORTRESS is a command-line file explorer written in modern Fortran with fzf integration.
18
+It provides a dual-pane interface inspired by Ranger/Midnight Commander with intuitive
19
+keyboard navigation and a unique cd-on-exit feature that allows you to navigate your
20
+shell to any directory you select in the explorer.
21
+
22
+Features:
23
+- Dual-pane display (parent dir 30%% | current dir 70%%)
24
+- Real filesystem navigation with directory reading
25
+- Smart selection memory - remembers position when navigating
26
+- Visual hierarchy with dimmed parent pane and active current pane
27
+- Color-coded files (directories, executables, dotfiles, regular files)
28
+- Smooth updates with no flashing, selective redraws
29
+- Arrow key navigation for intuitive movement
30
+- Full-width selection bar with clean highlighting
31
+- CD on exit - press 'c' to navigate your shell to selected directory
32
+
33
+%prep
34
+%autosetup
35
+
36
+%build
37
+fpm build --flag "-O2"
38
+
39
+%install
40
+mkdir -p %{buildroot}%{_bindir}
41
+mkdir -p %{buildroot}%{_datadir}/%{name}
42
+mkdir -p %{buildroot}%{_datadir}/fish/vendor_functions.d
43
+mkdir -p %{buildroot}%{_sysconfdir}/profile.d
44
+mkdir -p %{buildroot}%{_docdir}/%{name}
45
+
46
+# Install the binary
47
+install -Dm755 build/gfortran_*/app/fortress %{buildroot}%{_bindir}/fortress-bin
48
+
49
+# Install shell integration files to shared location
50
+install -Dm644 fortress.sh %{buildroot}%{_datadir}/%{name}/fortress.sh
51
+install -Dm644 fortress.fish %{buildroot}%{_datadir}/%{name}/fortress.fish
52
+
53
+# Install bash integration to profile.d (auto-sourced on login)
54
+install -Dm644 fortress.sh %{buildroot}%{_sysconfdir}/profile.d/fortress.sh
55
+
56
+# Install fish integration to vendor functions (auto-loaded)
57
+install -Dm644 fortress.fish %{buildroot}%{_datadir}/fish/vendor_functions.d/fortress.fish
58
+
59
+# Install documentation
60
+install -Dm644 README.md %{buildroot}%{_docdir}/%{name}/README.md
61
+if [ -f USAGE.md ]; then
62
+    install -Dm644 USAGE.md %{buildroot}%{_docdir}/%{name}/USAGE.md
63
+fi
64
+
65
+%files
66
+%license LICENSE
67
+%doc README.md
68
+%{_bindir}/fortress-bin
69
+%{_datadir}/%{name}/fortress.sh
70
+%{_datadir}/%{name}/fortress.fish
71
+%config(noreplace) %{_sysconfdir}/profile.d/fortress.sh
72
+%{_datadir}/fish/vendor_functions.d/fortress.fish
73
+%{_docdir}/%{name}/README.md
74
+
75
+%post
76
+cat <<'EOF'
77
+
78
+====================================================================
79
+  FORTRESS - Terminal File Explorer
80
+====================================================================
81
+
82
+  The 'fortress' command is now available!
83
+
84
+  Shell integration (cd-on-exit) has been installed:
85
+    • Bash: Auto-loaded via /etc/profile.d/fortress.sh
86
+    • Fish: Auto-loaded via vendor_functions.d
87
+    • Zsh:  Add to ~/.zshrc:
88
+            source %{_datadir}/%{name}/fortress.sh
89
+
90
+  You may need to restart your shell or run:
91
+    source /etc/profile.d/fortress.sh  # bash
92
+
93
+  Usage:
94
+    fortress  - Start the file explorer
95
+    Press 'c' on a directory to cd there and exit
96
+
97
+  Documentation: %{_docdir}/%{name}/
98
+
99
+====================================================================
100
+
101
+EOF
102
+
103
+%changelog
104
+* Fri Oct 18 2025 mfw <espadon@outlook.com> - 0.1.0-1
105
+- Initial RPM release
106
+- Dual-pane file explorer with Fortran implementation
107
+- CD-on-exit functionality with shell integration
108
+- Color-coded file display with visual hierarchy
109
+- Smart selection memory and arrow key navigation
110
+- Automatic shell integration for bash and fish
111
+- Manual setup required for zsh