Skip to content

Commit 18589eb

Browse files
author
avadakedavra-wp
committed
feat: add installation and setup scripts for fazrepo CLI tool
1 parent dac5aed commit 18589eb

File tree

5 files changed

+399
-23
lines changed

5 files changed

+399
-23
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ A fast CLI tool to check package manager versions on your system.
1111

1212
## Installation
1313

14-
### Homebrew (macOS/Linux)
14+
### Quick Start (Development Install)
15+
16+
```bash
17+
# Install from source (works immediately)
18+
curl -fsSL https://raw.githubusercontent.com/avadakedavra-wp/fazrepo/main/install-dev.sh | bash
19+
```
20+
21+
### Homebrew (macOS/Linux) - Coming Soon
1522

1623
```bash
1724
brew tap avadakedavra-wp/fazrepo
1825
brew install fazrepo
1926
```
2027

21-
### Curl (Universal)
28+
### Curl (Universal) - After First Release
2229

2330
```bash
2431
curl -fsSL https://raw.githubusercontent.com/avadakedavra-wp/fazrepo/main/install.sh | bash

SETUP_GUIDE.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# 🚀 fazrepo Installation & Setup Guide
2+
3+
## Current Status & Quick Fix
4+
5+
You encountered the error:
6+
```
7+
❌ Failed to get latest release information
8+
```
9+
10+
This is expected because **no GitHub releases exist yet**. Here's how to fix it:
11+
12+
## ✅ Immediate Solution (Development Install)
13+
14+
Use the development installer that builds from source:
15+
16+
```bash
17+
curl -fsSL https://raw.githubusercontent.com/avadakedavra-wp/fazrepo/main/install-dev.sh | bash
18+
```
19+
20+
This script will:
21+
- Clone the repository
22+
- Build from source using Cargo
23+
- Install the binary to `/usr/local/bin`
24+
25+
## 📋 Complete Setup Process
26+
27+
### 1. First Time Setup
28+
29+
```bash
30+
# Run the setup script to prepare everything
31+
./setup.sh
32+
```
33+
34+
### 2. Create GitHub Repository
35+
36+
1. Go to https://github.com/new
37+
2. Create repository named `fazrepo`
38+
3. Make it public
39+
4. Don't initialize with README (you already have one)
40+
41+
### 3. Push Your Code
42+
43+
```bash
44+
# Set the correct remote (replace with your actual repo URL)
45+
git remote set-url origin https://github.com/avadakedavra-wp/fazrepo.git
46+
47+
# Push to GitHub
48+
git push -u origin main
49+
```
50+
51+
### 4. Create Your First Release
52+
53+
```bash
54+
# This will create v0.1.0 release
55+
./release.sh 0.1.0
56+
57+
# Push the tag
58+
git push origin v0.1.0
59+
```
60+
61+
### 5. Verify Everything Works
62+
63+
After creating the release, test both install methods:
64+
65+
```bash
66+
# Development install (works now)
67+
curl -fsSL https://raw.githubusercontent.com/avadakedavra-wp/fazrepo/main/install-dev.sh | bash
68+
69+
# Release install (works after step 4)
70+
curl -fsSL https://raw.githubusercontent.com/avadakedavra-wp/fazrepo/main/install.sh | bash
71+
```
72+
73+
## 🛠️ Troubleshooting
74+
75+
### Error: "Failed to get latest release information"
76+
**Cause**: No GitHub releases exist yet
77+
**Solution**: Use development installer or create first release
78+
79+
### Error: "Failed to clone repository"
80+
**Cause**: Repository doesn't exist or is private
81+
**Solution**: Create public GitHub repository and push code
82+
83+
### Error: "Rust/Cargo not found"
84+
**Cause**: Rust toolchain not installed
85+
**Solution**: Install Rust from https://rustup.rs/
86+
87+
### Error: "Permission denied"
88+
**Cause**: No write access to `/usr/local/bin`
89+
**Solution**: Script will automatically use `sudo`
90+
91+
## 📦 Alternative Installation Methods
92+
93+
### Local Build & Install
94+
```bash
95+
# Clone and build locally
96+
git clone https://github.com/avadakedavra-wp/fazrepo.git
97+
cd fazrepo
98+
cargo build --release
99+
sudo cp target/release/fazrepo /usr/local/bin/
100+
```
101+
102+
### Using Cargo (after first release)
103+
```bash
104+
cargo install --git https://github.com/avadakedavra-wp/fazrepo
105+
```
106+
107+
### Manual Binary Download (after release)
108+
```bash
109+
# Download binary directly from GitHub releases
110+
wget https://github.com/avadakedavra-wp/fazrepo/releases/download/v0.1.0/fazrepo-x86_64-unknown-linux-gnu
111+
chmod +x fazrepo-x86_64-unknown-linux-gnu
112+
sudo mv fazrepo-x86_64-unknown-linux-gnu /usr/local/bin/fazrepo
113+
```
114+
115+
## 🎯 Quick Test
116+
117+
After installation, verify fazrepo works:
118+
119+
```bash
120+
fazrepo --version
121+
fazrepo check
122+
fazrepo list
123+
```
124+
125+
Expected output:
126+
```
127+
🔍 Checking package manager versions...
128+
129+
✅ npm 10.9.0 (/path/to/npm)
130+
❌ yarn not installed
131+
✅ pnpm 9.13.2 (/path/to/pnpm)
132+
✅ bun 1.1.38 (/path/to/bun)
133+
```
134+
135+
## 🚀 Next Steps
136+
137+
1. **Set up Homebrew tap** (optional):
138+
- Create repo: `avadakedavra-wp/homebrew-fazrepo`
139+
- Copy `homebrew-fazrepo/Formula/` directory there
140+
- Update SHA256 hash in formula after first release
141+
142+
2. **Automate releases**:
143+
- GitHub Actions will handle this automatically
144+
- Just push tags: `git push origin v0.1.1`
145+
146+
3. **Share your CLI**:
147+
- Add to your README or portfolio
148+
- Submit to package manager directories
149+
- Share on social media
150+
151+
Your fazrepo CLI is production-ready! 🎉

install-dev.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
3+
# fazrepo development installation script
4+
# For when there are no releases yet
5+
# Usage: curl -fsSL https://raw.githubusercontent.com/avadakedavra-wp/fazrepo/main/install-dev.sh | bash
6+
7+
set -e
8+
9+
# Colors for output
10+
RED='\033[0;31m'
11+
GREEN='\033[0;32m'
12+
YELLOW='\033[1;33m'
13+
BLUE='\033[0;34m'
14+
NC='\033[0m' # No Color
15+
16+
# Configuration
17+
REPO="avadakedavra-wp/fazrepo"
18+
BINARY_NAME="fazrepo"
19+
INSTALL_DIR="/usr/local/bin"
20+
21+
echo -e "${BLUE}🚀 Installing fazrepo from source...${NC}"
22+
23+
# Check if git is installed
24+
if ! command -v git &> /dev/null; then
25+
echo -e "${RED}❌ Git not found${NC}"
26+
echo -e "${YELLOW}💡 Please install git first${NC}"
27+
exit 1
28+
fi
29+
30+
# Check if Rust is installed
31+
if ! command -v cargo &> /dev/null; then
32+
echo -e "${RED}❌ Rust/Cargo not found${NC}"
33+
echo -e "${YELLOW}💡 Installing Rust...${NC}"
34+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
35+
source ~/.cargo/env
36+
37+
if ! command -v cargo &> /dev/null; then
38+
echo -e "${RED}❌ Failed to install Rust${NC}"
39+
echo -e "${YELLOW}💡 Please install Rust manually from https://rustup.rs/${NC}"
40+
exit 1
41+
fi
42+
fi
43+
44+
# Create temporary directory
45+
TMP_DIR=$(mktemp -d)
46+
cd "$TMP_DIR"
47+
48+
echo -e "${YELLOW}📦 Cloning repository...${NC}"
49+
if ! git clone "https://github.com/$REPO.git" fazrepo; then
50+
echo -e "${RED}❌ Failed to clone repository${NC}"
51+
echo -e "${YELLOW}💡 Make sure the repository exists and is public${NC}"
52+
exit 1
53+
fi
54+
55+
cd fazrepo
56+
57+
echo -e "${YELLOW}🔨 Building from source...${NC}"
58+
cargo build --release
59+
60+
BINARY_PATH="target/release/$BINARY_NAME"
61+
62+
# Make binary executable
63+
chmod +x "$BINARY_PATH"
64+
65+
# Check if we need sudo for installation
66+
if [ ! -w "$INSTALL_DIR" ]; then
67+
echo -e "${YELLOW}🔐 Need sudo to install to $INSTALL_DIR${NC}"
68+
sudo cp "$BINARY_PATH" "$INSTALL_DIR/"
69+
else
70+
cp "$BINARY_PATH" "$INSTALL_DIR/"
71+
fi
72+
73+
# Cleanup
74+
cd /
75+
rm -rf "$TMP_DIR"
76+
77+
# Verify installation
78+
if command -v $BINARY_NAME &> /dev/null; then
79+
echo -e "${GREEN}$BINARY_NAME installed successfully!${NC}"
80+
echo -e "${BLUE}📍 Location: $(which $BINARY_NAME)${NC}"
81+
echo -e "${BLUE}🎯 Version: $($BINARY_NAME --version)${NC}"
82+
echo ""
83+
echo -e "${GREEN}🎉 You can now run: $BINARY_NAME${NC}"
84+
echo -e "${BLUE}💡 Try: $BINARY_NAME check${NC}"
85+
else
86+
echo -e "${RED}❌ Installation failed. $BINARY_NAME not found in PATH${NC}"
87+
echo -e "${YELLOW}💡 Try adding $INSTALL_DIR to your PATH${NC}"
88+
exit 1
89+
fi

install.sh

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,56 @@ esac
5050
echo -e "${BLUE}🚀 Installing fazrepo...${NC}"
5151

5252
# Get the latest release
53-
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
53+
echo -e "${YELLOW}📡 Checking for latest release...${NC}"
54+
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' 2>/dev/null || echo "")
5455

5556
if [ -z "$LATEST_RELEASE" ]; then
56-
echo -e "${RED}❌ Failed to get latest release information${NC}"
57-
exit 1
58-
fi
59-
60-
echo -e "${YELLOW}📦 Latest version: $LATEST_RELEASE${NC}"
61-
62-
# Download URL
63-
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE/${BINARY_NAME}-$TARGET"
64-
65-
# Create temporary directory
66-
TMP_DIR=$(mktemp -d)
67-
BINARY_PATH="$TMP_DIR/$BINARY_NAME"
68-
69-
echo -e "${YELLOW}⬇️ Downloading $BINARY_NAME for $TARGET...${NC}"
70-
71-
# Download the binary
72-
if ! curl -sL "$DOWNLOAD_URL" -o "$BINARY_PATH"; then
73-
echo -e "${RED}❌ Failed to download $BINARY_NAME${NC}"
74-
echo -e "${YELLOW}💡 You may need to install from source or check if the release exists${NC}"
75-
exit 1
57+
echo -e "${YELLOW}⚠️ No releases found. Installing from source...${NC}"
58+
59+
# Fallback: install from source
60+
echo -e "${BLUE}📦 Cloning repository...${NC}"
61+
TMP_DIR=$(mktemp -d)
62+
cd "$TMP_DIR"
63+
64+
if ! git clone "https://github.com/$REPO.git" fazrepo; then
65+
echo -e "${RED}❌ Failed to clone repository${NC}"
66+
echo -e "${YELLOW}💡 Make sure the repository exists and is public${NC}"
67+
echo -e "${YELLOW}💡 Or install Rust and build from source manually${NC}"
68+
exit 1
69+
fi
70+
71+
cd fazrepo
72+
73+
# Check if Rust is installed
74+
if ! command -v cargo &> /dev/null; then
75+
echo -e "${RED}❌ Rust/Cargo not found${NC}"
76+
echo -e "${YELLOW}💡 Please install Rust from https://rustup.rs/${NC}"
77+
echo -e "${YELLOW}💡 Then run: cargo install --git https://github.com/$REPO${NC}"
78+
exit 1
79+
fi
80+
81+
echo -e "${YELLOW}🔨 Building from source...${NC}"
82+
cargo build --release
83+
84+
BINARY_PATH="target/release/$BINARY_NAME"
85+
else
86+
echo -e "${YELLOW}📦 Latest version: $LATEST_RELEASE${NC}"
87+
88+
# Download URL
89+
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE/${BINARY_NAME}-$TARGET"
90+
91+
# Create temporary directory
92+
TMP_DIR=$(mktemp -d)
93+
BINARY_PATH="$TMP_DIR/$BINARY_NAME"
94+
95+
echo -e "${YELLOW}⬇️ Downloading $BINARY_NAME for $TARGET...${NC}"
96+
97+
# Download the binary
98+
if ! curl -sL "$DOWNLOAD_URL" -o "$BINARY_PATH"; then
99+
echo -e "${RED}❌ Failed to download $BINARY_NAME${NC}"
100+
echo -e "${YELLOW}💡 You may need to install from source or check if the release exists${NC}"
101+
exit 1
102+
fi
76103
fi
77104

78105
# Make binary executable

0 commit comments

Comments
 (0)