alox-jason 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metadata +2 -6
- data/libexec/_jason +0 -200
- data/libexec/_log4sh +0 -3841
- data/libexec/_shflags +0 -1012
- data/libexec/_sub +0 -60
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: alox-jason
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.22
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -19,11 +19,7 @@ email:
|
|
|
19
19
|
executables: []
|
|
20
20
|
extensions: []
|
|
21
21
|
extra_rdoc_files: []
|
|
22
|
-
files:
|
|
23
|
-
- libexec/_jason
|
|
24
|
-
- libexec/_log4sh
|
|
25
|
-
- libexec/_shflags
|
|
26
|
-
- libexec/_sub
|
|
22
|
+
files: []
|
|
27
23
|
homepage: https://github.com/destructuring/jason
|
|
28
24
|
licenses: []
|
|
29
25
|
post_install_message:
|
data/libexec/_jason
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
if [[ -z "${shome:-}" ]]; then
|
|
4
|
-
shome="$(unset CDPATH; cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
|
|
5
|
-
fi
|
|
6
|
-
|
|
7
|
-
function check_help {
|
|
8
|
-
# taken from shocco
|
|
9
|
-
if expr -- "$*" : ".*--help" >/dev/null; then
|
|
10
|
-
display_help
|
|
11
|
-
exit 0
|
|
12
|
-
fi
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function display_help {
|
|
16
|
-
flags_help
|
|
17
|
-
echo
|
|
18
|
-
|
|
19
|
-
# taken from shocco
|
|
20
|
-
grep '^#/' <"$shome/$(basename $(dirname -- "$0"))/$(basename -- "$0")" | cut -c4-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# Exits the script with the last error code. Servers as a marker in $0 to
|
|
24
|
-
# begin ronn documentation until end of file.
|
|
25
|
-
function __MAN__ {
|
|
26
|
-
exit "$!"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
# Extracts ronn-style Markdown after __MAN__ to stdout. If a line is "MAN", it
|
|
30
|
-
# is assumed that a here document is used (for syntactical reasons).
|
|
31
|
-
#
|
|
32
|
-
# A limitation of detecting "MAN" will truncate the Markdown if "MAN" is a
|
|
33
|
-
# legimate text.
|
|
34
|
-
#
|
|
35
|
-
# __MAN__ << "MAN"
|
|
36
|
-
# raw ronn-style Markdown
|
|
37
|
-
# MAN
|
|
38
|
-
function display_man {
|
|
39
|
-
awk '/^__MAN__/,/^MAN$/ {print}' <"$0" | tail -n +2 | egrep -v '^MAN$'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function display_synopsis {
|
|
43
|
-
awk '/^#/ && !/^#!/ { print } /^[^#]/ || /^$/ { exit }' <"$0" | cut -c3-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function which_library {
|
|
47
|
-
local library="$1"; shift
|
|
48
|
-
if [[ -r "$shome/vendor/projects/$library/libexec/_$library" ]]; then
|
|
49
|
-
echo "$shome/vendor/projects/$library/libexec/_$library"
|
|
50
|
-
elif [[ -r "$shome/libexec/_$library" ]]; then
|
|
51
|
-
echo "$shome/libexec/_$library"
|
|
52
|
-
elif [[ -r "$shome/.$library/libexec/_$library" ]]; then
|
|
53
|
-
echo "$shome/.$library/libexec/_$library"
|
|
54
|
-
else
|
|
55
|
-
local nm_library="${library%%/*}"
|
|
56
|
-
if [[ "$nm_library" != "$library" ]]; then
|
|
57
|
-
local nm_right="${library##*/}"
|
|
58
|
-
if [[ -r "$shome/vendor/projects/$nm_library/libexec/_$nm_right" ]]; then
|
|
59
|
-
echo "$shome/vendor/projects/$nm_library/libexec/_$nm_right"
|
|
60
|
-
elif [[ -r "$shome/.$nm_library/libexec/_$nm_right" ]]; then
|
|
61
|
-
echo "$shome/.$nm_library/libexec/_$nm_right"
|
|
62
|
-
fi
|
|
63
|
-
fi
|
|
64
|
-
fi
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function require {
|
|
68
|
-
local nm_library="$1"; shift
|
|
69
|
-
local pth_lib="$(which_library "$nm_library")"
|
|
70
|
-
if [[ -r "$pth_lib" ]]; then
|
|
71
|
-
if [[ "$#" == 0 ]]; then
|
|
72
|
-
set --
|
|
73
|
-
fi
|
|
74
|
-
source "$pth_lib" "$@"
|
|
75
|
-
else
|
|
76
|
-
logger_warn "library $nm_library not found"
|
|
77
|
-
fi
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function parse_command_line {
|
|
81
|
-
if [[ "$FLAGS_SUB" = "$FLAGS_TRUE" && "$@" > 0 ]]; then
|
|
82
|
-
export POSIXLY_CORRECT=1
|
|
83
|
-
fi
|
|
84
|
-
|
|
85
|
-
if ! FLAGS "$@"; then
|
|
86
|
-
unset POSIXLY_CORRECT
|
|
87
|
-
if [[ "$flags_error" = "help requested" ]]; then
|
|
88
|
-
echo ""
|
|
89
|
-
display_help
|
|
90
|
-
exit 0
|
|
91
|
-
fi
|
|
92
|
-
|
|
93
|
-
return 4
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
unset POSIXLY_CORRECT
|
|
97
|
-
return 0
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function configure_logging {
|
|
101
|
-
# load log4sh (disabling properties file warning) and clear the default
|
|
102
|
-
# configuration
|
|
103
|
-
LOG4SH_CONFIGURATION='none' require 'log4sh'
|
|
104
|
-
log4sh_resetConfiguration
|
|
105
|
-
|
|
106
|
-
# set the global logging level to INFO
|
|
107
|
-
logger_setLevel INFO
|
|
108
|
-
|
|
109
|
-
# add and configure a FileAppender that outputs to STDERR, and activate the
|
|
110
|
-
# configuration
|
|
111
|
-
logger_addAppender stderr
|
|
112
|
-
appender_setType stderr FileAppender
|
|
113
|
-
appender_file_setFile stderr STDERR
|
|
114
|
-
appender_activateOptions stderr
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function ryaml {
|
|
118
|
-
ruby -ryaml -e 'def ps x; unless x.nil?; puts (x.class == String || x.class == Fixnum) ? x : x.to_yaml; end; end; ps ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[acc.class == Array ? key.to_i : key] }' "$@" 2>&-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function random_str {
|
|
122
|
-
echo "$(date +%s).$$.$RANDOM"
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function runmany {
|
|
126
|
-
local cpu="$1"; shift
|
|
127
|
-
local args="$1"; shift
|
|
128
|
-
local cmd="$1"; shift
|
|
129
|
-
if [[ "$#" = 0 ]]; then
|
|
130
|
-
cat
|
|
131
|
-
else
|
|
132
|
-
echo "$@"
|
|
133
|
-
fi | xargs -P $cpu -n $args -- bash -c "$cmd" ""
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function mark_log {
|
|
137
|
-
local nm_mark="$1"; shift
|
|
138
|
-
touch "$tmp_switch/wait-$nm_mark"
|
|
139
|
-
echo $tmp_switch $nm_mark
|
|
140
|
-
while [[ -f "$tmp_switch/wait-$nm_mark" ]]; do
|
|
141
|
-
sleep 1
|
|
142
|
-
done
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function marked_logger {
|
|
146
|
-
local nm_switch=""
|
|
147
|
-
while read -r a b; do
|
|
148
|
-
if [[ "$a" = "$tmp_switch" ]]; then
|
|
149
|
-
nm_switch="$b"
|
|
150
|
-
rm "$tmp_switch/wait-$nm_switch"
|
|
151
|
-
else
|
|
152
|
-
if [[ -z "$nm_switch" ]]; then
|
|
153
|
-
echo "$a $b"
|
|
154
|
-
else
|
|
155
|
-
echo "$nm_switch: $a $b"
|
|
156
|
-
fi
|
|
157
|
-
fi
|
|
158
|
-
done
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function mark_stdout {
|
|
162
|
-
if [[ -z "${tmp_switch:-}" ]]; then
|
|
163
|
-
tmp_switch="$(mktemp -d -t XXXXXXXXX)"
|
|
164
|
-
fi
|
|
165
|
-
exec 1> >(marked_logger)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function mark_stderr {
|
|
169
|
-
if [[ -z "${tmp_switch:-}" ]]; then
|
|
170
|
-
tmp_switch="$(mktemp -d -t XXXXXXXXX)"
|
|
171
|
-
fi
|
|
172
|
-
exec 2> >(marked_logger)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function mark_output {
|
|
176
|
-
if [[ -z "${tmp_switch:-}" ]]; then
|
|
177
|
-
tmp_switch="$(mktemp -d -t XXXXXXXXX)"
|
|
178
|
-
fi
|
|
179
|
-
exec 1> >(marked_logger) 2>&1
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function _main {
|
|
183
|
-
if [[ -z "$shome" ]]; then
|
|
184
|
-
shome="$(unset CDPATH; cd -P -- "$(dirname -- "${BASH_SOURCE}")/.." && pwd -P)"
|
|
185
|
-
fi
|
|
186
|
-
|
|
187
|
-
: ${__meat__:=x}
|
|
188
|
-
if [[ "$__meat__" != 'x' ]]; then
|
|
189
|
-
return 0
|
|
190
|
-
fi
|
|
191
|
-
|
|
192
|
-
__meat__='y'
|
|
193
|
-
|
|
194
|
-
require 'shflags'
|
|
195
|
-
|
|
196
|
-
configure_logging
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
_main "$@"
|
|
200
|
-
set -fue
|