This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

ruby192: style cleanups

Overhaul this formula to bring it in line with current best practices.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information...
1 parent e7ace76 commit 10c6f4c89b87a14914614b61737770a2dd9b2b41 @jacknagel jacknagel committed Aug 19, 2012
Showing with 24 additions and 44 deletions.
  1. +24 −44 ruby192.rb
View
@@ -5,68 +5,48 @@ class Ruby192 < Formula
url 'http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.bz2'
sha256 '403b3093fbe8a08dc69c269753b8c6e7bd8f87fb79a7dd7d676913efe7642487'
- head 'http://svn.ruby-lang.org/repos/ruby/trunk/', :using => :svn
+ head 'http://svn.ruby-lang.org/repos/ruby/trunk/'
+ depends_on :autoconf if build.head?
+ depends_on 'pkg-config' => :build
depends_on 'readline'
+ depends_on 'gdbm'
depends_on 'libyaml'
- fails_with_llvm :build => 2326
+ option :universal
+ option 'with-suffix', 'Suffix commands with "19"'
+ option 'with-doc', 'Install documentation'
+
+ fails_with :llvm do
+ build 2326
+ end
# Stripping breaks dynamic linking
skip_clean :all
- def options
- [
- ["--with-suffix", "Add a 19 suffix to commands"],
- ["--with-doc", "Install with the Ruby documentation"],
- ["--universal", "Compile a universal binary (arch=x86_64,i386)"],
- ]
- end
-
def install
- ruby_lib = HOMEBREW_PREFIX+"lib/ruby"
-
- if File.exist? ruby_lib and File.symlink? ruby_lib
- opoo "#{ruby_lib} exists as a symlink"
- puts <<-EOS.undent
- The previous Ruby formula symlinked #{ruby_lib} into Ruby's Cellar.
+ system "autoconf" if build.head?
- This version creates this as a "real folder" in HOMEBREW_PREFIX
- so that installed gems will survive between Ruby updates.
+ args = %W[--prefix=#{prefix}
+ --enable-shared]
- Please remove this existing symlink before continuing:
- rm #{ruby_lib}
- EOS
- exit 1
- end
-
- system "autoconf" unless File.exists? 'configure'
-
- # Configure claims that "--with-readline-dir" is unused, but it works.
- args = ["--prefix=#{prefix}",
- "--with-readline-dir=#{Formula.factory('readline').prefix}",
- "--disable-debug",
- "--disable-dependency-tracking",
- "--enable-shared"]
-
- args << "--program-suffix=19" if ARGV.include? "--with-suffix"
- args << "--with-arch=x86_64,i386" if ARGV.build_universal?
+ args << "--program-suffix=19" if build.include? 'with-suffix'
+ args << "--with-arch=x86_64,i386" if build.universal?
# Put gem, site and vendor folders in the HOMEBREW_PREFIX
+ ruby_lib = HOMEBREW_PREFIX/"lib/ruby"
+ (ruby_lib/'site_ruby').mkpath
+ (ruby_lib/'vendor_ruby').mkpath
+ (ruby_lib/'gems').mkpath
- (ruby_lib+'site_ruby').mkpath
- (ruby_lib+'vendor_ruby').mkpath
- (ruby_lib+'gems').mkpath
-
- (lib+'ruby').mkpath
- ln_s (ruby_lib+'site_ruby'), (lib+'ruby')
- ln_s (ruby_lib+'vendor_ruby'), (lib+'ruby')
- ln_s (ruby_lib+'gems'), (lib+'ruby')
+ (lib/'ruby').install_symlink ruby_lib/'site_ruby',
+ ruby_lib/'vendor_ruby',
+ ruby_lib/'gems'
system "./configure", *args
system "make"
system "make install"
- system "make install-doc" if ARGV.include? "--with-doc"
+ system "make install-doc" if build.include? 'with-doc'
end

0 comments on commit 10c6f4c

Please sign in to comment.