diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70c5ea9..a95cdac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,13 +56,9 @@ jobs: shell: bash run: brew install-bundler-gems - - name: Install project gems + - name: Setup project dependencies shell: bash - run: | - export GEM_HOME="$HOME/.gem" - export PATH="$GEM_HOME/bin:$PATH" - gem install bundler --user-install - bundle install + run: make setup - name: Run brew test-bot (cleanup) shell: bash diff --git a/.github/workflows/pages-build.yml b/.github/workflows/pages-build.yml index 5c202b6..794dd13 100644 --- a/.github/workflows/pages-build.yml +++ b/.github/workflows/pages-build.yml @@ -32,15 +32,13 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@0481980f17b760ef6bca5e8c55809102a0af1e5a # v1.263.0 - with: - bundler-cache: true - - name: Parse Formulae and Build Site + - name: Setup project dependencies and build site shell: bash run: | - ruby scripts/parse_formulas.rb + make setup + make build echo "Generated formulae.json with $(jq '.formulae | length' docs/_data/formulae.json) formulae" - ruby scripts/build_site.rb - name: Setup Pages id: pages diff --git a/Gemfile b/Gemfile index 6b3d7f0..6e43626 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -ruby "3.4.6" +ruby ">= 3.0.0" gem "cssminify2", "~> 2.0" gem "json", "~> 2.7" diff --git a/Makefile b/Makefile index aad9bbc..5a35d69 100644 --- a/Makefile +++ b/Makefile @@ -31,17 +31,36 @@ help: ## Show this help message build: ## Build the static documentation site @echo "đŸ—ī¸ Building homebrew tap documentation..." - @$(RUBY) $(SCRIPTS_DIR)/parse_formulas.rb - @$(RUBY) $(SCRIPTS_DIR)/build_site.rb + @if [ -f Gemfile ]; then \ + RUBY_ABI_VERSION=$$($(RUBY) -e 'puts "#{RUBY_VERSION.split(".")[0]}.#{RUBY_VERSION.split(".")[1]}.0"'); \ + export PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH"; \ + bundle exec $(RUBY) $(SCRIPTS_DIR)/parse_formulas.rb; \ + bundle exec $(RUBY) $(SCRIPTS_DIR)/build_site.rb; \ + else \ + $(RUBY) $(SCRIPTS_DIR)/parse_formulas.rb; \ + $(RUBY) $(SCRIPTS_DIR)/build_site.rb; \ + fi @echo "✅ Build complete!" serve: ## Start development server (default: localhost:4000) @echo "🚀 Starting development server on http://$(HOST):$(PORT)" - @$(RUBY) $(SCRIPTS_DIR)/serve.rb $(PORT) $(HOST) + @if [ -f Gemfile ]; then \ + RUBY_ABI_VERSION=$$($(RUBY) -e 'puts "#{RUBY_VERSION.split(".")[0]}.#{RUBY_VERSION.split(".")[1]}.0"'); \ + export PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH"; \ + bundle exec $(RUBY) $(SCRIPTS_DIR)/serve.rb $(PORT) $(HOST); \ + else \ + $(RUBY) $(SCRIPTS_DIR)/serve.rb $(PORT) $(HOST); \ + fi parse: ## Parse formulae and generate JSON data only @echo "📋 Parsing formulae..." - @$(RUBY) $(SCRIPTS_DIR)/parse_formulas.rb + @if [ -f Gemfile ]; then \ + RUBY_ABI_VERSION=$$($(RUBY) -e 'puts "#{RUBY_VERSION.split(".")[0]}.#{RUBY_VERSION.split(".")[1]}.0"'); \ + export PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH"; \ + bundle exec $(RUBY) $(SCRIPTS_DIR)/parse_formulas.rb; \ + else \ + $(RUBY) $(SCRIPTS_DIR)/parse_formulas.rb; \ + fi @echo "✅ Formulae parsing complete!" clean: ## Clean all generated files @@ -54,9 +73,25 @@ dev: parse build serve ## Full development workflow: parse, build, and serve setup: ## Initial project setup and dependency check @echo "🔧 Setting up homebrew tap development environment..." @which $(RUBY) > /dev/null || (echo "❌ Ruby not found. Please install Ruby first." && exit 1) + @echo "✅ Ruby found: $$($(RUBY) --version)" @test -d $(FORMULA_DIR) || (echo "❌ Formula directory not found" && exit 1) @test -d $(THEME_DIR) || (echo "❌ Theme directory not found" && exit 1) @test -f $(THEME_DIR)/index.html.erb || (echo "❌ Theme templates not found" && exit 1) + @echo "đŸ“Ļ Installing Ruby dependencies..." + @if ! command -v bundle >/dev/null 2>&1; then \ + echo "đŸ“Ĩ Installing bundler..."; \ + gem install bundler --user-install; \ + fi + @if [ -f Gemfile ]; then \ + echo "🔄 Running bundle install..."; \ + RUBY_ABI_VERSION=$$($(RUBY) -e 'puts "#{RUBY_VERSION.split(".")[0]}.#{RUBY_VERSION.split(".")[1]}.0"'); \ + (export PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH" && \ + bundle config set path 'vendor/bundle' && \ + bundle install); \ + echo "✅ Ruby dependencies installed!"; \ + else \ + echo "â„šī¸ No Gemfile found, skipping dependency installation"; \ + fi @echo "✅ Environment setup complete!" check: ## Check if all required files and directories exist @@ -81,7 +116,14 @@ test: check ## Run tests and validation install: ## Install development dependencies (if Gemfile exists) @if [ -f Gemfile ]; then \ echo "đŸ“Ļ Installing Ruby dependencies..."; \ - bundle install; \ + if ! command -v bundle >/dev/null 2>&1; then \ + echo "đŸ“Ĩ Installing bundler..."; \ + gem install bundler --user-install; \ + fi; \ + RUBY_ABI_VERSION=$$($(RUBY) -e 'puts "#{RUBY_VERSION.split(".")[0]}.#{RUBY_VERSION.split(".")[1]}.0"'); \ + (export PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH" && \ + bundle config set path 'vendor/bundle' && \ + bundle install); \ echo "✅ Dependencies installed!"; \ else \ echo "â„šī¸ No Gemfile found, skipping dependency installation"; \ @@ -91,11 +133,12 @@ update: ## Update all gems to their latest versions (respecting Gemfile constrai @if [ -f Gemfile ]; then \ echo "🔄 Updating Ruby dependencies..."; \ echo "đŸ“Ļ Running bundle update..."; \ - bundle update; \ + RUBY_ABI_VERSION=$$($(RUBY) -e 'puts "#{RUBY_VERSION.split(".")[0]}.#{RUBY_VERSION.split(".")[1]}.0"'); \ + PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH" bundle update; \ echo "✅ All gems updated to latest versions!"; \ echo ""; \ echo "💡 Current gem versions:"; \ - bundle list | grep -E "^\s*\*" | head -10; \ + PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH" bundle list | grep -E "^\s*\*" | head -10; \ else \ echo "❌ No Gemfile found"; \ exit 1; \ @@ -110,7 +153,8 @@ update-bundler: ## Update bundler itself to the latest version outdated: ## Show outdated gems @if [ -f Gemfile ]; then \ echo "📋 Checking for outdated gems..."; \ - bundle outdated || true; \ + RUBY_ABI_VERSION=$$($(RUBY) -e 'puts "#{RUBY_VERSION.split(".")[0]}.#{RUBY_VERSION.split(".")[1]}.0"'); \ + PATH="$$HOME/.local/share/gem/ruby/$$RUBY_ABI_VERSION/bin:$$PATH" bundle outdated || true; \ else \ echo "❌ No Gemfile found"; \ exit 1; \ diff --git a/README.md b/README.md index b4af9b2..ec14f3f 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,22 @@ The CI will automatically validate your formula and update the documentation sit This tap uses a custom Ruby-based static site generator with zero external dependencies. +### Quick Start + +For new contributors or first-time setup: + +```bash +make setup # Install Ruby dependencies and set up the environment +make build # Build the documentation site +make serve # Start development server +``` + +Or use the all-in-one development command: + +```bash +make dev # Full workflow: parse formulae, build site, and start server +``` + ### Commands #### Using Make (Recommended) @@ -51,12 +67,12 @@ make clean # Clean all generated files **Development workflow:** ```bash -make dev # Full development workflow (parse + build + serve) -make setup # Check development environment setup -make test # Run validation tests -make check # Check project structure -make install # Install Ruby dependencies (if Gemfile exists) -make info # Show project information +make setup # Initial setup: install Ruby dependencies and bundler +make dev # Full development workflow (parse + build + serve) +make test # Run validation tests +make check # Check project structure +make install # Install Ruby dependencies (if Gemfile exists) +make info # Show project information ``` **Server options:** diff --git a/docs/.gitkeep b/docs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/_data/.gitkeep b/docs/_data/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/assets/.gitkeep b/docs/assets/.gitkeep deleted file mode 100644 index e69de29..0000000