Skip to content

Commit

Permalink
Use jq's IN() instead of index()
Browse files Browse the repository at this point in the history
The end result is the same, but the construction is more ergonomic.
  • Loading branch information
tianon committed Oct 16, 2024
1 parent 4e09dcf commit d49362d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN set -eux; \
{{ if is_alpine then ( -}}
apk add --no-cache --virtual .ruby-builddeps \
autoconf \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
{{ # https://github.com/docker-library/ruby/pull/438 -}}
bison \
{{ ) else "" end -}}
Expand All @@ -87,7 +87,7 @@ RUN set -eux; \
openssl-dev \
patch \
procps \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
readline-dev \
{{ ) else "" end -}}
ruby \
Expand All @@ -100,7 +100,7 @@ RUN set -eux; \
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
{{ # https://github.com/docker-library/ruby/pull/438 -}}
bison \
{{ ) else "" end -}}
Expand All @@ -115,7 +115,7 @@ RUN set -eux; \
libgdbm-compat-dev \
libglib2.0-dev \
libncurses-dev \
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
libreadline-dev \
{{ ) else "" end -}}
libxml2-dev \
Expand Down
4 changes: 2 additions & 2 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ for version in "${versions[@]}"; do
*)
# YJIT
doc="$(jq <<<"$doc" -sc '
.[1][].arches? |= if . then with_entries(select(.key as $arch | [
.[1][].arches? |= if . then with_entries(select(.key | IN(
# https://github.com/ruby/ruby/blob/v3_2_0/doc/yjit/yjit.md ("currently supported for macOS and Linux on x86-64 and arm64/aarch64 CPUs")
# https://github.com/ruby/ruby/blob/v3_2_0/configure.ac#L3757-L3761
"amd64",
"arm64v8",
empty # trailing comma
] | index($arch))) else empty end
))) else empty end
| add
' - rust.json)"
;;
Expand Down

0 comments on commit d49362d

Please sign in to comment.