Skip to content

Commit

Permalink
Merge pull request #1151 from EricFromCanada/master
Browse files Browse the repository at this point in the history
fixes for versioned casks' API and analytics
  • Loading branch information
MikeMcQuaid authored May 1, 2024
2 parents 2b352ee + f9f3dd5 commit 803abda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion _layouts/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h4>Total Events: {{ analytics_data.total_count }}</h4>
{%- elsif page.category == "homebrew-versions" -%}
<code>{{ item.version | escape }}</code>
{%- 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 -%}
<a href="{{ site.baseurl }}/cask/{{ item.cask | uri_escape }}"><code>{{ item.cask | escape }}</code></a>
{%- else -%}
<code>{{ item.cask | escape }}</code>
Expand Down
14 changes: 8 additions & 6 deletions _layouts/cask_json.json
Original file line number Diff line number Diff line change
@@ -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 -%}
Expand All @@ -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" }}"}

0 comments on commit 803abda

Please sign in to comment.