dev-cmd/generate-*-api: be a bit safer.
- also try generating formula API on macOS - pull more logic out of `unless args.dry_run?` in case it fails
This commit is contained in:
parent
6b012b6592
commit
e1a7afb3cf
5
.github/workflows/tests.yml
vendored
5
.github/workflows/tests.yml
vendored
@ -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
|
||||
|
||||
|
||||
@ -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}'."
|
||||
|
||||
@ -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}'."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user