Skip to content

Commit

Permalink
Remove cask-source and versions APIs
Browse files Browse the repository at this point in the history
These are no longer needed after
Homebrew/brew#14439 and
Homebrew/brew#14500 are merged and in a stable
tag.
  • Loading branch information
MikeMcQuaid committed Feb 4, 2023
1 parent f06684a commit b9dbef8
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 88 deletions.
23 changes: 0 additions & 23 deletions _includes/api-samples/versions_casks.md

This file was deleted.

15 changes: 0 additions & 15 deletions _includes/api-samples/versions_formulae.md

This file was deleted.

33 changes: 0 additions & 33 deletions docs/api.md
Expand Up @@ -22,23 +22,6 @@ GET https://formulae.brew.sh/api/cask.json

{% include api-samples/formula.md %}

### List the latest versions for all {{ site.taps.core.name }} formulae or {{ site.taps.cask.name }} casks

List the latest version information for each formula or cask in the given tap. The result is a single JSON object with formula/cask names as keys. The values are JSON objects containing `version` and, for formulae, `revision` keys.

```
GET https://formulae.brew.sh/api/versions-formulae.json
GET https://formulae.brew.sh/api/versions-casks.json
```

#### [Formulae Response](https://formulae.brew.sh/api/versions-formulae.json)

{% include api-samples/versions_formulae.md %}

#### [Casks Response](https://formulae.brew.sh/api/versions-casks.json)

{% include api-samples/versions_casks.md %}

### Get formula metadata for a {{ site.taps.core.name }} formula

Get the `brew info --json --formula <formula>` output for a single, current {{ site.taps.core.fullname }} formula with extra keys containing analytics data and generation date.
Expand Down Expand Up @@ -87,22 +70,6 @@ GET https://formulae.brew.sh/api/cask/${FORMULA}.json

{% include api-samples/cask_docker.md %}

### Get the source code for a cask in {{ site.taps.cask.fullname }}

Get the latest source code for a cask that is defined in the {{ site.taps.cask.fullname }} repo.

```
GET https://formulae.brew.sh/api/cask-source/${FORMULA}.rb
```

#### Variables

- `${FORMULA}`: the name of the cask, e.g. `vagrant`

#### [Response](https://formulae.brew.sh/api/cask-source/vagrant.json)

{% include api-samples/cask_source_vagrant.md %}

## Analytics

### List one category of analytics events
Expand Down
15 changes: 0 additions & 15 deletions script/generate-api-samples.rb
Expand Up @@ -6,11 +6,8 @@
analytics_install_homebrew_core_30d: "analytics/install/homebrew-core/30d.json",
bottle_wget: "bottle/wget.json",
cask_docker: "cask/docker.json",
cask_source_vagrant: "cask-source/vagrant.rb",
formula_wget: "formula/wget.json",
formula: "formula.json",
versions_casks: "versions-casks.json",
versions_formulae: "versions-formulae.json",
}.freeze

def generate_api_samples
Expand Down Expand Up @@ -62,14 +59,6 @@ def format_json_contents(name, api_url)
contents.select! do |obj|
obj["name"] == "wget"
end
when :versions_casks
contents.select! do |cask_token, _|
%w[docker onyx].include? cask_token
end
when :versions_formulae
contents.select! do |formula_name, _|
%w[wget zsh].include? formula_name
end
end

contents = JSON.pretty_generate contents
Expand All @@ -94,10 +83,6 @@ def format_json_contents(name, api_url)
when :formula
contents.sub!(/^\[/, "[\n ...")
contents.sub!(/}(?=\n\])/, "},\n ...")
when :versions_casks, :versions_formulae
contents.sub!(/^{/, "{\n ...")
contents.sub!(/( },)(?=\n ")/, "\\1\n ...")
contents.sub!(/}(?=\n})/, "},\n ...")
end

codify contents, language: "json"
Expand Down
3 changes: 1 addition & 2 deletions script/generate-cask.rb
Expand Up @@ -4,7 +4,7 @@
tap_name = ARGV.first
tap = Tap.fetch(tap_name)

directories = ["_data/cask", "api/cask", "api/cask-source", "cask"]
directories = ["_data/cask", "api/cask", "cask"]
FileUtils.rm_rf directories
FileUtils.mkdir_p directories

Expand All @@ -15,6 +15,5 @@
c = Cask::CaskLoader.load(p)
IO.write("_data/cask/#{c.token}.json", "#{JSON.pretty_generate(c.to_hash_with_variations)}\n")
IO.write("api/cask/#{c.token}.json", json_template)
IO.write("api/cask-source/#{c.token}.rb", p.read)
IO.write("cask/#{c.token}.html", html_template.gsub("title: $TITLE", "title: \"#{c.token}\""))
end

0 comments on commit b9dbef8

Please sign in to comment.