homebrew-core/Formula/jruby.rb
Pepijn Van Eeckhoudt bd35d1596e jruby: fix stack overflow in jgem command.
In jruby 1.7.10 (possibly earlier) the script in bin/gem simply calls bin/jgem. The jruby formula overwrites jgem with gem in the 'prefix with j' paragraph. This way the jgem script end up calling itself infinitely causing a stack overflow crash.

Closes Homebrew/homebrew#26910.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-02-23 12:44:18 +00:00

35 lines
948 B
Ruby

require 'formula'
class Jruby < Formula
homepage 'http://www.jruby.org'
url 'http://jruby.org.s3.amazonaws.com/downloads/1.7.10/jruby-bin-1.7.10.tar.gz'
sha1 '5ec267dd3ddaa6e27801692a7080204067662289'
def install
# Remove Windows files
rm Dir['bin/*.{bat,dll,exe}']
cd 'bin' do
# Prefix a 'j' on some commands to avoid clashing with other ruby installations
['ast', 'rake', 'rdoc', 'ri', 'testrb'].each { |f| mv f, "j#{f}" }
# Delete some unnecessary command
# gem is a wrapper script for jgem
# irb is an identical copy of jirb
['gem', 'irb'].each { |f| rm f }
end
# Only keep the OS X native libraries
cd 'lib/jni' 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