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/rakelib/ready.rake
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
require "shellwords"
|
|
2
|
+
require "open3"
|
|
3
|
+
require "bundler"
|
|
4
|
+
require "rake/clean"
|
|
5
|
+
require "ready"
|
|
6
|
+
|
|
7
|
+
configuration = Ready::Configuration.new
|
|
8
|
+
|
|
9
|
+
PROJECT_DIR = configuration.project_path
|
|
10
|
+
EXE_DIR = PROJECT_DIR / "exe"
|
|
11
|
+
EXTRA_DIR = PROJECT_DIR / "extra"
|
|
12
|
+
READY_PREFIX = configuration.prefix
|
|
13
|
+
READY_SOCKET = configuration.sock_path
|
|
14
|
+
READY_BUILD_DIR = configuration.build_dir
|
|
15
|
+
READYFILE = configuration.readyfile
|
|
16
|
+
|
|
17
|
+
def run_command(*args, out: $stdout, chdir: Dir.pwd, **kwargs)
|
|
18
|
+
case args
|
|
19
|
+
in Hash => env, *cmd
|
|
20
|
+
in cmd then env = {}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
puts
|
|
24
|
+
puts cmd.join(" ")
|
|
25
|
+
|
|
26
|
+
Bundler.with_unbundled_env do
|
|
27
|
+
Open3.popen2(env, *cmd.map(&:to_s), chdir: chdir.to_s, **kwargs) do |sin, sout, wait|
|
|
28
|
+
sin.close
|
|
29
|
+
IO.copy_stream sout, out
|
|
30
|
+
result = wait.value
|
|
31
|
+
raise "Encountered an error while running #{cmd.join(" ").inspect}" unless result.success?
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def compile_by(target:)
|
|
37
|
+
shell_load_path = [EXE_DIR, ENV.fetch("PATH", "")].join ":"
|
|
38
|
+
env = ENV.to_h.merge(
|
|
39
|
+
"PATH" => shell_load_path,
|
|
40
|
+
"BY_SOCKET" => READY_SOCKET.to_s,
|
|
41
|
+
)
|
|
42
|
+
File.open target, "w" do |f|
|
|
43
|
+
run_command env, "ready", "compile", "by", "--no-rubygems", "--no-yjit", out: f
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def compile_gem(executable_name, target:)
|
|
48
|
+
shell_load_path = [EXE_DIR, ENV.fetch("PATH", "")].join ":"
|
|
49
|
+
env = ENV.to_h.merge("PATH" => shell_load_path)
|
|
50
|
+
|
|
51
|
+
File.open target, "w" do |f|
|
|
52
|
+
run_command env, "ready", "compile", "--environment", "BY_SOCKET=#{READY_SOCKET}", executable_name, out: f
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
namespace :ready do
|
|
57
|
+
directory PROJECT_DIR do
|
|
58
|
+
mkdir_p PROJECT_DIR
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
directory READY_PREFIX do
|
|
62
|
+
mkdir_p READY_PREFIX
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
directory READY_BUILD_DIR do
|
|
66
|
+
mkdir_p READY_BUILD_DIR
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
Rake::Task[READY_BUILD_DIR].invoke
|
|
70
|
+
|
|
71
|
+
build_tempdir = READY_PREFIX / "tmp"
|
|
72
|
+
|
|
73
|
+
directory build_tempdir do
|
|
74
|
+
mkdir_p build_tempdir
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
trace_dir = READY_PREFIX / "traces"
|
|
78
|
+
|
|
79
|
+
directory trace_dir do
|
|
80
|
+
mkdir_p trace_dir
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
ri_bootstrapper = EXTRA_DIR / "ri.rb"
|
|
84
|
+
|
|
85
|
+
file ri_bootstrapper do
|
|
86
|
+
raise "RI patch should already exist at #{ri_bootstrapper.to_s.inspect}"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
file READYFILE do
|
|
90
|
+
touch READYFILE.to_s
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
ready_path = EXE_DIR / "ready"
|
|
94
|
+
|
|
95
|
+
file ready_path do
|
|
96
|
+
raise "ready executable not found at #{ready_path}"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
extra = READY_PREFIX / "extra.rb"
|
|
100
|
+
|
|
101
|
+
CLEAN.include FileList[build_tempdir, READY_BUILD_DIR]
|
|
102
|
+
CLOBBER.include FileList[READY_BUILD_DIR.parent / "**/*"]
|
|
103
|
+
|
|
104
|
+
env = {
|
|
105
|
+
"JRUBY_OPTS" => "--dev -J--enable-native-access=ALL-UNNAMED",
|
|
106
|
+
"MINITEST_ACTIVATE_SKIP" => 1,
|
|
107
|
+
"RUBY_YJIT_ENABLE" => 1,
|
|
108
|
+
"BUNDLE_IGNORE_CONFIG" => 1,
|
|
109
|
+
"BY_SOCKET" => READY_SOCKET,
|
|
110
|
+
}.transform_values(&:to_s)
|
|
111
|
+
|
|
112
|
+
file extra do
|
|
113
|
+
extra_body = <<~RUBY
|
|
114
|
+
if defined? ActiveSupport
|
|
115
|
+
ActiveSupport.to_time_preserves_timezone = true
|
|
116
|
+
ActiveSupport.deprecator.silenced = true
|
|
117
|
+
ActiveSupport.eager_load!
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if defined? Zeitwerk
|
|
121
|
+
Zeitwerk::Registry.loaders.each { it.eager_load(force: true) }
|
|
122
|
+
end
|
|
123
|
+
RUBY
|
|
124
|
+
File.write extra, extra_body
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
file READY_SOCKET => [extra, ri_bootstrapper, READYFILE] do
|
|
128
|
+
puts "Loading server..."
|
|
129
|
+
run_command env, "by-server", *READYFILE.gem_names, ri_bootstrapper.to_s, extra.to_s, chdir: Dir.home
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
core_deps = FileList[READY_BUILD_DIR, trace_dir, ready_path]
|
|
133
|
+
|
|
134
|
+
desc "Start the ready server"
|
|
135
|
+
task start_server: READY_SOCKET do
|
|
136
|
+
puts "Starting ready server"
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
desc "Stop the ready server"
|
|
140
|
+
task :stop_server do
|
|
141
|
+
puts "Stopping ready server"
|
|
142
|
+
rm_f READY_SOCKET
|
|
143
|
+
run_command env, "by-server", "stop"
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
desc "Restart the ready server"
|
|
147
|
+
task restart_server: [:stop_server, :start_server]
|
|
148
|
+
|
|
149
|
+
namespace :build do
|
|
150
|
+
irb = READY_BUILD_DIR / "ready_irb"
|
|
151
|
+
|
|
152
|
+
ready_by = READY_BUILD_DIR / "ready_by"
|
|
153
|
+
|
|
154
|
+
file ready_by => core_deps do |task, _|
|
|
155
|
+
compile_by target: task.name
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
file irb => core_deps do |task, _|
|
|
159
|
+
compile_gem "irb", target: task.name
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
READYFILE.each_executable do |executable|
|
|
163
|
+
file executable.realpath => core_deps do |task, _|
|
|
164
|
+
compile_gem executable.name, target: task.name
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
all_executables = FileList[ready_by, *READYFILE.executable_paths]
|
|
169
|
+
|
|
170
|
+
compiled = READY_BUILD_DIR.parent / "builds.zwc"
|
|
171
|
+
|
|
172
|
+
file compiled => all_executables do |task, _|
|
|
173
|
+
pathname = Pathname(task.name)
|
|
174
|
+
run_command "zsh", "-c",
|
|
175
|
+
Shellwords.join(["zcompile", "-Uz", pathname.basename.to_s, *all_executables]),
|
|
176
|
+
chdir: pathname.parent
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
CLEAN.import all_executables
|
|
180
|
+
|
|
181
|
+
multitask compile: [compiled, *all_executables]
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
desc "Compile all ready executables"
|
|
185
|
+
task compile: "build:compile"
|
|
186
|
+
|
|
187
|
+
task compile_and_clean: [:compile, :clean]
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
desc "Build and start the ready environment"
|
|
191
|
+
multitask ready: ["ready:restart_server", "ready:compile_and_clean"]
|
data/readyfile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# gems: are preloaded into the warm by-server, which does `require <entry>`
|
|
2
|
+
# verbatim -- so each entry must be a REQUIRE PATH, not a gem name. Both the
|
|
3
|
+
# ronin library (`require "ronin"`) and ronin-support (`require "ronin/support"`,
|
|
4
|
+
# NOT "ronin-support", which is a LoadError) are preloaded so the ronin CLI's
|
|
5
|
+
# own code is already warm in the server, not just its support library.
|
|
6
|
+
gems:
|
|
7
|
+
- ronin
|
|
8
|
+
- ronin/support
|
|
9
|
+
executables:
|
|
10
|
+
- ronin
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
##
|
|
2
|
+
# __ready_datetime
|
|
3
|
+
#
|
|
4
|
+
# Usage: __ready_datetime $EPOCHREALTIME (or other epoch timestamp)
|
|
5
|
+
#
|
|
6
|
+
emulate -L zsh
|
|
7
|
+
|
|
8
|
+
setopt extendedglob pipefail errreturn
|
|
9
|
+
|
|
10
|
+
zmodload zsh/datetime
|
|
11
|
+
|
|
12
|
+
local input=$1
|
|
13
|
+
local secs=${input%%.*}
|
|
14
|
+
local iso zone frac
|
|
15
|
+
|
|
16
|
+
if [[ $input = *.* ]]; then
|
|
17
|
+
frac=${input#*.}
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [[ -n $frac ]]; then
|
|
21
|
+
frac="${frac}000" # pad so we always have >= 3 digits
|
|
22
|
+
frac=${frac[1,3]} # millis
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
strftime -s iso '%Y-%m-%dT%H:%M:%S' $secs
|
|
26
|
+
strftime -s zone '%z' $secs # e.g. +0000 / -0400 (no colon)
|
|
27
|
+
|
|
28
|
+
if [[ -n $frac ]]; then
|
|
29
|
+
REPLY="${iso}.${frac}${zone}"
|
|
30
|
+
else
|
|
31
|
+
REPLY="${iso}${zone}"
|
|
32
|
+
fi
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
##
|
|
2
|
+
# ready_log <debug|info|warn|error>
|
|
3
|
+
#
|
|
4
|
+
emulate -L zsh
|
|
5
|
+
|
|
6
|
+
setopt extendedglob pipefail errreturn warncreateglobal warnnestedvar
|
|
7
|
+
|
|
8
|
+
zmodload zsh/datetime
|
|
9
|
+
|
|
10
|
+
autoload -Uz __ready_datetime __ready_print
|
|
11
|
+
|
|
12
|
+
local level
|
|
13
|
+
local configured_level=${READY_LOGLEVEL:-info}
|
|
14
|
+
local -a rest
|
|
15
|
+
local -A mapping=(
|
|
16
|
+
debug yellow
|
|
17
|
+
info cyan
|
|
18
|
+
warn magenta
|
|
19
|
+
error red
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
if (( $+mapping[$1] )); then
|
|
23
|
+
level=$1
|
|
24
|
+
rest=("${(@)@[2,-1]}")
|
|
25
|
+
else
|
|
26
|
+
level=info
|
|
27
|
+
rest=("${(@)@}")
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [[ -z ${(j::)rest} ]]; then
|
|
31
|
+
print -u2 "must enter a debug message"
|
|
32
|
+
return 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if (( READY_DEBUG )); then
|
|
36
|
+
configured_level=debug
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
local -A rank=(debug 0 info 1 warn 2 error 3)
|
|
40
|
+
|
|
41
|
+
if (( ${rank[$level]:-1} >= ${rank[$configured_level]:-1} )); then
|
|
42
|
+
local REPLY
|
|
43
|
+
__ready_datetime $EPOCHREALTIME
|
|
44
|
+
{
|
|
45
|
+
if [[ $READY_LOG_PATH = /dev/(stdin|stderr|tty) && -t 1 ]]; then
|
|
46
|
+
__ready_print -c $mapping[$level] "[%B${REPLY}%b]" "[%B${(U)level}%b]" $rest
|
|
47
|
+
else
|
|
48
|
+
__ready_print "[${REPLY}]" "[${(U)level}]" $rest
|
|
49
|
+
fi
|
|
50
|
+
} >> $READY_LOG_PATH
|
|
51
|
+
fi
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#autoload
|
|
2
|
+
|
|
3
|
+
emulate -L zsh
|
|
4
|
+
|
|
5
|
+
setopt errreturn warncreateglobal warnnestedvar
|
|
6
|
+
|
|
7
|
+
local -A opt_args
|
|
8
|
+
local -a print_opts
|
|
9
|
+
local string
|
|
10
|
+
|
|
11
|
+
zparseopts \
|
|
12
|
+
-D \
|
|
13
|
+
-E \
|
|
14
|
+
-K \
|
|
15
|
+
-A \
|
|
16
|
+
opt_args \
|
|
17
|
+
- \
|
|
18
|
+
v: \
|
|
19
|
+
c: \
|
|
20
|
+
-color: \
|
|
21
|
+
-var:
|
|
22
|
+
(( ? != 0 )) && return 1
|
|
23
|
+
|
|
24
|
+
local var
|
|
25
|
+
|
|
26
|
+
if (( $+opt_args[--var] )); then
|
|
27
|
+
print_opts+=(-v ${opt_args[--var]##=})
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if (( $+opt_args[-v] )); then
|
|
31
|
+
print_opts+=(-v ${opt_args[-v]})
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
local color
|
|
35
|
+
local i
|
|
36
|
+
if (( $+opt_args[--color] )) || (( $+opt_args[-c] )); then
|
|
37
|
+
i=${opt_args[(i)(--color|--color=|-c)]}
|
|
38
|
+
color=${opt_args[${i##=}]}
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
integer string_start_index=${@[(i)[^-]*]}
|
|
42
|
+
integer string_end_index=${#@}
|
|
43
|
+
print_opts+=(${@[1,$((string_start_index - 1))]})
|
|
44
|
+
string="${@[$string_start_index, $string_end_index]}"
|
|
45
|
+
|
|
46
|
+
if [[ -n $color ]]; then
|
|
47
|
+
string="%F{$color}${string}%f"
|
|
48
|
+
if ! (( $print_opts[(I)-P] )); then
|
|
49
|
+
print_opts+=(-P)
|
|
50
|
+
fi
|
|
51
|
+
else
|
|
52
|
+
print_opts+=(--)
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
builtin print $print_opts $string
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#autoload
|
|
2
|
+
# Initializes "ready" functions and completions
|
|
3
|
+
|
|
4
|
+
emulate -L zsh
|
|
5
|
+
|
|
6
|
+
setopt extendedglob warncreateglobal warnnestedvar localtraps
|
|
7
|
+
|
|
8
|
+
trap 'local rc=$?; local str="$0: Something went wrong initialzing ready"; __ready_debug error $str; return $rc' ZERR
|
|
9
|
+
|
|
10
|
+
autoload -Uz __ready_debug
|
|
11
|
+
autoload -Uz compdef
|
|
12
|
+
|
|
13
|
+
local fn
|
|
14
|
+
local compiledpath=$READY_PREFIX/builds.zwc
|
|
15
|
+
local possible_basename
|
|
16
|
+
local possible_declared_completion_fn
|
|
17
|
+
local -a noncompletions
|
|
18
|
+
|
|
19
|
+
compiledpath=${compiledpath:P}
|
|
20
|
+
|
|
21
|
+
if ! [[ -f $compiledpath ]]; then
|
|
22
|
+
print -u2 "Compiled path ${compiledpath} does not exist. Please run 'readyup' to create it."
|
|
23
|
+
return 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Not exposed publicly yet, but this decides during the `autoload -Uz -w` of the zwc wordcode file whether or not to add the +X flag.
|
|
27
|
+
# If enabled, pay a (small) penalty on `ready init`, for consistent performance on the first command call
|
|
28
|
+
# If disabled, `ready init` is faster, but lazy load the source from the zwc on the first command call
|
|
29
|
+
typeset -gx READY_ZSH_EAGER_LOAD=1
|
|
30
|
+
|
|
31
|
+
# Point the `by` client at the ready server's socket. Gem stubs set BY_SOCKET
|
|
32
|
+
# inline per call, but the bare `by`/`ready_by` command relies on the env; the
|
|
33
|
+
# by client otherwise defaults to ~/.by_socket and can't reach the server.
|
|
34
|
+
typeset -gx BY_SOCKET=$READY_SOCK_PATH
|
|
35
|
+
|
|
36
|
+
noncompletions=(${${${${${(f@)"$(builtin zcompile -t $compiledpath)"}[2,-1]}:t}:#_*}:#ready})
|
|
37
|
+
__ready_debug debug "Found the following functions (non-completion)"
|
|
38
|
+
__ready_debug debug "${(F)noncompletions}"
|
|
39
|
+
|
|
40
|
+
__ready_debug debug "Compiled path is $compiledpath. Adding to fpath"
|
|
41
|
+
fpath+=($compiledpath)
|
|
42
|
+
|
|
43
|
+
__ready_debug debug "Now running zcompile..."
|
|
44
|
+
# this loads the entire ready.zwc package in one call, and creates autoload stubs
|
|
45
|
+
# for each of the ready_* functions. They will be fully loaded upon being called for the first
|
|
46
|
+
# time.
|
|
47
|
+
if (( READY_ZSH_EAGER_LOAD == 1 )); then
|
|
48
|
+
builtin autoload -w +X -Uz $compiledpath
|
|
49
|
+
else
|
|
50
|
+
builtin autoload -w -Uz $compiledpath
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
__ready_debug debug "Zcompile done"
|
|
54
|
+
|
|
55
|
+
for fn in $noncompletions; do
|
|
56
|
+
possible_basename=${fn#ready_}
|
|
57
|
+
possible_declared_completion_fn=$READY_COMPLETIONS_DIR/_$fn
|
|
58
|
+
|
|
59
|
+
__ready_debug info "RUN builtin alias -- $possible_basename=$fn"
|
|
60
|
+
builtin alias -- $possible_basename=$fn
|
|
61
|
+
|
|
62
|
+
if (( $+_comps[$fn] )); then
|
|
63
|
+
__ready_debug warn "_$fn already defined: ${(j: -> :)${(kv)_comps[$fn]}}. Skipping..."
|
|
64
|
+
continue
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
if [[ -f $possible_declared_completion_fn ]]; then
|
|
68
|
+
__ready_debug info "Found _$fn function at $possible_declared_completion_fn"
|
|
69
|
+
autoload -Uz _$fn
|
|
70
|
+
compdef _$fn $fn
|
|
71
|
+
continue
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
if (( $+_comps[$possible_basename] )); then
|
|
75
|
+
__ready_debug info "RUN compdef _${possible_basename} $fn"
|
|
76
|
+
compdef _${possible_basename} $fn
|
|
77
|
+
fi
|
|
78
|
+
done
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#autoload
|
|
2
|
+
# Shortcut for running "rake ready in ready project dir"
|
|
3
|
+
|
|
4
|
+
emulate -L zsh
|
|
5
|
+
|
|
6
|
+
zmodload -F zsh/files b:zf_rm b:zf_mkdir
|
|
7
|
+
|
|
8
|
+
setopt extendedglob
|
|
9
|
+
setopt pipefail
|
|
10
|
+
setopt errreturn
|
|
11
|
+
setopt warnnestedvar
|
|
12
|
+
setopt warncreateglobal
|
|
13
|
+
|
|
14
|
+
autoload -Uz readyinit __ready_debug __ready_print
|
|
15
|
+
|
|
16
|
+
local -a tounfun
|
|
17
|
+
local -a tounalias
|
|
18
|
+
|
|
19
|
+
local tmpdir=${READY_PREFIX:?}
|
|
20
|
+
local readydir=${READY_SRC_DIR:?}
|
|
21
|
+
local rc
|
|
22
|
+
|
|
23
|
+
tounfun=(${functions[(I)_(#c0,1)ready_*]} ready_by)
|
|
24
|
+
tounalias=(${${tounfun:t}/#*ready_})
|
|
25
|
+
|
|
26
|
+
(
|
|
27
|
+
local al
|
|
28
|
+
for al in $tounalias; do
|
|
29
|
+
if (( $+aliases[$al] )); then
|
|
30
|
+
builtin unalias $al &>/dev/null
|
|
31
|
+
else
|
|
32
|
+
__ready_debug info "Alias $al not found. Skipping unalias..."
|
|
33
|
+
fi
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
for al in $tounfun; do
|
|
37
|
+
if (( $+functions[$al] )); then
|
|
38
|
+
builtin unfunction $al &>/dev/null
|
|
39
|
+
else
|
|
40
|
+
__ready_debug info "Function $al not found. Skipping unalias..."
|
|
41
|
+
fi
|
|
42
|
+
done
|
|
43
|
+
|
|
44
|
+
builtin cd -q $readydir
|
|
45
|
+
|
|
46
|
+
if ! (( $+commands[rbenv] )); then
|
|
47
|
+
string="%B%rbenv%b was not found. Cannot continue"
|
|
48
|
+
__ready_print -c red $string
|
|
49
|
+
__ready_debug error $string
|
|
50
|
+
return 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
command rbenv exec ruby --disable=gems -W0 -S rake --verbose ready
|
|
54
|
+
)
|
|
55
|
+
rc=$?
|
|
56
|
+
|
|
57
|
+
if (( rc != 0 )); then
|
|
58
|
+
string="Encountered error(%B$rc%b) while running compilation task. Cannot continue. Run %Bready clobber%b to reset the build, then open a new shell to rebuild."
|
|
59
|
+
__ready_print -c red $string
|
|
60
|
+
__ready_debug error $string
|
|
61
|
+
return $rc
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
readyinit
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#autoload
|
|
2
|
+
|
|
3
|
+
emulate -L zsh
|
|
4
|
+
|
|
5
|
+
setopt pipefail
|
|
6
|
+
setopt errreturn
|
|
7
|
+
setopt warnnestedvar
|
|
8
|
+
setopt warncreateglobal
|
|
9
|
+
|
|
10
|
+
autoload -Uz print_colors
|
|
11
|
+
autoload -Uz opt_read
|
|
12
|
+
autoload -Uz ruby
|
|
13
|
+
autoload -Uz ready_ri
|
|
14
|
+
print_colors
|
|
15
|
+
|
|
16
|
+
local -A opt_args
|
|
17
|
+
|
|
18
|
+
zparseopts \
|
|
19
|
+
-D \
|
|
20
|
+
-E \
|
|
21
|
+
-K \
|
|
22
|
+
-A \
|
|
23
|
+
opt_args \
|
|
24
|
+
-F \
|
|
25
|
+
- \
|
|
26
|
+
-no-glow \
|
|
27
|
+
-pager
|
|
28
|
+
(( ? != 0 )) && return 1
|
|
29
|
+
|
|
30
|
+
local -a glow_args
|
|
31
|
+
local no_glow=false
|
|
32
|
+
|
|
33
|
+
opt_read -c pager && glow_args+=(--pager)
|
|
34
|
+
opt_read opt_args no-glow && no_glow=true
|
|
35
|
+
|
|
36
|
+
# for some reason ruby is faster for running this formatting script than "by"? I wonder why - main component of that script is prism
|
|
37
|
+
ready_ri ${@} \
|
|
38
|
+
| {
|
|
39
|
+
if $no_glow; then
|
|
40
|
+
gcat
|
|
41
|
+
else
|
|
42
|
+
ruby ~/repos/formatter.rb \
|
|
43
|
+
| command gawk '
|
|
44
|
+
/```ruby/{block=1; print; next}
|
|
45
|
+
/```/{block=0; print; next}
|
|
46
|
+
block==1{gsub(/^ /,"")}
|
|
47
|
+
{print} ' \
|
|
48
|
+
| ptywrap -- glow ${glow_args}
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# run in subshell so that it can do its thing without tampering with fpath, PATH, other globals
|
|
2
|
+
|
|
3
|
+
() {
|
|
4
|
+
setopt pipefail
|
|
5
|
+
|
|
6
|
+
zmodload zsh/files
|
|
7
|
+
zmodload -m -F zsh/files b:zf_\*
|
|
8
|
+
|
|
9
|
+
local __FILE__=${${(%)${:-%x}}:A}
|
|
10
|
+
local __DIR__=${__FILE__:h:A}
|
|
11
|
+
typeset -gx READY_COMPLETIONS_DIR=${__DIR__:h}/site-functions
|
|
12
|
+
typeset -gx READY_PREFIX=${READY_PREFIX:-/tmp/ready}
|
|
13
|
+
typeset -gx READY_LOG_PATH=${READY_LOG_PATH:-${READY_PREFIX}/ready.log}
|
|
14
|
+
typeset -gx READY_DEBUG=${READY_DEBUG:-0}
|
|
15
|
+
typeset -gx READY_SRC_DIR=${__DIR__:h:h}
|
|
16
|
+
typeset -gx READY_SOCK_PATH=${READY_SOCK_PATH:-${READY_PREFIX}/ready.sock}
|
|
17
|
+
|
|
18
|
+
if ! [[ -d $READY_PREFIX ]]; then
|
|
19
|
+
zf_mkdir -p $READY_PREFIX
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
fpath+=($__DIR__/functions $__DIR__/functions/ready $READY_COMPLETIONS_DIR)
|
|
23
|
+
|
|
24
|
+
autoload -Uz readyup readyinit __ready_debug __ready_print
|
|
25
|
+
|
|
26
|
+
local rc=1
|
|
27
|
+
|
|
28
|
+
if [[ -S $READY_SOCK_PATH ]]; then
|
|
29
|
+
__ready_debug debug "Sock found, returning"
|
|
30
|
+
readyinit
|
|
31
|
+
|
|
32
|
+
return
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
__ready_debug debug "Sock not found, creating"
|
|
36
|
+
|
|
37
|
+
if ! (( $+parameters[RBENV_SHELL] )); then
|
|
38
|
+
__ready_debug warn "RBENV_SHELL not detected"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
readyup; rc=$?
|
|
42
|
+
|
|
43
|
+
if (( rc )); then
|
|
44
|
+
autoload -Uz __ready_print
|
|
45
|
+
__ready_print -u2 -c red "Ready failed to initialize. Check %B${READY_LOG_PATH}%b for more info"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
return $rc
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ready/ready.plugin.zsh
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#compdef ready_ronin
|
|
2
|
+
|
|
3
|
+
autoload -Uz _ronin
|
|
4
|
+
|
|
5
|
+
# need to call this once to get _ronin_completions loaded
|
|
6
|
+
_ronin &>/dev/null
|
|
7
|
+
|
|
8
|
+
# set ${_comps[ready_ronin]} to "_bash_complete -F _ronin_completions", and
|
|
9
|
+
# then remove this "bootstrapper" function. After this is done, the zsh-bash handler takes
|
|
10
|
+
# over.
|
|
11
|
+
compdef _bash_complete\ -F\ _ronin_completions ready_ronin
|
|
12
|
+
unfunction _ready_ronin
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ready
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Gillis
|
|
@@ -9,6 +9,34 @@ bindir: exe
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: by
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.1'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.1'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: command_kit
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0.6'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0.6'
|
|
12
40
|
- !ruby/object:Gem::Dependency
|
|
13
41
|
name: zeitwerk
|
|
14
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -36,9 +64,45 @@ files:
|
|
|
36
64
|
- LICENSE.txt
|
|
37
65
|
- README.md
|
|
38
66
|
- Rakefile
|
|
67
|
+
- demo/demofns.zsh
|
|
68
|
+
- demo/rubyconf.rec
|
|
39
69
|
- exe/ready
|
|
70
|
+
- extra/browse.sh
|
|
71
|
+
- extra/finder.sh
|
|
72
|
+
- extra/formatter
|
|
73
|
+
- extra/formatter.rb
|
|
74
|
+
- extra/ri.rb
|
|
75
|
+
- extra/rif
|
|
76
|
+
- extra/rif2
|
|
77
|
+
- issues.rec
|
|
40
78
|
- lib/ready.rb
|
|
79
|
+
- lib/ready/by_executable.rb
|
|
80
|
+
- lib/ready/cli.rb
|
|
81
|
+
- lib/ready/cli/clobber.rb
|
|
82
|
+
- lib/ready/cli/compile.rb
|
|
83
|
+
- lib/ready/cli/init.rb
|
|
84
|
+
- lib/ready/cli/rake_command.rb
|
|
85
|
+
- lib/ready/cli/up.rb
|
|
86
|
+
- lib/ready/configuration.rb
|
|
87
|
+
- lib/ready/executable.rb
|
|
88
|
+
- lib/ready/executable/multiple_files_error.rb
|
|
89
|
+
- lib/ready/fn.zsh.erb
|
|
90
|
+
- lib/ready/readyfile.rb
|
|
91
|
+
- lib/ready/readyfile/executable.rb
|
|
41
92
|
- lib/ready/version.rb
|
|
93
|
+
- lib/ready/zsh_function.rb
|
|
94
|
+
- lib/ready/zsh_script.rb
|
|
95
|
+
- rakelib/ready.rake
|
|
96
|
+
- readyfile
|
|
97
|
+
- zsh/ready.plugin.zsh
|
|
98
|
+
- zsh/ready/functions/ready/__ready_datetime
|
|
99
|
+
- zsh/ready/functions/ready/__ready_debug
|
|
100
|
+
- zsh/ready/functions/ready/__ready_print
|
|
101
|
+
- zsh/ready/functions/readyinit
|
|
102
|
+
- zsh/ready/functions/readyup
|
|
103
|
+
- zsh/ready/functions/rizz
|
|
104
|
+
- zsh/ready/ready.plugin.zsh
|
|
105
|
+
- zsh/site-functions/_ready_ronin
|
|
42
106
|
licenses:
|
|
43
107
|
- MIT
|
|
44
108
|
metadata:
|
|
@@ -50,14 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
50
114
|
requirements:
|
|
51
115
|
- - ">="
|
|
52
116
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 4.
|
|
117
|
+
version: 3.4.7
|
|
54
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
119
|
requirements:
|
|
56
120
|
- - ">="
|
|
57
121
|
- !ruby/object:Gem::Version
|
|
58
122
|
version: '0'
|
|
59
123
|
requirements: []
|
|
60
|
-
rubygems_version: 4.0.
|
|
124
|
+
rubygems_version: 4.0.15
|
|
61
125
|
specification_version: 4
|
|
62
126
|
summary: A new Ruby gem
|
|
63
127
|
test_files: []
|