-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- v5.0
- v4.20
- v4.19
- v4.18
- v4.17
- v4.16
- v4.15
- v4.14
- v4.13
- v4.12
- v4.11
- v4.10
- v4.9
- v4.8
- v4.7
- v4.6
- v4.5
- v4.4
- v4.3
- v4.2
- v4.1
- v4.0
- v3.107
- v3.106
- v3.105
- v3.104
- v3.103
- v3.102
- v3.101
- v3.100
- v3.99
- v3.98
- v3.97
- v3.96
- v3.95
- v3.94
- v3.93
- v3.92
- v3.91
- v3.90
- v3.89
- v3.88
- v3.87
- v3.86
- v3.85
- v3.84
- v3.83
- v3.82
- v3.81
- v3.80
- v3.79
- v3.78
- v3.77
- v3.76
- v3.75
- v3.74
- v3.73
- v3.72
- v3.71
- v3.70
- v3.69
- v3.68
- v3.67
- v3.66
- v3.65
- v3.64
- v3.63
- v3.62
- v3.61
- v3.60
- v3.59
- v3.58
- v3.57
- v3.56
- v3.55
- v3.54
- v3.53
- v3.52
- v3.51
- v3.50
- v3.49
- v3.48
- v3.47
- v3.46
- v3.45
- v3.44
- v3.43
- v3.42
- v3.41
- v3.40
- v3.39
- v3.38
- v3.37
- v3.36
- v3.35
- v3.34
- v3.33
- v3.32
- v3.31
- v3.30
- v3.29
- v3.28
- v3.27
- v3.26
- v3.25
- v3.24
- v3.23
- v3.22
- v3.21
- v3.20
- v3.19
- v3.18
- v3.17
- v3.16
- v3.15
- v3.14
- v3.13
- v3.12
- v3.11
- v3.10
- v3.9
- v3.8
- v3.7
- v3.6
- v3.5
- v3.4
- v3.3
- v3.2
- v3.1
- v3.0
- v2.71828182
- v2.11
- v2.10
- v2.9
- v2.8
- vℇ
Showing
3 changed files
with
369 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
__dir__="$(cd "$(dirname "$0")" && pwd)" | ||
|
||
function rbx_github_release_url { | ||
echo "https://api.github.com/repos/rubinius/rubinius/releases" | ||
} | ||
|
||
function rbx_github_release { | ||
local version date request response upload_url | ||
|
||
version=$1 | ||
date=$2 | ||
|
||
request=$(printf '{ | ||
"tag_name": "v%s", | ||
"target_commitish": "master", | ||
"name": "Release %s", | ||
"body": "Version %s (%s)", | ||
"draft": false, | ||
"prerelease": false | ||
}' "$version" "$version" "$version" "$date") | ||
|
||
response=$(curl --data "$request" \ | ||
"$(rbx_github_release_url)?access_token=$GITHUB_OAUTH_TOKEN") | ||
|
||
if [ $? -ne 0 ]; then | ||
return | ||
fi | ||
|
||
upload_url=$(echo "$response" | "$__dir__/json.sh" -b | \ | ||
egrep '\["upload_url"\][[:space:]]\"[^"]+\"' | egrep -o '\"[^"]+{') | ||
|
||
let i=${#upload_url} | ||
|
||
echo "${upload_url:1:$i-2}" | ||
} | ||
|
||
function rbx_github_release_assets { | ||
local upload_url name src file_exts | ||
|
||
upload_url=$1 | ||
name=$2 | ||
|
||
file_exts=("" ".sha512") | ||
|
||
for ext in "${file_exts[@]}"; do | ||
src="$name$ext" | ||
|
||
curl -X PUT -T "$src" \ | ||
-H "Content-Type: $(file --mime-type -b "$src")" \ | ||
"$upload_url?name=$src&access_token=$GITHUB_OAUTH_TOKEN" | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# From https://github.com/dominictarr/JSON.sh | ||
# Original License: MIT | ||
# https://github.com/dominictarr/JSON.sh/blob/master/LICENSE.MIT | ||
|
||
throw () { | ||
echo "$*" >&2 | ||
exit 1 | ||
} | ||
|
||
BRIEF=0 | ||
LEAFONLY=0 | ||
PRUNE=0 | ||
NORMALIZE_SOLIDUS=0 | ||
|
||
usage() { | ||
echo | ||
echo "Usage: JSON.sh [-b] [-l] [-p] [-s] [-h]" | ||
echo | ||
echo "-p - Prune empty. Exclude fields with empty values." | ||
echo "-l - Leaf only. Only show leaf nodes, which stops data duplication." | ||
echo "-b - Brief. Combines 'Leaf only' and 'Prune empty' options." | ||
echo "-s - Remove escaping of the solidus symbol (stright slash)." | ||
echo "-h - This help text." | ||
echo | ||
} | ||
|
||
parse_options() { | ||
set -- "$@" | ||
local ARGN=$# | ||
while [ "$ARGN" -ne 0 ] | ||
do | ||
case $1 in | ||
-h) usage | ||
exit 0 | ||
;; | ||
-b) BRIEF=1 | ||
LEAFONLY=1 | ||
PRUNE=1 | ||
;; | ||
-l) LEAFONLY=1 | ||
;; | ||
-p) PRUNE=1 | ||
;; | ||
-s) NORMALIZE_SOLIDUS=1 | ||
;; | ||
?*) echo "ERROR: Unknown option." | ||
usage | ||
exit 0 | ||
;; | ||
esac | ||
shift 1 | ||
ARGN=$((ARGN-1)) | ||
done | ||
} | ||
|
||
awk_egrep () { | ||
local pattern_string=$1 | ||
|
||
gawk '{ | ||
while ($0) { | ||
start=match($0, pattern); | ||
token=substr($0, start, RLENGTH); | ||
print token; | ||
$0=substr($0, start+RLENGTH); | ||
} | ||
}' pattern="$pattern_string" | ||
} | ||
|
||
tokenize () { | ||
local GREP | ||
local ESCAPE | ||
local CHAR | ||
|
||
if echo "test string" | egrep -ao --color=never "test" &>/dev/null | ||
then | ||
GREP='egrep -ao --color=never' | ||
else | ||
GREP='egrep -ao' | ||
fi | ||
|
||
if echo "test string" | egrep -o "test" &>/dev/null | ||
then | ||
ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' | ||
CHAR='[^[:cntrl:]"\\]' | ||
else | ||
GREP=awk_egrep | ||
ESCAPE='(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' | ||
CHAR='[^[:cntrl:]"\\\\]' | ||
fi | ||
|
||
local STRING="\"$CHAR*($ESCAPE$CHAR*)*\"" | ||
local NUMBER='-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?' | ||
local KEYWORD='null|false|true' | ||
local SPACE='[[:space:]]+' | ||
|
||
$GREP "$STRING|$NUMBER|$KEYWORD|$SPACE|." | egrep -v "^$SPACE$" | ||
} | ||
|
||
parse_array () { | ||
local index=0 | ||
local ary='' | ||
read -r token | ||
case "$token" in | ||
']') ;; | ||
*) | ||
while : | ||
do | ||
parse_value "$1" "$index" | ||
index=$((index+1)) | ||
ary="$ary""$value" | ||
read -r token | ||
case "$token" in | ||
']') break ;; | ||
',') ary="$ary," ;; | ||
*) throw "EXPECTED , or ] GOT ${token:-EOF}" ;; | ||
esac | ||
read -r token | ||
done | ||
;; | ||
esac | ||
[ "$BRIEF" -eq 0 ] && value=$(printf '[%s]' "$ary") || value= | ||
: | ||
} | ||
|
||
parse_object () { | ||
local key | ||
local obj='' | ||
read -r token | ||
case "$token" in | ||
'}') ;; | ||
*) | ||
while : | ||
do | ||
case "$token" in | ||
'"'*'"') key=$token ;; | ||
*) throw "EXPECTED string GOT ${token:-EOF}" ;; | ||
esac | ||
read -r token | ||
case "$token" in | ||
':') ;; | ||
*) throw "EXPECTED : GOT ${token:-EOF}" ;; | ||
esac | ||
read -r token | ||
parse_value "$1" "$key" | ||
obj="$obj$key:$value" | ||
read -r token | ||
case "$token" in | ||
'}') break ;; | ||
',') obj="$obj," ;; | ||
*) throw "EXPECTED , or } GOT ${token:-EOF}" ;; | ||
esac | ||
read -r token | ||
done | ||
;; | ||
esac | ||
[ "$BRIEF" -eq 0 ] && value=$(printf '{%s}' "$obj") || value= | ||
: | ||
} | ||
|
||
parse_value () { | ||
local jpath="${1:+$1,}$2" isleaf=0 isempty=0 print=0 | ||
case "$token" in | ||
'{') parse_object "$jpath" ;; | ||
'[') parse_array "$jpath" ;; | ||
# At this point, the only valid single-character tokens are digits. | ||
''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;; | ||
*) value=$token | ||
# if asked, replace solidus ("\/") in json strings with normalized value: "/" | ||
[ "$NORMALIZE_SOLIDUS" -eq 1 ] && value=${value//\\\//\/} | ||
isleaf=1 | ||
[ "$value" = '""' ] && isempty=1 | ||
;; | ||
esac | ||
[ "$value" = '' ] && return | ||
[ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 0 ] && print=1 | ||
[ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && [ $PRUNE -eq 0 ] && print=1 | ||
[ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 1 ] && [ "$isempty" -eq 0 ] && print=1 | ||
[ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && \ | ||
[ $PRUNE -eq 1 ] && [ $isempty -eq 0 ] && print=1 | ||
[ "$print" -eq 1 ] && printf "[%s]\t%s\n" "$jpath" "$value" | ||
: | ||
} | ||
|
||
parse () { | ||
read -r token | ||
parse_value | ||
read -r token | ||
case "$token" in | ||
'') ;; | ||
*) throw "EXPECTED EOF GOT $token" ;; | ||
esac | ||
} | ||
|
||
if ([ "$0" = "$BASH_SOURCE" ] || ! [ -n "$BASH_SOURCE" ]); | ||
then | ||
parse_options "$@" | ||
tokenize | parse | ||
fi |