From 83ecb35ccbb43d7b84e7cb0bde5fe85de6fe53fd Mon Sep 17 00:00:00 2001 From: Eric Knibbe Date: Wed, 1 May 2024 01:22:54 -0400 Subject: [PATCH 1/2] fix missing data in versioned casks' API --- _layouts/cask_json.json | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/_layouts/cask_json.json b/_layouts/cask_json.json index f6f72fbf5a57..df10c049c034 100644 --- a/_layouts/cask_json.json +++ b/_layouts/cask_json.json @@ -1,7 +1,8 @@ --- --- -{%- assign token = page.name | remove: ".json" -%} -{%- assign cask = site.data.cask[token] -%} +{%- assign full_name = page.name | remove: ".json" -%} +{%- assign data_name = full_name | remove: "@" | remove: "." | replace: "+", "_" -%} +{%- assign cask = site.data.cask[data_name] -%} { {%- for key_value in cask -%} @@ -11,19 +12,20 @@ "analytics":{"install":{ {%- for interval in site.analytics.intervals -%} "{{ interval.path }}":{ - {%- if site.data.analytics.cask-install.homebrew-cask[interval.path].formulae[token].size > 0 -%} - {%- for fa in site.data.analytics.cask-install.homebrew-cask[interval.path].formulae[token] -%} + {%- if site.data.analytics.cask-install.homebrew-cask[interval.path].formulae[full_name].size > 0 -%} + {%- for fa in site.data.analytics.cask-install.homebrew-cask[interval.path].formulae[full_name] -%} {{ fa.cask | jsonify }}:{{ fa.count | remove: "," | plus: 0 }} {%- unless forloop.last -%} , {%- endunless -%} {%- endfor -%} {%- else -%} - {{ token | jsonify }}:0 + {{ full_name | jsonify }}:0 {%- endif -%} } {%- unless forloop.last -%} , {%- endunless -%} {%- endfor -%} -}},"generated_date":"{{ "today" | date: "%F" }}"} +}}, +"generated_date":"{{ "today" | date: "%F" }}"} From f9f3dd591b8d7fb979c20f948d44b996e64786e9 Mon Sep 17 00:00:00 2001 From: Eric Knibbe Date: Wed, 1 May 2024 01:23:33 -0400 Subject: [PATCH 2/2] fix linking to versioned casks from analytics --- _layouts/analytics.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_layouts/analytics.html b/_layouts/analytics.html index ba831625c461..d9d19cde3a6b 100644 --- a/_layouts/analytics.html +++ b/_layouts/analytics.html @@ -54,7 +54,8 @@

Total Events: {{ analytics_data.total_count }}

{%- elsif page.category == "homebrew-versions" -%} {{ item.version | escape }} {%- elsif page.category == "cask-install" -%} - {%- if site.data.cask[item.cask] != nil -%} + {%- assign data_name = item.cask | remove: "@" | remove: "." | replace: "+", "_" -%} + {%- if site.data.cask[data_name] != nil -%} {{ item.cask | escape }} {%- else -%} {{ item.cask | escape }}