ready 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +57 -2
- data/README.md +76 -9
- data/Rakefile +91 -0
- data/demo/demofns.zsh +34 -0
- data/demo/rubyconf.rec +40 -0
- data/exe/ready +18 -1
- data/extra/browse.sh +161 -0
- data/extra/finder.sh +97 -0
- data/extra/formatter +108 -0
- data/extra/formatter.rb +92 -0
- data/extra/ri.rb +78 -0
- data/extra/rif +478 -0
- data/extra/rif2 +58 -0
- data/issues.rec +79 -0
- data/lib/ready/by_executable.rb +51 -0
- data/lib/ready/cli/clobber.rb +21 -0
- data/lib/ready/cli/compile.rb +111 -0
- data/lib/ready/cli/init.rb +30 -0
- data/lib/ready/cli/rake_command.rb +32 -0
- data/lib/ready/cli/up.rb +21 -0
- data/lib/ready/cli.rb +24 -0
- data/lib/ready/configuration.rb +60 -0
- data/lib/ready/executable/multiple_files_error.rb +3 -0
- data/lib/ready/executable.rb +94 -0
- data/lib/ready/fn.zsh.erb +28 -0
- data/lib/ready/readyfile/executable.rb +46 -0
- data/lib/ready/readyfile.rb +73 -0
- data/lib/ready/version.rb +1 -1
- data/lib/ready/zsh_function.rb +27 -0
- data/lib/ready/zsh_script.rb +45 -0
- data/lib/ready.rb +12 -0
- data/rakelib/ready.rake +191 -0
- data/readyfile +10 -0
- data/zsh/ready/functions/ready/__ready_datetime +32 -0
- data/zsh/ready/functions/ready/__ready_debug +51 -0
- data/zsh/ready/functions/ready/__ready_print +55 -0
- data/zsh/ready/functions/readyinit +78 -0
- data/zsh/ready/functions/readyup +64 -0
- data/zsh/ready/functions/rizz +50 -0
- data/zsh/ready/ready.plugin.zsh +49 -0
- data/zsh/ready.plugin.zsh +1 -0
- data/zsh/site-functions/_ready_ronin +12 -0
- metadata +67 -3
data/extra/rif
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
#!/usr/bin/env zsh
|
|
2
|
+
arr_debug () {
|
|
3
|
+
emulate -L zsh
|
|
4
|
+
print_colors
|
|
5
|
+
local expression=${@}
|
|
6
|
+
if [[ -z ${expression} ]]
|
|
7
|
+
then
|
|
8
|
+
printerr_bold_red "Must pass an expression"
|
|
9
|
+
return 1
|
|
10
|
+
fi
|
|
11
|
+
setopt pipefail
|
|
12
|
+
expression=${(qqq)expression}
|
|
13
|
+
print -u2 -P -r "%B%F{cyan} -- [DEBUG] -- %f%b %F{green}[%N]%f %B%F{cyan} -- %f%b %F{cyan}${expression}%f"
|
|
14
|
+
}
|
|
15
|
+
slurp () {
|
|
16
|
+
emulate -L zsh
|
|
17
|
+
setopt errreturn
|
|
18
|
+
local varname=${1:-""}
|
|
19
|
+
zslurp
|
|
20
|
+
local NL=$'\x0a'
|
|
21
|
+
REPLY=${REPLY%%${NL}}
|
|
22
|
+
if [[ -z ${varname} ]]
|
|
23
|
+
then
|
|
24
|
+
return
|
|
25
|
+
fi
|
|
26
|
+
if (( $+parameters[$varname] ))
|
|
27
|
+
then
|
|
28
|
+
if [[ ${parameters[$varname]} =~ local ]]
|
|
29
|
+
then
|
|
30
|
+
eval "${(q)varname}=${(qqq)REPLY}"
|
|
31
|
+
else
|
|
32
|
+
typeset -g ${varname}=${REPLY}
|
|
33
|
+
fi
|
|
34
|
+
else
|
|
35
|
+
typeset -g ${varname}=${REPLY}
|
|
36
|
+
fi
|
|
37
|
+
REPLY=""
|
|
38
|
+
}
|
|
39
|
+
by_gem () {
|
|
40
|
+
by_gem () {
|
|
41
|
+
emulate -L zsh
|
|
42
|
+
if (( $+parameters[RUBYOPT] ))
|
|
43
|
+
then
|
|
44
|
+
local -x RUBYOPT=${RUBYOPT:-""}
|
|
45
|
+
local -a rubyopt=(${(z)RUBYOPT})
|
|
46
|
+
rubyopt=(${rubyopt:#*bundler/setup})
|
|
47
|
+
rubyopt=(${rubyopt:#*bundler/setup.rb})
|
|
48
|
+
typeset -p rubyopt >&2
|
|
49
|
+
RUBYOPT=${(j: :)rubyopt}
|
|
50
|
+
fi
|
|
51
|
+
by -e "$(
|
|
52
|
+
cat <<'RUBY'
|
|
53
|
+
# frozen_string_literal: true
|
|
54
|
+
|
|
55
|
+
#--
|
|
56
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
|
57
|
+
# All rights reserved.
|
|
58
|
+
# See LICENSE.txt for permissions.
|
|
59
|
+
#++
|
|
60
|
+
|
|
61
|
+
require "rubygems/gem_runner"
|
|
62
|
+
|
|
63
|
+
Gem::GemRunner.new.run ARGV.clone
|
|
64
|
+
|
|
65
|
+
RUBY
|
|
66
|
+
)" "$@"
|
|
67
|
+
}
|
|
68
|
+
by_gem "${@}"
|
|
69
|
+
}
|
|
70
|
+
str_split () {
|
|
71
|
+
emulate -L zsh
|
|
72
|
+
print_colors
|
|
73
|
+
local -A opt_args
|
|
74
|
+
zparseopts -A opt_args -D -E -F -K -delimiter: d:
|
|
75
|
+
local input=${1}
|
|
76
|
+
local string
|
|
77
|
+
local delimiter=z
|
|
78
|
+
opt_read --infer-short opt_args delimiter && delimiter=${REPLY}
|
|
79
|
+
if [[ -z ${input} ]]
|
|
80
|
+
then
|
|
81
|
+
printerr_bold_red "Input must be present"
|
|
82
|
+
elif [[ -v ${input} ]]
|
|
83
|
+
then
|
|
84
|
+
string=${(P)input}
|
|
85
|
+
else
|
|
86
|
+
string=${input}
|
|
87
|
+
fi
|
|
88
|
+
unset reply
|
|
89
|
+
typeset -ga reply
|
|
90
|
+
if [[ ${delimiter} = z ]]
|
|
91
|
+
then
|
|
92
|
+
set -A reply ${(Az)string}
|
|
93
|
+
elif [[ ${delimiter} = f ]]
|
|
94
|
+
then
|
|
95
|
+
set -A reply ${(Af)string}
|
|
96
|
+
elif [[ ${delimiter} = 0 ]] || [[ delimiter = '0' ]]
|
|
97
|
+
then
|
|
98
|
+
set -A reply ${(A0)string}
|
|
99
|
+
elif [[ ${delimiter} = ':' ]]
|
|
100
|
+
then
|
|
101
|
+
set -A reply ${(pAs%:%)string}
|
|
102
|
+
else
|
|
103
|
+
set -A reply ${(pAs:$delimiter:)string}
|
|
104
|
+
fi
|
|
105
|
+
}
|
|
106
|
+
print_colors () {
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
opt_read () {
|
|
110
|
+
emulate -L zsh
|
|
111
|
+
setopt extendedglob
|
|
112
|
+
local -A optread_opts
|
|
113
|
+
zparseopts -A optread_opts -D -F - c -canonical -infer-short i
|
|
114
|
+
if (( ? != 0 ))
|
|
115
|
+
then
|
|
116
|
+
print -u2 "Error parsing options"
|
|
117
|
+
return 1
|
|
118
|
+
fi
|
|
119
|
+
local canonical=false
|
|
120
|
+
local input
|
|
121
|
+
local opt_name
|
|
122
|
+
if aa_key optread_opts -c || aa_key optread_opts --canonical
|
|
123
|
+
then
|
|
124
|
+
canonical=true
|
|
125
|
+
fi
|
|
126
|
+
if $canonical
|
|
127
|
+
then
|
|
128
|
+
input=opt_args
|
|
129
|
+
opt_name=$1
|
|
130
|
+
else
|
|
131
|
+
input=$1
|
|
132
|
+
opt_name=$2
|
|
133
|
+
fi
|
|
134
|
+
if $canonical || aa_key optread_opts --infer-short || aa_key optread_opts -i
|
|
135
|
+
then
|
|
136
|
+
local first_letter=${opt_name[1]}
|
|
137
|
+
local -a input_keys=(${(Pk)input})
|
|
138
|
+
local -a short_matching_keys=(${(M)input_keys:##-${first_letter}})
|
|
139
|
+
integer key_count=${#short_matching_keys}
|
|
140
|
+
if (( key_count > 1 ))
|
|
141
|
+
then
|
|
142
|
+
print -u2 "Ambiguous short option: ${first_letter}. Matches:$'\n' ${(F)short_matching_keys}"
|
|
143
|
+
return 1
|
|
144
|
+
elif (( key_count == 1 ))
|
|
145
|
+
then
|
|
146
|
+
opt_name=${short_matching_keys[1]#-}
|
|
147
|
+
fi
|
|
148
|
+
fi
|
|
149
|
+
if [[ -z ${input} ]]
|
|
150
|
+
then
|
|
151
|
+
print -u2 "Must pass an input"
|
|
152
|
+
return 1
|
|
153
|
+
fi
|
|
154
|
+
if ! [[ ${opt_name} =~ '^-{1,2}' ]]
|
|
155
|
+
then
|
|
156
|
+
if ((${#opt_name} > 1))
|
|
157
|
+
then
|
|
158
|
+
opt_name="--${opt_name}"
|
|
159
|
+
else
|
|
160
|
+
opt_name="-${opt_name}"
|
|
161
|
+
fi
|
|
162
|
+
if aa_key ${input} ${opt_name}
|
|
163
|
+
then
|
|
164
|
+
REPLY=${${${(P)input}[${opt_name}]/=/}:-true}
|
|
165
|
+
return 0
|
|
166
|
+
else
|
|
167
|
+
unset REPLY
|
|
168
|
+
return 1
|
|
169
|
+
fi
|
|
170
|
+
else
|
|
171
|
+
return 1
|
|
172
|
+
fi
|
|
173
|
+
}
|
|
174
|
+
arr_empty () {
|
|
175
|
+
emulate -L zsh
|
|
176
|
+
print_colors
|
|
177
|
+
local arr_name=${1}
|
|
178
|
+
if [[ -z ${arr_name} ]]
|
|
179
|
+
then
|
|
180
|
+
printerr_red "Must pass array name"
|
|
181
|
+
return 1
|
|
182
|
+
fi
|
|
183
|
+
if [[ ${arr_name} = argv ]]
|
|
184
|
+
then
|
|
185
|
+
printerr_red "Cannot check argv. Use a different name"
|
|
186
|
+
return 1
|
|
187
|
+
fi
|
|
188
|
+
setopt pipefail
|
|
189
|
+
if ! [[ ${(t)${(P)arr_name}} =~ array ]]
|
|
190
|
+
then
|
|
191
|
+
printerr_red "Input is not an array"
|
|
192
|
+
return 1
|
|
193
|
+
fi
|
|
194
|
+
if (( ${#${(P)arr_name}} == 0 ))
|
|
195
|
+
then
|
|
196
|
+
return 0
|
|
197
|
+
else
|
|
198
|
+
return 2
|
|
199
|
+
fi
|
|
200
|
+
}
|
|
201
|
+
rif () {
|
|
202
|
+
emulate -L zsh
|
|
203
|
+
setopt extendedglob
|
|
204
|
+
print_colors
|
|
205
|
+
local -A opt_args
|
|
206
|
+
zparseopts -D -E -K -A opt_args - i -interactive -forcebat -no-strip n
|
|
207
|
+
(( ? != 0 )) && return 1
|
|
208
|
+
local interactive=false
|
|
209
|
+
local no_strip=false
|
|
210
|
+
local forcebat=false
|
|
211
|
+
opt_read -c no-strip && no_strip=$REPLY
|
|
212
|
+
opt_read -c interactive && interactive=$REPLY
|
|
213
|
+
opt_read opt_args forcebat && forcebat=true
|
|
214
|
+
local -a bat_options=(${(M)@:#-*})
|
|
215
|
+
set -- ${@:|bat_options}
|
|
216
|
+
local query=${1:?}
|
|
217
|
+
integer index=${2:-0}
|
|
218
|
+
local -a all
|
|
219
|
+
str_split -d '::' query
|
|
220
|
+
arr_map -v reply '${(j:_:)it}' '${it//(#b)([A-Z][^A-Z](#c1,))([A-Z][^A-Z](#c,))/${(j:_:)match}}' '${(L)it}'
|
|
221
|
+
local gem_name=$reply[1]
|
|
222
|
+
local -a rest=(${reply[2,-1]})
|
|
223
|
+
if (( $#rest == 0 ))
|
|
224
|
+
then
|
|
225
|
+
rest=($gem_name)
|
|
226
|
+
elif (( $#rest > 0 ))
|
|
227
|
+
then
|
|
228
|
+
local alt_gem_name=$gem_name-$rest[1]
|
|
229
|
+
fi
|
|
230
|
+
arr_join -d '/' rest
|
|
231
|
+
local relpath=${REPLY}.rb
|
|
232
|
+
by_gem contents $alt_gem_name $gem_name ${gem_name//_/} | wind -v1 all
|
|
233
|
+
local -Ua results
|
|
234
|
+
results=(${(M)${(M)all:%*.rb}:%*/lib/*/${~relpath}})
|
|
235
|
+
if arr_empty results
|
|
236
|
+
then
|
|
237
|
+
print -u2 -P "%F{red}Found no results%f"
|
|
238
|
+
return 1
|
|
239
|
+
elif $interactive
|
|
240
|
+
then
|
|
241
|
+
local -a abbrev=(${results//#*${gem_name}/${gem_name}})
|
|
242
|
+
local -a results=(${results:^abbrev})
|
|
243
|
+
print -r -C2 -a -- $results | command fzf --with-nth=2 --ansi --preview-window='70%,wrap' --preview "bat --language=ruby --color=always {1}"
|
|
244
|
+
elif (( $#results > 1 )) && (( index == 0 ))
|
|
245
|
+
then
|
|
246
|
+
print -u2 -P "%F{blue}Found more than 1 result:%f"
|
|
247
|
+
print -r -l -- $results
|
|
248
|
+
return 0
|
|
249
|
+
fi
|
|
250
|
+
if (( index == 0 ))
|
|
251
|
+
then
|
|
252
|
+
index=1
|
|
253
|
+
elif (( index > $#results ))
|
|
254
|
+
then
|
|
255
|
+
print -u2 -P "%F{red}Index out of bounds: %B$index%b > %B$#results%b%f"
|
|
256
|
+
return 1
|
|
257
|
+
fi
|
|
258
|
+
local filepath=${results[$index]}
|
|
259
|
+
local presented_filepath=${filepath##*gems/}
|
|
260
|
+
bat_options+=(--file-name $presented_filepath)
|
|
261
|
+
{
|
|
262
|
+
if $no_strip
|
|
263
|
+
then
|
|
264
|
+
command gcat $filepath
|
|
265
|
+
else
|
|
266
|
+
command ggrep --color=auto --binary-files=text -Pv '^\s*#?\s*$' $filepath
|
|
267
|
+
fi
|
|
268
|
+
} | command tab2space -t2 | {
|
|
269
|
+
if [[ -t 1 ]] || $force_bat
|
|
270
|
+
then
|
|
271
|
+
command bat --color=always --no-paging --language=ruby $bat_options
|
|
272
|
+
else
|
|
273
|
+
col -b
|
|
274
|
+
fi
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
val_arr () {
|
|
278
|
+
emulate -L zsh
|
|
279
|
+
print_colors
|
|
280
|
+
local -A opt_args
|
|
281
|
+
local is_quiet=false
|
|
282
|
+
zparseopts -D -E -K -A opt_args -F - -quiet -silent s q
|
|
283
|
+
(( ? != 0 )) && return 1
|
|
284
|
+
if opt_read -c quiet || opt_read -c silent
|
|
285
|
+
then
|
|
286
|
+
is_quiet=true
|
|
287
|
+
fi
|
|
288
|
+
local arr_name=${1}
|
|
289
|
+
if [[ -z ${arr_name} ]]
|
|
290
|
+
then
|
|
291
|
+
$is_quiet || printerr_bold_red "Must pass an array name"
|
|
292
|
+
return 1
|
|
293
|
+
fi
|
|
294
|
+
if [[ ${arr_name} =~ '\$\{' ]] || [[ ${arr_name} =~ ' ' ]]
|
|
295
|
+
then
|
|
296
|
+
$is_quiet || printerr_bold_red "Must pass name of array, not expression"
|
|
297
|
+
return 1
|
|
298
|
+
fi
|
|
299
|
+
if ! [[ ${(Pt)arr_name} =~ array ]]
|
|
300
|
+
then
|
|
301
|
+
$is_quiet || printerr_bold_red "'${arr_name}' is not an array"
|
|
302
|
+
return 1
|
|
303
|
+
fi
|
|
304
|
+
setopt pipefail
|
|
305
|
+
}
|
|
306
|
+
arr_clone () {
|
|
307
|
+
emulate -L zsh
|
|
308
|
+
print_colors
|
|
309
|
+
setopt extendedglob
|
|
310
|
+
local arr_name
|
|
311
|
+
local clone_name
|
|
312
|
+
if (( # == 1 ))
|
|
313
|
+
then
|
|
314
|
+
arr_name=reply
|
|
315
|
+
clone_name=${1}
|
|
316
|
+
else
|
|
317
|
+
arr_name=${1}
|
|
318
|
+
clone_name=${2}
|
|
319
|
+
fi
|
|
320
|
+
val_arr ${arr_name}
|
|
321
|
+
setopt pipefail
|
|
322
|
+
set -A ${clone_name} ${(P)arr_name}
|
|
323
|
+
}
|
|
324
|
+
wind () {
|
|
325
|
+
emulate -L zsh
|
|
326
|
+
zmodload zsh/mapfile
|
|
327
|
+
setopt extendedglob
|
|
328
|
+
setopt errreturn
|
|
329
|
+
local quotes
|
|
330
|
+
local file
|
|
331
|
+
local variation='-v3'
|
|
332
|
+
zparseopts -D -K -E -F - v::=variation f::=file -file::=file q=quotes -quotes=quotes
|
|
333
|
+
local arrayname=${1:-reply}
|
|
334
|
+
local input=/dev/stdin
|
|
335
|
+
local use_quotes=false
|
|
336
|
+
local NL=$'\x0a'
|
|
337
|
+
if [[ -n $file ]]
|
|
338
|
+
then
|
|
339
|
+
input=${file##-(#c1,2)f(ile)(#c,1)(=| (#c,))}
|
|
340
|
+
print -v input ${~input/%/(#q-NA)}
|
|
341
|
+
if (( ${#input} != ${#${input## (#c,)}} )) || [[ -z ${input} ]]
|
|
342
|
+
then
|
|
343
|
+
{
|
|
344
|
+
print -u2 -P -- "%B%F{red}Your file input contains ambiguous prefix spacing:%b"
|
|
345
|
+
typeset -p file >&2
|
|
346
|
+
print -u2 -P -- "%BCorrect it and try again%b%f"
|
|
347
|
+
return 1
|
|
348
|
+
}
|
|
349
|
+
fi
|
|
350
|
+
fi
|
|
351
|
+
if [[ $quotes = "-q" ]] || [[ $quotes = '--quotes' ]]
|
|
352
|
+
then
|
|
353
|
+
use_quotes=true
|
|
354
|
+
fi
|
|
355
|
+
if [[ $input = /dev/stdin ]]
|
|
356
|
+
then
|
|
357
|
+
slurp
|
|
358
|
+
if ${use_quotes}
|
|
359
|
+
then
|
|
360
|
+
set -A ${arrayname} ${(qqq@f)REPLY}
|
|
361
|
+
else
|
|
362
|
+
case $variation in
|
|
363
|
+
("-v1") set -A ${arrayname} "${(@f)REPLY%${NL}}" ;;
|
|
364
|
+
("-v2") set -A ${arrayname} "${(@f)REPLY}" ;;
|
|
365
|
+
("-v3") set -A ${arrayname} ${(@f)REPLY} ;;
|
|
366
|
+
esac
|
|
367
|
+
fi
|
|
368
|
+
elif [[ -r ${input} ]]
|
|
369
|
+
then
|
|
370
|
+
case $variation in
|
|
371
|
+
("-v1") set -A ${arrayname} "${(f@)${mapfile[${input}]%${NL}}}" ;;
|
|
372
|
+
("-v2") set -A ${arrayname} "${(f@)${mapfile[${input}]}}" ;;
|
|
373
|
+
("-v3") set -A ${arrayname} ${(f@)${mapfile[${input}]}} ;;
|
|
374
|
+
esac
|
|
375
|
+
else
|
|
376
|
+
print -u2 -P "%F{red}Error. Unknown options specified: %B${(qq)@}%b%f"
|
|
377
|
+
return 1
|
|
378
|
+
fi
|
|
379
|
+
}
|
|
380
|
+
arr_map () {
|
|
381
|
+
emulate -L zsh
|
|
382
|
+
setopt extendedglob
|
|
383
|
+
print_colors
|
|
384
|
+
local -A opt_args
|
|
385
|
+
local to_evaluate
|
|
386
|
+
unset MATCH
|
|
387
|
+
zparseopts -A opt_args -D -E -F -- e -echo p v -verbose
|
|
388
|
+
local arr_name=${1}
|
|
389
|
+
if ! val_arr ${arr_name}
|
|
390
|
+
then
|
|
391
|
+
return 1
|
|
392
|
+
fi
|
|
393
|
+
local -a expressions=(${(Oa)${@[2,-1]}})
|
|
394
|
+
if (( ${#expressions} == 0 ))
|
|
395
|
+
then
|
|
396
|
+
printerr_bold_red "Must pass at least one expression"
|
|
397
|
+
return 1
|
|
398
|
+
fi
|
|
399
|
+
local exp1=${expressions[1]//it/MATCH}
|
|
400
|
+
local i
|
|
401
|
+
for i in ${expressions[2,-1]}
|
|
402
|
+
do
|
|
403
|
+
i=${${i}//it/MATCH}
|
|
404
|
+
exp1=${exp1//MATCH/"${i}"}
|
|
405
|
+
done
|
|
406
|
+
builtin print -v to_evaluate -r -- "set -A reply \${\${(P)arr_name}/(#m)*/\${${exp1}}}"
|
|
407
|
+
if opt_read -c verbose
|
|
408
|
+
then
|
|
409
|
+
arr_debug ${to_evaluate}
|
|
410
|
+
fi
|
|
411
|
+
eval ${to_evaluate}
|
|
412
|
+
if opt_read -c echo
|
|
413
|
+
then
|
|
414
|
+
print -r -- ${reply}
|
|
415
|
+
fi
|
|
416
|
+
}
|
|
417
|
+
arr_join () {
|
|
418
|
+
emulate -L zsh
|
|
419
|
+
print_colors
|
|
420
|
+
local -A opt_args
|
|
421
|
+
zparseopts -A opt_args -D -E -F -K -delimiter: d:
|
|
422
|
+
local arr_name=${1}
|
|
423
|
+
local delimiter=z
|
|
424
|
+
local NUL=$'\x00'
|
|
425
|
+
if ! val_arr ${arr_name}
|
|
426
|
+
then
|
|
427
|
+
return 1
|
|
428
|
+
fi
|
|
429
|
+
opt_read --infer-short opt_args delimiter && delimiter=${REPLY}
|
|
430
|
+
if [[ ${delimiter} = z ]]
|
|
431
|
+
then
|
|
432
|
+
REPLY=${(j: :)${(P)arr_name}}
|
|
433
|
+
elif [[ ${delimiter} = 0 ]] || [[ delimiter = '0' ]]
|
|
434
|
+
then
|
|
435
|
+
REPLY=${(pj:$NUL:)${(P)arr_name}}
|
|
436
|
+
elif [[ ${delimiter} = ':' ]]
|
|
437
|
+
then
|
|
438
|
+
REPLY=${(pj%:%)${(P)arr_name}}
|
|
439
|
+
else
|
|
440
|
+
REPLY=${(pj:$delimiter:)${(P)arr_name}}
|
|
441
|
+
fi
|
|
442
|
+
}
|
|
443
|
+
aa_key () {
|
|
444
|
+
emulate -L zsh
|
|
445
|
+
local input=${1}
|
|
446
|
+
local key_name=${2}
|
|
447
|
+
if [[ -z ${input} ]]
|
|
448
|
+
then
|
|
449
|
+
print -u2 "Must pass name of associative array"
|
|
450
|
+
return 1
|
|
451
|
+
fi
|
|
452
|
+
if [[ -z ${key_name} ]]
|
|
453
|
+
then
|
|
454
|
+
print -u2 "Must pass name of key"
|
|
455
|
+
return 1
|
|
456
|
+
fi
|
|
457
|
+
if [[ ${${(P)input}[(I)${key_name}]} = ${key_name} ]]
|
|
458
|
+
then
|
|
459
|
+
return 0
|
|
460
|
+
else
|
|
461
|
+
return 1
|
|
462
|
+
fi
|
|
463
|
+
}
|
|
464
|
+
zslurp () {
|
|
465
|
+
emulate -L zsh -o no_multibyte
|
|
466
|
+
zmodload zsh/system || return
|
|
467
|
+
local -a content
|
|
468
|
+
local -i i=0
|
|
469
|
+
while true
|
|
470
|
+
do
|
|
471
|
+
sysread 'content[++i]' && continue
|
|
472
|
+
(( $? == 5 )) || return
|
|
473
|
+
break
|
|
474
|
+
done
|
|
475
|
+
typeset -g REPLY=${(j::)content}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
rif ${@}
|
data/extra/rif2
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env zsh
|
|
2
|
+
rif2 () {
|
|
3
|
+
emulate -L zsh
|
|
4
|
+
setopt pipefail
|
|
5
|
+
setopt errreturn
|
|
6
|
+
setopt warnnestedvar
|
|
7
|
+
setopt warncreateglobal
|
|
8
|
+
{
|
|
9
|
+
time by -e '
|
|
10
|
+
require "flexor"
|
|
11
|
+
require "command_kit/colors"
|
|
12
|
+
require "irb/source_finder"
|
|
13
|
+
include CommandKit::Colors::ANSI
|
|
14
|
+
duck_context = F.new.tap do |f|
|
|
15
|
+
f.workspace.binding = binding
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
constant = ARGV.first.to_s
|
|
19
|
+
constant_no_trailing = ARGV.first.to_s.gsub(/:*$/,"")
|
|
20
|
+
unless (constant_no_trailing.constantize rescue false)
|
|
21
|
+
begin
|
|
22
|
+
underscored_no_trailing = constant_no_trailing.underscore.gsub(/\/*$/,"")
|
|
23
|
+
warn yellow("Constant #{bold(constant_no_trailing.inspect)} not ready. Attempting to require #{bold(underscored_no_trailing.inspect)}")
|
|
24
|
+
require underscored_no_trailing
|
|
25
|
+
rescue LoadError
|
|
26
|
+
puts red("Error: #{bold(underscored_no_trailing.inspect)} not found")
|
|
27
|
+
exit 1
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
source = IRB::SourceFinder
|
|
32
|
+
.new(duck_context)
|
|
33
|
+
.find_source(constant_no_trailing)
|
|
34
|
+
|
|
35
|
+
if source.nil?
|
|
36
|
+
puts red("Error: No results found" )
|
|
37
|
+
exit 1
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
source_path = Pathname(source.file)
|
|
41
|
+
gem_path = Pathname(Gem.paths.home)
|
|
42
|
+
path = source_path.relative_path_from gem_path
|
|
43
|
+
puts path
|
|
44
|
+
puts source.file_content
|
|
45
|
+
' $@
|
|
46
|
+
} | {
|
|
47
|
+
local filepath
|
|
48
|
+
read filepath
|
|
49
|
+
if [[ $line =~ "Error:" ]]
|
|
50
|
+
then
|
|
51
|
+
print -r -- $filepath
|
|
52
|
+
else
|
|
53
|
+
command tab2space -t2 | command bat --color=always --language=ruby --file-name="$filepath" --theme=Coldark-Dark
|
|
54
|
+
fi
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
rif2 ${@}
|
data/issues.rec
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
%rec: Issue
|
|
2
|
+
%key: Id
|
|
3
|
+
%typedef: text_t regexp /.*/
|
|
4
|
+
%typedef: Status_t enum open in_progress complete
|
|
5
|
+
%type: Id int
|
|
6
|
+
%type: Name line
|
|
7
|
+
%type: Summary text_t
|
|
8
|
+
%type: Status Status_t
|
|
9
|
+
%type: Created date
|
|
10
|
+
%auto: Id Created
|
|
11
|
+
%mandatory: Name Summary Status
|
|
12
|
+
|
|
13
|
+
Id: 0
|
|
14
|
+
Created: Sun, 08 Mar 2026 17:22:28 -0400
|
|
15
|
+
Name: Rubygems struggles with conflicting gem versions
|
|
16
|
+
Summary: Say you have:
|
|
17
|
+
+ gem_a as a dep, where gem_a is dependent on `BigDecimal, >= '3.3.0'`
|
|
18
|
+
+ gem_b as a dep, where gem_b is dependent on `BigDecimal, ~> '3.3.0'`
|
|
19
|
+
+
|
|
20
|
+
+ If gem_a is loaded first, and latest present version of BigDecimal is 4.0.1, loading gem_b will raise error when it tries to load big_decimal, as rubygems is greedy.
|
|
21
|
+
+
|
|
22
|
+
+ Possible solutions:
|
|
23
|
+
+ - Dynamically create a gemfile on the spot, so that a lockfile is produced prior to booting by-server
|
|
24
|
+
+ - Try to mitigate load order (currently doing this as a quick fix)
|
|
25
|
+
Status: open
|
|
26
|
+
|
|
27
|
+
Id: 1
|
|
28
|
+
Created: Sun, 08 Mar 2026 17:36:16 -0400
|
|
29
|
+
Name: Need to patch by.gem source with my modifications
|
|
30
|
+
Summary: Currently the following support is broken, or is not fully implemented in by:
|
|
31
|
+
+ 3. process sub (e.g. /dev/fd/12 support when that is used as a file)
|
|
32
|
+
+ 2. sigint should be ignored when using irb
|
|
33
|
+
+ 1. there are still random irb failures
|
|
34
|
+
Status: open
|
|
35
|
+
|
|
36
|
+
Id: 2
|
|
37
|
+
Created: Wed, 01 Apr 2026 10:59:52 -0400
|
|
38
|
+
Name: Ruby codeblocks preceded by " #" get mangled when using Rizz
|
|
39
|
+
Summary: Rizz output shown below for the ruby "box" rdoc:
|
|
40
|
+
+ "
|
|
41
|
+
+ # in foo.rb
|
|
42
|
+
+ class String
|
|
43
|
+
+ BLANK_PATTERN = /\A\s*\z/
|
|
44
|
+
+ def blank?
|
|
45
|
+
+ self =~ BLANK_PATTERN
|
|
46
|
+
+ end
|
|
47
|
+
+ end
|
|
48
|
+
+
|
|
49
|
+
+ module Foo
|
|
50
|
+
+ def self.foo = "foo"
|
|
51
|
+
+
|
|
52
|
+
+ def self.foo_is_blank?
|
|
53
|
+
+ foo.blank?
|
|
54
|
+
+ end
|
|
55
|
+
+ end
|
|
56
|
+
+
|
|
57
|
+
+ Foo.foo.blank? #=> false
|
|
58
|
+
+ "foo".blank? #=> false
|
|
59
|
+
+
|
|
60
|
+
+ # in main.rb
|
|
61
|
+
+ box = Ruby::Box.new
|
|
62
|
+
+ box.require('foo')
|
|
63
|
+
+
|
|
64
|
+
+ box::Foo.foo_is_blank? #=> false (#blank? called in box)
|
|
65
|
+
+
|
|
66
|
+
+ "foo".blank? # NoMethodError
|
|
67
|
+
+ String::BLANK_PATTERN # NameError
|
|
68
|
+
+
|
|
69
|
+
+ The main box and box are different boxes, so monkey patches in main
|
|
70
|
+
+ are also invisible in box .
|
|
71
|
+
+ "
|
|
72
|
+
+ Rizz formats correctly starting at "module Foo", but everything before it is not formatted. The raw markdown adds a tab indent before "# in foo.rb", which likely messes things up.
|
|
73
|
+
Status: open
|
|
74
|
+
|
|
75
|
+
Id: 3
|
|
76
|
+
Created: Sat, 18 Apr 2026 10:36:11 -0400
|
|
77
|
+
Name: Why are functions in zwc prefixed with their full absolute paths?
|
|
78
|
+
Summary: Things appear to be working, possibly by accident. I should investigate this further
|
|
79
|
+
Status: open
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require "shellwords"
|
|
2
|
+
|
|
3
|
+
module Ready
|
|
4
|
+
##
|
|
5
|
+
# Builds the ruby invocation used to run the "by" executable, toggling
|
|
6
|
+
# rubygems and YJIT, and renders it as a shell alias.
|
|
7
|
+
class ByExecutable
|
|
8
|
+
def initialize(
|
|
9
|
+
current_ruby: RbConfig.ruby,
|
|
10
|
+
by_bin: Gem.activate_bin_path("by", "by")
|
|
11
|
+
)
|
|
12
|
+
@current_ruby = current_ruby
|
|
13
|
+
@by_bin = by_bin
|
|
14
|
+
@args = []
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def without_rubygems
|
|
18
|
+
@args << "--disable-gems" unless @args.include? "--disable-gems"
|
|
19
|
+
self
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def with_rubygems
|
|
23
|
+
@args.delete "--disable-gems"
|
|
24
|
+
self
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def with_yjit
|
|
28
|
+
@args << "--yjit"
|
|
29
|
+
self
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def without_yjit
|
|
33
|
+
@args.delete("--yjit")
|
|
34
|
+
self
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def command_args
|
|
38
|
+
[
|
|
39
|
+
@current_ruby,
|
|
40
|
+
*@args,
|
|
41
|
+
@by_bin,
|
|
42
|
+
]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_alias
|
|
46
|
+
command_args
|
|
47
|
+
.then { Shellwords.join(it) }
|
|
48
|
+
.then { "#{it} \"${@}\"" }
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "command_kit/command"
|
|
2
|
+
|
|
3
|
+
module Ready
|
|
4
|
+
class CLI
|
|
5
|
+
##
|
|
6
|
+
# Removes every compiled ready build artifact, by delegating to the
|
|
7
|
+
# `rake clobber` task.
|
|
8
|
+
class Clobber < CommandKit::Command
|
|
9
|
+
include RakeCommand
|
|
10
|
+
|
|
11
|
+
description "Remove all compiled ready build artifacts"
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# Runs `rake clobber`.
|
|
15
|
+
#
|
|
16
|
+
def run
|
|
17
|
+
rake("clobber")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|