Skip to content

Commit 6784709

Browse files
fix(internal): fix formatting script for macos
1 parent ebf0cae commit 6784709

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Rakefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ end
5858
desc("Format `*.rbs`")
5959
multitask(:"format:syntax_tree") do
6060
find = %w[find ./sig -type f -name *.rbs -print0]
61-
inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? %w[-i''] : %w[-i]
61+
inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i]
6262
uuid = SecureRandom.uuid
6363

6464
# `syntax_tree` has trouble with `rbs`'s class & module aliases
6565

66-
sed = xargs + %w[sed -E] + inplace + %w[-e]
66+
sed_bin = /darwin/ =~ RUBY_PLATFORM ? "/usr/bin/sed" : "sed"
67+
sed = xargs + [sed_bin, "-E", *inplace, "-e"]
6768
# annotate unprocessable aliases with a unique comment
6869
pre = sed + ["s/(class|module) ([^ ]+) = (.+$)/# \\1 #{uuid}\\n\\2: \\3/", "--"]
6970
fmt = xargs + %w[stree write --plugin=rbs --]

0 commit comments

Comments
 (0)