diff options
| author | Adam Vandenberg | 2012-08-07 11:16:45 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2012-10-27 19:28:42 -0700 |
| commit | 73b3977ab4b516d20912fc50f36477dc59b6c28e (patch) | |
| tree | 54deb64acfd694c3cdafd004ee061c5f11250f84 /Library | |
| parent | 267ffddbd3042127d0c8b88580ba12df960981d0 (diff) | |
| download | brew-73b3977ab4b516d20912fc50f36477dc59b6c28e.tar.bz2 | |
Pathname: add exec and jar helpers
Closes Homebrew/homebrew#13318.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 054e5b078..bfbb448cf 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -348,6 +348,30 @@ class Pathname 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 # sets $n and $d so you can observe creation of stuff |
