-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_justfile_to_repos.sh
More file actions
executable file
·61 lines (49 loc) · 1.9 KB
/
Copy pathadd_justfile_to_repos.sh
File metadata and controls
executable file
·61 lines (49 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Script to add Justfile to repos that don't have it
# Also creates hardlink in .machine_readable/contractiles/
REPO_ROOT="/home/hyperpolymath/developer/repos"
ALL_REPOS_FILE="$REPO_ROOT/all_repos.txt"
TEMPLATE_JUSTFILE="$REPO_ROOT/rsr-template-repo/Justfile"
add_justfile() {
local repo_path="$1"
local repo_name=$(basename "$repo_path")
echo "Processing: $repo_name"
# Check if Justfile already exists
if [ -f "$repo_path/Justfile" ]; then
echo " ✅ Already has Justfile"
# Create hardlink if it doesn't exist
local contractiles_dir="$repo_path/.machine_readable/contractiles"
if [ ! -f "$contractiles_dir/Justfile" ] && [ -d "$contractiles_dir" ]; then
ln "$repo_path/Justfile" "$contractiles_dir/Justfile" 2>/dev/null && \
echo " Added: hardlink to Justfile in .machine_readable/contractiles/"
fi
return 0
fi
# Copy template Justfile
cp "$TEMPLATE_JUSTFILE" "$repo_path/Justfile"
echo " Added: Justfile"
# Create .machine_readable/contractiles if it doesn't exist
mkdir -p "$repo_path/.machine_readable/contractiles"
# Create hardlink
ln "$repo_path/Justfile" "$repo_path/.machine_readable/contractiles/Justfile" 2>/dev/null && \
echo " Added: hardlink to Justfile in .machine_readable/contractiles/"
echo " ✅ Justfile added to $repo_name"
}
# Main logic
echo "Starting Justfile rollout..."
echo ""
count=0
while IFS= read -r repo_path; do
# Skip .lake/packages and .git directories
if [[ "$repo_path" == *"\.lake/packages"* ]] || [[ "$repo_path" == *"/\.git/"* ]]; then
continue
fi
# Check if it's a git repo
if [ -d "$repo_path/.git" ]; then
add_justfile "$repo_path"
((count++))
fi
done < "$ALL_REPOS_FILE"
echo ""
echo "Processed $count repositories"
echo "Justfile rollout complete!"