Skip to content

Commit 8e0177b

Browse files
committed
Bump Bash implementation
Also change method of installation as npm way is stale
1 parent 731d068 commit 8e0177b

File tree

12 files changed

+40
-65
lines changed

12 files changed

+40
-65
lines changed

docs/results/empty.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ <h4 id="Bash_JSONPath.sh">
1818
Bash (JSONPath.sh)
1919
</h4>
2020

21-
<pre><code>[
22-
42,
23-
21
24-
]
21+
<pre><code>[]
2522
</code></pre>
2623

2724
<h4 id="Clojure_json-path">

docs/results/filter_expression_with_equals_array.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ <h4 id="Bash_JSONPath.sh">
7070
Bash (JSONPath.sh)
7171
</h4>
7272

73-
<pre><code>[]
73+
<pre><code>[
74+
1
75+
]
7476
</code></pre>
7577

7678
<h4 id="C_json-glib">

docs/results/filter_expression_with_equals_array_with_single_quotes.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ <h4 id="Bash_JSONPath.sh">
7070
Bash (JSONPath.sh)
7171
</h4>
7272

73-
<pre><code>[]
73+
<pre><code>[
74+
1
75+
]
7476
</code></pre>
7577

7678
<h4 id="C_json-glib">

implementations/Bash_JSONPath.sh/build.ninja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ root = implementations/Bash_JSONPath.sh
22
builddir = $root/build
33

44
rule install
5-
command = (cd $root && npm install) && echo > $out
5+
command = rm -rf $out && $root/install.sh $out
66

7-
build $builddir/node_modules_installed: install | $root/package.json $root/package-lock.json
7+
build $builddir/JSONPath.sh: install | $root/install.sh $root/tag
88

9-
build $root/install: phony $builddir/node_modules_installed
9+
build $root/install: phony $builddir/JSONPath.sh

implementations/Bash_JSONPath.sh/ensure_deps.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test_gnu_compat() {
1212
>&2 echo "Make sure you have GNU coreutils installed"
1313
fi
1414

15-
if grep --version &> /dev/null && grep --version | grep 'BSD' &> /dev/null; then
15+
if grep --version | grep 'BSD' &> /dev/null; then
1616
error=1
1717
>&2 echo "Make sure you have GNU grep or compatible installed"
1818
fi
@@ -22,18 +22,22 @@ test_gnu_compat() {
2222
>&2 echo "Make sure you have GNU sed or compatible installed"
2323
fi
2424

25-
if [[ $error -gt 0 && is_osx ]]; then
25+
if [[ $error -gt 0 ]] && is_osx; then
2626
>&2 echo "With homebrew you may install necessary deps via \`brew install grep gnu-sed coreutils\`"
27+
>&2 echo 'Put /opt/homebrew/bin/gsed early in your PATH'
28+
>&2 echo 'Then put /opt/homebrew/bin/ggrep early in your PATH'
29+
>&2 echo 'And put /opt/homebrew/var/homebrew/linked/coreutils/libexec/gnubin early in your PATH'
30+
>&2 echo "For example: PATH=$PATH"
2731
fi
2832

29-
return $error
33+
return "$error"
3034
}
3135

3236
main() {
3337
if is_osx; then
34-
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
35-
export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"
36-
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
38+
export PATH="/opt/homebrew/bin/gsed:$PATH"
39+
export PATH="/opt/homebrew/bin/ggrep:$PATH"
40+
export PATH="/opt/homebrew/var/homebrew/linked/coreutils/libexec/gnubin:$PATH"
3741
fi
3842

3943
test_gnu_compat
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
readonly script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
6+
tag="$(cat "${script_dir}/tag")"
7+
version="$(sed 's/^v//' <<< "$tag")"
8+
9+
readonly source_url="https://raw.githubusercontent.com/mclarkson/JSONPath.sh/${tag}/JSONPath.sh"
10+
readonly target_path="$1"
11+
12+
curl --fail -L "$source_url" -o "$target_path"
13+
chmod a+x "$target_path"

implementations/Bash_JSONPath.sh/package-lock.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

implementations/Bash_JSONPath.sh/package.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

implementations/Bash_JSONPath.sh/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ output_and_cleanup() {
3030
trap output_and_cleanup EXIT
3131

3232
cd "$script_dir"
33-
./ensure_deps.sh ./node_modules/jsonpath.sh/JSONPath.sh "$@" | cut -f2 | lines_to_json_array > "$tmp_stdout" 2> "$tmp_stderr"
33+
./ensure_deps.sh ./build/JSONPath.sh "$@" | cut -f2 | lines_to_json_array > "$tmp_stdout" 2> "$tmp_stderr"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.0.20

0 commit comments

Comments
 (0)