mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
parent
267ffddbd3
commit
73b3977ab4
@ -348,6 +348,30 @@ class Pathname
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Writes an exec script in this folder for each target pathname
|
||||||
|
def write_exec_script *targets
|
||||||
|
targets = [targets].flatten
|
||||||
|
if targets.empty?
|
||||||
|
opoo "tried to write exec sripts to #{self} for an empty list of targets"
|
||||||
|
end
|
||||||
|
targets.each do |target|
|
||||||
|
target = Pathname.new(target) # allow pathnames or strings
|
||||||
|
(self+target.basename()).write <<-EOS.undent
|
||||||
|
#!/bin/bash
|
||||||
|
exec "#{target}" "$@"
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Writes an exec script that invokes a java jar
|
||||||
|
def write_jar_script target_jar, script_name, java_opts=""
|
||||||
|
(self+script_name).write <<-EOS.undent
|
||||||
|
#!/bin/bash
|
||||||
|
exec java #{java_opts} -jar #{target_jar} "$@"
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# sets $n and $d so you can observe creation of stuff
|
# sets $n and $d so you can observe creation of stuff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user