2019-12-13 07:14:10 -05:00
|
|
|
<%
|
2019-01-22 19:40:43 -05:00
|
|
|
class Zim
|
2022-01-11 11:29:47 -05:00
|
|
|
attr_reader :version, :home, :min_zsh_version, :url_regex,
|
2023-09-16 14:16:19 -04:00
|
|
|
:bold, :normal, :red, :normalred, :yellow, :normalyellow, :clear_line, :ellipsis, :okay, :warn, :error
|
2019-01-22 19:40:43 -05:00
|
|
|
|
|
|
|
def initialize
|
2023-09-16 14:26:53 -04:00
|
|
|
@version = "1.12.1"
|
2019-01-22 19:40:43 -05:00
|
|
|
@home = "${ZDOTDIR:-${HOME}}"
|
|
|
|
@min_zsh_version = "5.2"
|
2021-04-03 10:35:28 -04:00
|
|
|
# Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo
|
|
|
|
# but not file:///path/to/repo or /path/to/repo
|
|
|
|
# ${match[3]} contains host, and ${match[4]} contains org/repo
|
|
|
|
@url_regex = "^([^:@/]+://)?([^@]+@)?([^:/]+)[:/]([^/]+/[^/]+)/?$"
|
2023-09-16 14:16:19 -04:00
|
|
|
@bold = "\\E[1m"
|
|
|
|
@normal = "\\E[0m"
|
|
|
|
@yellow = "\\E[33m"
|
|
|
|
@normalyellow = "\\E[0;33m"
|
|
|
|
@red = "\\E[31m"
|
|
|
|
@normalred = "\\E[0;31m"
|
|
|
|
@clear_line = "\\E[2K\\r"
|
2019-12-13 07:14:10 -05:00
|
|
|
@ellipsis = " ..."
|
2023-09-16 14:16:19 -04:00
|
|
|
@okay = "\\E[32m)\\E[0m "
|
2020-05-25 15:01:00 -04:00
|
|
|
@warn = "! "
|
2019-12-13 07:14:10 -05:00
|
|
|
@error = "x "
|
2019-01-22 19:40:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def render(filename)
|
|
|
|
ERB.new(File.read(filename)).result(binding)
|
|
|
|
end
|
|
|
|
|
|
|
|
def render_all(pattern)
|
|
|
|
Dir[pattern].sort.map { |filename| render(filename) }.join("\n")
|
|
|
|
end
|
|
|
|
|
2021-04-03 10:35:28 -04:00
|
|
|
def render_commented(filename)
|
|
|
|
render(filename).gsub(/^(?=.)/, "# ").gsub(/^$/, "#")
|
|
|
|
end
|
2019-01-22 19:40:43 -05:00
|
|
|
end
|
|
|
|
zim = Zim.new
|
|
|
|
%># AUTOMATICALLY GENERATED FILE. EDIT ONLY THE SOURCE FILES AND THEN COMPILE.
|
|
|
|
# DO NOT DIRECTLY EDIT THIS FILE!
|
|
|
|
|
2019-12-08 20:03:45 -05:00
|
|
|
<%= zim.render_commented("LICENSE") %>
|
2019-12-01 16:00:47 -05:00
|
|
|
<%= zim.render_all("src/stage2/*.erb") %>
|
2021-09-20 22:14:12 -04:00
|
|
|
if [[ ${functrace[1]} == zmodule:* ]]; then
|
|
|
|
zmodule "${@}"
|
|
|
|
else
|
|
|
|
zimfw "${@}"
|
|
|
|
fi
|