mirror of
https://github.com/lukaszraczylo/homebrew-taps.git
synced 2026-10-12 00:45:10 +00:00
docs: list harness-sync and redesign the tap site
Replace the Tailwind CDN page with a static stylesheet. Make the generator emit the new markup and fill the Brewfile block from the casks. Map cask names to repository names for projects whose names differ.
This commit is contained in:
+55
-113
@@ -11,144 +11,84 @@ CASKS_DIR="${ROOT_DIR}/Casks"
|
||||
DOCS_DIR="${ROOT_DIR}/docs"
|
||||
INDEX_FILE="${DOCS_DIR}/index.html"
|
||||
TEMP_FILE="${DOCS_DIR}/casks_temp.html"
|
||||
BREWFILE_TEMP="${DOCS_DIR}/brewfile_temp.txt"
|
||||
|
||||
# Get metadata for a cask
|
||||
get_icon() {
|
||||
case "$1" in
|
||||
kportal) echo "fa-ship" ;;
|
||||
lolcathost) echo "fa-cat" ;;
|
||||
semver-generator) echo "fa-code-branch" ;;
|
||||
graphql-monitoring-proxy) echo "fa-chart-line" ;;
|
||||
*) echo "fa-cube" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_colors() {
|
||||
case "$1" in
|
||||
kportal) echo "from-blue-500 to-purple-600" ;;
|
||||
lolcathost) echo "from-pink-500 to-purple-600" ;;
|
||||
semver-generator) echo "from-emerald-500 to-teal-600" ;;
|
||||
graphql-monitoring-proxy) echo "from-rose-500 to-orange-600" ;;
|
||||
*) echo "from-gray-500 to-gray-600" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_tag1() {
|
||||
# Per-cask metadata: category label and optional docs site
|
||||
get_category() {
|
||||
case "$1" in
|
||||
kportal) echo "Kubernetes" ;;
|
||||
lolcathost) echo "Hosts" ;;
|
||||
semver-generator) echo "Git" ;;
|
||||
graphql-monitoring-proxy) echo "GraphQL" ;;
|
||||
harness-sync) echo "LLM" ;;
|
||||
readitall) echo "MCP" ;;
|
||||
mcp-filepuff) echo "MCP" ;;
|
||||
*) echo "CLI" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_tag1_color() {
|
||||
case "$1" in
|
||||
kportal) echo "blue" ;;
|
||||
lolcathost) echo "pink" ;;
|
||||
semver-generator) echo "emerald" ;;
|
||||
graphql-monitoring-proxy) echo "rose" ;;
|
||||
*) echo "gray" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_tag2() {
|
||||
case "$1" in
|
||||
kportal) echo "TUI" ;;
|
||||
lolcathost) echo "TUI" ;;
|
||||
semver-generator) echo "Versioning" ;;
|
||||
graphql-monitoring-proxy) echo "Monitoring" ;;
|
||||
*) echo "" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_tag2_color() {
|
||||
case "$1" in
|
||||
kportal) echo "purple" ;;
|
||||
lolcathost) echo "purple" ;;
|
||||
semver-generator) echo "teal" ;;
|
||||
graphql-monitoring-proxy) echo "orange" ;;
|
||||
*) echo "gray" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_docs_url() {
|
||||
case "$1" in
|
||||
kportal) echo "https://kportal.raczylo.com" ;;
|
||||
lolcathost) echo "https://lolcathost.raczylo.com" ;;
|
||||
graphql-monitoring-proxy) echo "https://graphql-monitoring-proxy.raczylo.com" ;;
|
||||
*) echo "" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Cask name differs from the GitHub repository name for some projects
|
||||
get_repo() {
|
||||
case "$1" in
|
||||
readitall) echo "mcp-readitall" ;;
|
||||
mcp-filepuff) echo "filepuff-mcp" ;;
|
||||
*) echo "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
html_escape() {
|
||||
local s="$1"
|
||||
s="${s//&/&}"
|
||||
s="${s//</<}"
|
||||
s="${s//>/>}"
|
||||
echo "${s}"
|
||||
}
|
||||
|
||||
generate_cask_card() {
|
||||
local name="$1"
|
||||
local version="$2"
|
||||
local desc="$3"
|
||||
local desc
|
||||
desc=$(html_escape "$3")
|
||||
|
||||
local icon
|
||||
icon=$(get_icon "${name}")
|
||||
local colors
|
||||
colors=$(get_colors "${name}")
|
||||
local tag1
|
||||
tag1=$(get_tag1 "${name}")
|
||||
local tag1_color
|
||||
tag1_color=$(get_tag1_color "${name}")
|
||||
local tag2
|
||||
tag2=$(get_tag2 "${name}")
|
||||
local tag2_color
|
||||
tag2_color=$(get_tag2_color "${name}")
|
||||
local category
|
||||
category=$(get_category "${name}")
|
||||
local docs_url
|
||||
docs_url=$(get_docs_url "${name}")
|
||||
local github_url="https://github.com/lukaszraczylo/${name}"
|
||||
local repo
|
||||
repo=$(get_repo "${name}")
|
||||
local github_url="https://github.com/lukaszraczylo/${repo}"
|
||||
|
||||
local tags_html="<span class=\"px-2 py-1 bg-${tag1_color}-100 dark:bg-${tag1_color}-900/30 text-${tag1_color}-700 dark:text-${tag1_color}-300 rounded text-xs\">${tag1}</span>"
|
||||
if [[ -n "${tag2}" ]]
|
||||
then
|
||||
tags_html="${tags_html}
|
||||
<span class=\"px-2 py-1 bg-${tag2_color}-100 dark:bg-${tag2_color}-900/30 text-${tag2_color}-700 dark:text-${tag2_color}-300 rounded text-xs\">${tag2}</span>"
|
||||
fi
|
||||
|
||||
local buttons_html=""
|
||||
local links_html=""
|
||||
if [[ -n "${docs_url}" ]]
|
||||
then
|
||||
buttons_html="<a href=\"${docs_url}\" target=\"_blank\" class=\"flex-1 text-center px-3 py-2 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg text-sm font-medium transition-colors\">
|
||||
<i class=\"fas fa-book mr-1\"></i>Docs
|
||||
</a>
|
||||
<a href=\"${github_url}\" target=\"_blank\" class=\"flex-1 text-center px-3 py-2 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg text-sm font-medium transition-colors\">
|
||||
<i class=\"fab fa-github mr-1\"></i>GitHub
|
||||
</a>"
|
||||
else
|
||||
buttons_html="<a href=\"${github_url}\" target=\"_blank\" class=\"flex-1 text-center px-3 py-2 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg text-sm font-medium transition-colors\">
|
||||
<i class=\"fab fa-github mr-1\"></i>GitHub
|
||||
</a>"
|
||||
links_html="<a href=\"${docs_url}\">Docs</a>
|
||||
"
|
||||
fi
|
||||
links_html="${links_html}<a href=\"${github_url}\">GitHub</a>"
|
||||
|
||||
cat <<CARD_EOF
|
||||
<!-- ${name} -->
|
||||
<div class="glass p-6 rounded-xl group hover:shadow-lg transition-all duration-300">
|
||||
<div class="flex items-start gap-4 mb-4">
|
||||
<div class="w-12 h-12 rounded-xl bg-gradient-to-br ${colors} flex items-center justify-center flex-shrink-0 group-hover:scale-110 transition-transform duration-300">
|
||||
<i class="fas ${icon} text-white text-lg"></i>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h3 class="font-bold text-gray-900 dark:text-gray-100 text-lg">${name}</h3>
|
||||
<span class="text-xs text-gray-500 dark:text-gray-400">v${version}</span>
|
||||
</div>
|
||||
<li class="project">
|
||||
<div class="project-head">
|
||||
<h3>${name}</h3>
|
||||
<span class="meta">v${version} · ${category}</span>
|
||||
<span class="project-links">
|
||||
${links_html}
|
||||
</span>
|
||||
</div>
|
||||
<p class="text-sm text-gray-600 dark:text-gray-400 mb-4">${desc}</p>
|
||||
<div class="flex flex-wrap gap-2 mb-4">
|
||||
${tags_html}
|
||||
<p>${desc}</p>
|
||||
<div class="cmd">
|
||||
<pre><code>brew install --cask lukaszraczylo/taps/${name}</code></pre>
|
||||
<button class="copy-btn" type="button" onclick="copyCode(this)">Copy</button>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
${buttons_html}
|
||||
</div>
|
||||
<div class="code-block mt-4">
|
||||
<pre class="bg-gray-900 text-gray-100 p-3 pr-16 rounded-lg text-xs overflow-x-auto"><code>brew install --cask lukaszraczylo/taps/${name}</code></pre>
|
||||
<button class="copy-btn" onclick="copyCode(this)" title="Copy to clipboard"><i class="fas fa-copy"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
CARD_EOF
|
||||
}
|
||||
@@ -164,6 +104,7 @@ fi
|
||||
|
||||
# Generate casks HTML to temp file
|
||||
echo "" >"${TEMP_FILE}"
|
||||
: >"${BREWFILE_TEMP}"
|
||||
|
||||
for cask_file in "${CASKS_DIR}"/*.rb
|
||||
do
|
||||
@@ -174,21 +115,22 @@ do
|
||||
desc=$(grep -m1 'desc "' "${cask_file}" | sed 's/.*desc "\([^"]*\)".*/\1/' 2>/dev/null || echo "A Homebrew cask")
|
||||
|
||||
generate_cask_card "${name}" "${version}" "${desc}" >>"${TEMP_FILE}"
|
||||
echo "cask \"${name}\"" >>"${BREWFILE_TEMP}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Now rebuild the index.html with the new casks content
|
||||
# Read and process the file
|
||||
# Rebuild index.html: casks between CASKS_* markers, Brewfile lines between BREWFILE_* markers
|
||||
{
|
||||
# Print everything up to and including CASKS_START
|
||||
sed -n '1,/<!-- CASKS_START -->/p' "${INDEX_FILE}"
|
||||
# Print the generated casks
|
||||
cat "${TEMP_FILE}"
|
||||
# Print everything from CASKS_END onwards
|
||||
sed -n '/<!-- CASKS_END -->/,$p' "${INDEX_FILE}"
|
||||
} >"${INDEX_FILE}.new"
|
||||
} | awk -v bf="${BREWFILE_TEMP}" '
|
||||
/<!-- BREWFILE_START -->/ { print; while ((getline line < bf) > 0) print line; skip = 1; next }
|
||||
/<!-- BREWFILE_END -->/ { skip = 0 }
|
||||
!skip { print }
|
||||
' >"${INDEX_FILE}.new"
|
||||
|
||||
mv "${INDEX_FILE}.new" "${INDEX_FILE}"
|
||||
rm -f "${TEMP_FILE}"
|
||||
rm -f "${TEMP_FILE}" "${BREWFILE_TEMP}"
|
||||
|
||||
echo "Documentation updated successfully!"
|
||||
|
||||
Reference in New Issue
Block a user