Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions actions/homebrew-alias/modernize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ render() {
/^[[:space:]]*system_command[[:space:]]+/ {
sub(/system_command[[:space:]]+/, "run ")
}
/"#\{staged_path\}\// {
sub(/"#\{staged_path\}\//, "\"")
sub(/\][[:space:]]*$/, "], base: :staged_path")
# base: resolves only the command path, never args, so a staged path in
# args has to stay absolute through the install-step template token.
/#\{staged_path\}/ {
gsub(/#\{staged_path\}/, "{{staged_path}}")
}
{ print }
' "$file"
Expand Down
4 changes: 3 additions & 1 deletion actions/homebrew-alias/test_modernize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ for stanza in preflight_steps postflight_steps uninstall_preflight_steps uninsta
done
echo "$out" | grep -q '^ # postflight do must not change inside a comment$' \
&& ok "comment preserved" || bad "comment preserved"
echo "$out" | grep -q 'run "/usr/bin/xattr", args: \["-dr", "com.apple.quarantine", "example"\], base: :staged_path' \
echo "$out" | grep -qF 'run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{staged_path}}/example"]' \
&& ok "command converted to install-step DSL" || bad "command converted to install-step DSL"
echo "$out" | grep -q 'base: :staged_path' \
&& bad "staged path must not move to base:" || ok "staged path kept in args"
echo "$out" | grep -q 'system_command' \
&& bad "legacy command should be absent" || ok "legacy command absent"

Expand Down
Loading