homebrew-core/Formula/jruby.rb
Jack Nagel 7c648d9732 Shore up a number of shell quoting issues
When interpolating in strings passed to Formula#system, it should be
done in such a way that if any interpolated variables contain spaces,
they are either (a) passed as part of a list or (b) protected by quotes
if they are part of a long string (which is subject to shell expansion).
Otherwise, they will be split on the space when expanded by the shell
and passed as multiple arguments to whatever process is being executed.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-15 14:03:11 -05:00

33 lines
756 B
Ruby

require 'formula'
class Jruby < Formula
homepage 'http://www.jruby.org'
url 'http://jruby.org.s3.amazonaws.com/downloads/1.6.7/jruby-bin-1.6.7.tar.gz'
sha1 '926d4f5b85af075a76c0e59cb4ea34f5c6b770c9'
def install
# Remove Windows files
rm Dir['bin/*.{bat,dll,exe}']
# Prefix a 'j' on some commands
cd 'bin' do
Dir['*'].each do |file|
mv file, "j#{file}" unless file.match /^[j]/
end
end
# Only keep the OS X native libraries
cd 'lib/native' do
Dir['*'].each do |file|
rm_rf file unless file.downcase == 'darwin'
end
end
libexec.install Dir['*']
bin.install_symlink Dir["#{libexec}/bin/*"]
end
def test
system "#{bin}/jruby", "-e", "puts 'hello'"
end
end