diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13fa4838f7..a9f5478912 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -167,7 +167,7 @@ jobs: id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master with: - core: false + core: true cask: true test-bot: false @@ -195,6 +195,9 @@ jobs: brew audit --skip-style --except=version --tap=homebrew/cask-fonts brew audit --skip-style --except=version --tap=homebrew/cask-versions + - name: Generate formula API + run: brew generate-formula-api --dry-run + - name: Generate cask API run: brew generate-cask-api --dry-run diff --git a/Library/Homebrew/dev-cmd/generate-cask-api.rb b/Library/Homebrew/dev-cmd/generate-cask-api.rb index e888e4c3e1..cb092edba7 100644 --- a/Library/Homebrew/dev-cmd/generate-cask-api.rb +++ b/Library/Homebrew/dev-cmd/generate-cask-api.rb @@ -52,7 +52,8 @@ module Homebrew end Homebrew.with_no_api_env do - File.write("api/cask_tap_migrations.json", JSON.dump(tap.tap_migrations)) unless args.dry_run? + tap_migrations_json = JSON.dump(tap.tap_migrations) + File.write("api/cask_tap_migrations.json", tap_migrations_json) unless args.dry_run? Cask::Cask.generating_hash! @@ -60,12 +61,14 @@ module Homebrew cask = Cask::CaskLoader.load(path) name = cask.token json = JSON.pretty_generate(cask.to_hash_with_variations) + cask_source = path.read + html_template_name = html_template(name) unless args.dry_run? File.write("_data/cask/#{name}.json", "#{json}\n") File.write("api/cask/#{name}.json", CASK_JSON_TEMPLATE) - File.write("api/cask-source/#{name}.rb", path.read) - File.write("cask/#{name}.html", html_template(name)) + File.write("api/cask-source/#{name}.rb", cask_source) + File.write("cask/#{name}.html", html_template_name) end rescue onoe "Error while generating data for cask '#{path.stem}'." diff --git a/Library/Homebrew/dev-cmd/generate-formula-api.rb b/Library/Homebrew/dev-cmd/generate-formula-api.rb index f26a2ac495..46a6a83a25 100644 --- a/Library/Homebrew/dev-cmd/generate-formula-api.rb +++ b/Library/Homebrew/dev-cmd/generate-formula-api.rb @@ -53,7 +53,8 @@ module Homebrew end Homebrew.with_no_api_env do - File.write("api/formula_tap_migrations.json", JSON.dump(tap.tap_migrations)) unless args.dry_run? + tap_migrations_json = JSON.dump(tap.tap_migrations) + File.write("api/formula_tap_migrations.json", tap_migrations_json) unless args.dry_run? Formulary.enable_factory_cache! Formula.generating_hash! @@ -62,11 +63,12 @@ module Homebrew formula = Formulary.factory(name) name = formula.name json = JSON.pretty_generate(formula.to_hash_with_variations) + html_template_name = html_template(name) unless args.dry_run? File.write("_data/formula/#{name.tr("+", "_")}.json", "#{json}\n") File.write("api/formula/#{name}.json", FORMULA_JSON_TEMPLATE) - File.write("formula/#{name}.html", html_template(name)) + File.write("formula/#{name}.html", html_template_name) end rescue onoe "Error while generating data for formula '#{name}'."