Skip to content

Commit 7cb059d

Browse files
authored
Merge pull request docker-library#475 from docker-library/jq-IN
Use jq's `IN()` instead of `index()`
2 parents 4e09dcf + d49362d commit 7cb059d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: Dockerfile.template

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ RUN set -eux; \
6363
{{ if is_alpine then ( -}}
6464
apk add --no-cache --virtual .ruby-builddeps \
6565
autoconf \
66-
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
66+
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
6767
{{ # https://github.com/docker-library/ruby/pull/438 -}}
6868
bison \
6969
{{ ) else "" end -}}
@@ -87,7 +87,7 @@ RUN set -eux; \
8787
openssl-dev \
8888
patch \
8989
procps \
90-
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
90+
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
9191
readline-dev \
9292
{{ ) else "" end -}}
9393
ruby \
@@ -100,7 +100,7 @@ RUN set -eux; \
100100
savedAptMark="$(apt-mark showmanual)"; \
101101
apt-get update; \
102102
apt-get install -y --no-install-recommends \
103-
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
103+
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
104104
{{ # https://github.com/docker-library/ruby/pull/438 -}}
105105
bison \
106106
{{ ) else "" end -}}
@@ -115,7 +115,7 @@ RUN set -eux; \
115115
libgdbm-compat-dev \
116116
libglib2.0-dev \
117117
libncurses-dev \
118-
{{ if [ "3.1", "3.2" ] | index(env.version | rtrimstr("-rc")) then ( -}}
118+
{{ if env.version | rtrimstr("-rc") | IN("3.1", "3.2") then ( -}}
119119
libreadline-dev \
120120
{{ ) else "" end -}}
121121
libxml2-dev \

Diff for: versions.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ for version in "${versions[@]}"; do
100100
*)
101101
# YJIT
102102
doc="$(jq <<<"$doc" -sc '
103-
.[1][].arches? |= if . then with_entries(select(.key as $arch | [
103+
.[1][].arches? |= if . then with_entries(select(.key | IN(
104104
# 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")
105105
# https://github.com/ruby/ruby/blob/v3_2_0/configure.ac#L3757-L3761
106106
"amd64",
107107
"arm64v8",
108108
empty # trailing comma
109-
] | index($arch))) else empty end
109+
))) else empty end
110110
| add
111111
' - rust.json)"
112112
;;

0 commit comments

Comments
 (0)