Skip to content

Commit

Permalink
site: generate site using Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarcoatl committed Apr 4, 2024
1 parent 0631a55 commit a5f0dce
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 142 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_size = 4
indent_style = tab
insert_final_newline = true

[*.json]
insert_final_newline = false

[**.{md,html}]
indent_size = 4
x-soft-wrap-text = true
17 changes: 6 additions & 11 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ jobs:
- uses: actions/checkout@v4

- run: |
brew tap coatl-dev/coatl-dev
- run: |
./script/generate.rb
make tap TAP=coatl-dev/coatl-dev
- uses: actions/upload-artifact@v4
with:
Expand All @@ -37,19 +34,17 @@ jobs:
- uses: actions/checkout@v4

- run: |
rm -r _data
rm -r api
rm -r formula
rm -r \
_data \
api \
formula
- uses: actions/download-artifact@v4
with:
name: site

- run: |
./script/find-replace.sh
- run: |
./script/generate-core.sh
make core
- uses: coatl-dev/actions/simple-git-diff@v3
id: git-diff
Expand Down
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TAP ?=

all: tap core

help:
@echo "Usage: make [target] TAP=<[user|org]/repo>"
@echo ""
@echo "Targets:"
@echo " <none>: A blank, or no target will run 'all' target."
@echo " all: Run 'get-tap' and 'get-core' targets."
@echo " core: Generate formulae information for homebrew-core."
@echo " tap: Generate formulae information for TAP."
@echo " help: Display this help message."

core:
@echo "Getting homebrew/core referenced formulae data..."
@./script/generate-core.sh

tap:
ifeq ($(strip $(TAP)),)
$(error "Argument TAP is required. E.g., make [all|tap] TAP=<[user|org]/repo>")
endif
@echo "Tapping $(TAP)..."
@$(shell brew tap $(TAP))
@echo "Generating formulae data for $(TAP)..."
@./script/generate.rb $(TAP)
@echo "Updating core dependencies on $(TAP) formulae..."
@./script/find-replace.sh
20 changes: 11 additions & 9 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ remote_theme: Homebrew/brew.sh
exclude:
- script
- CNAME
- README.md
- Dockerfile
- Gemfile*
- Makefile
- README.md

plugins:
- jekyll-feed
Expand All @@ -27,14 +29,6 @@ defaults:
search_site: formulae

taps:
coatl-dev:
repo: coatl-dev
name: coatl-dev/coatl-dev
fullname: coatl-dev/homebrew-coatl-dev
remote: https://github.com/coatl-dev/homebrew-coatl-dev
api: https://formulae.coatl.dev/api
bottle_dir: bottle
formula_dir: formula
core:
repo: core
name: Homebrew/core
Expand All @@ -43,6 +37,14 @@ taps:
api: https://formulae.brew.sh/api
bottle_dir: bottle-core
formula_dir: formula-core
tap:
repo: coatl-dev
name: coatl-dev/coatl-dev
fullname: coatl-dev/homebrew-coatl-dev
remote: https://github.com/coatl-dev/homebrew-coatl-dev
api: https://formulae.coatl.dev/api
bottle_dir: bottle
formula_dir: formula

logo: assets/coatl.png

Expand Down
2 changes: 1 addition & 1 deletion _includes/install_command.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="install">
<span class="label">Tap command: </span>
<div class="copyable">
{%- highlight bash -%} brew tap {{site.taps.coatl-dev.name}} {%- endhighlight -%}
{%- highlight bash -%} brew tap {{site.taps.tap.name}} {%- endhighlight -%}
</div>
</div>
<div class="install">
Expand Down
8 changes: 4 additions & 4 deletions _layouts/formula.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
{%- assign formula_dir = site.taps.core.formula_dir %}
{%- assign remote = site.taps.core.remote %}
{%- else %}
{%- assign api = site.taps.coatl-dev.api %}
{%- assign bottle_dir = site.taps.coatl-dev.bottle_dir %}
{%- assign formula_dir = site.taps.coatl-dev.formula_dir %}
{%- assign remote = site.taps.coatl-dev.remote %}
{%- assign api = site.taps.tap.api %}
{%- assign bottle_dir = site.taps.tap.bottle_dir %}
{%- assign formula_dir = site.taps.tap.formula_dir %}
{%- assign remote = site.taps.tap.remote %}
{%- endif -%}
<p>Formula JSON API: <a href="{{api}}/{{ formula_dir }}/{{ f.name }}.json"><code>/api/{{ formula_dir }}/{{ f.name }}.json</code></a></p>
{%- if formula_path == "formula-core" %}
Expand Down
4 changes: 2 additions & 2 deletions formula_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
layout: default
permalink: /formula/
---
<p>This is a listing of all packages available from the <a href="{{ site.taps.coatl-dev.remote }}">{{ site.taps.coatl-dev.repo }} tap</a> via the <a href="https://brew.sh">Homebrew</a> package manager for macOS.</p>
<p>This is a listing of all packages available from the <a href="{{ site.taps.tap.remote }}">{{ site.taps.tap.repo }} tap</a> via the <a href="https://brew.sh">Homebrew</a> package manager for macOS.</p>

<h2><a href="{{ site.taps.coatl-dev.api }}/formula.json"><code>/api/formula.json</code> (JSON API)</a></h2>
<h2><a href="{{ site.taps.tap.api }}/formula.json"><code>/api/formula.json</code> (JSON API)</a></h2>

<table>
{%- assign sorted_formulae = site.data.formula | sort -%}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
---
<p><a href="{{ site.baseurl }}/">{{site.title}}</a> is an online package browser for <a href="{{site.taps.coatl-dev.remote}}" target="_blank">{{site.taps.coatl-dev.repo}}</a>'s Homebrew tap. For more information on how to install and use Homebrew see <a href="https://brew.sh">Homebrew's homepage</a>.</p>
<p><a href="{{ site.baseurl }}/">{{site.title}}</a> is an online package browser for <a href="{{site.taps.tap.remote}}" target="_blank">{{site.taps.tap.repo}}</a>'s Homebrew tap. For more information on how to install and use Homebrew see <a href="https://brew.sh">Homebrew's homepage</a>.</p>

<h2><a href="{{ site.baseurl }}/formula/">Browse all coatl-dev formulae</a></h2>
<h2><a href="{{ site.baseurl }}/formula-core/">Browse all referenced core formulae</a></h2>
2 changes: 1 addition & 1 deletion script/find-replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ keys=(

for key in "${keys[@]}"
do
find _data/formula -name "*.json" -type f -exec sed -i "s/\"$key\"/\"core_$key\"/g" {} +
find _data/formula -name "*.json" -type f -exec sed -i '' "s/\"$key\"/\"core_$key\"/g" {} +
done
102 changes: 102 additions & 0 deletions script/formulae.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
autoconf
[email protected]
[email protected]
automake
[email protected]
bison
ca-certificates
cairo
certifi
cmake
fontconfig
freetype
gawk
gdbm
gettext
giflib
glib
gmp
gobject-introspection
graphite2
harfbuzz
icu4c
jpeg-turbo
[email protected]
[email protected]
libgit2
libpng
libssh2
libtermkey
libtiff
libtool
libuv
libvterm
libx11
libxau
libxcb
libxdmcp
libxext
libxrender
little-cms2
llvm@8
llvm@9
llvm@11
llvm@12
llvm@13
llvm@14
llvm@15
llvm@16
llvm
lpeg
lua
[email protected]
[email protected]
luajit
luarocks
luv
lz4
lzo
m4
meson
mpdecimal
mpfr
msgpack
nasm
neovim
ninja
openjdk@11
openjdk@17
openjdk@8
[email protected]
openssl@3
[email protected]
page
pcre
pcre2
pixman
pkg-config
pkgconf
python-setuptools
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
readline
rust
sphinx-doc
sqlite
swig@3
swig
tcl-tk
tree-sitter
unibilium
unzip
util-macros
xcb-proto
xorgproto
xtrans
xz
z3
zstd
Loading

0 comments on commit a5f0dce

Please sign in to comment.