From 332aa4a482d846911cc534ff552478f884a23ece Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 7 Aug 2012 15:47:36 -0500
Subject: ruby 1.9.3

---
 abs/extra/ruby/PKGBUILD     | 79 ++++++++++++++++++++++++---------------------
 abs/extra/ruby/gemrc        |  5 +++
 abs/extra/ruby/ruby.install | 22 +++++++++++++
 3 files changed, 69 insertions(+), 37 deletions(-)
 create mode 100644 abs/extra/ruby/gemrc
 create mode 100644 abs/extra/ruby/ruby.install

diff --git a/abs/extra/ruby/PKGBUILD b/abs/extra/ruby/PKGBUILD
index e990221..0845452 100644
--- a/abs/extra/ruby/PKGBUILD
+++ b/abs/extra/ruby/PKGBUILD
@@ -1,51 +1,56 @@
-# $Id: PKGBUILD 96253 2010-10-19 15:06:00Z stephane $
-# Maintainer: Allan McRae <allan@archlinux.org>
+# Maintainer: Thomas Dziedzic <gostrc@gmail.com>
+# Contributor: Allan McRae <allan@archlinux.org>
 # Contributor: John Proctor <jproctor@prium.net>
 # Contributor: Jeramy Rutley <jrutley@gmail.com>
 
-pkgname=('ruby' 'ruby-docs')
-pkgver=1.9.2_p0
-_pkgver=1.9.2-p0
-pkgrel=4
-pkgdesc="An object-oriented language for quick and easy programming"
+pkgname=ruby
+pkgver=1.9.3_p194
+pkgrel=2
+pkgdesc='An object-oriented language for quick and easy programming'
 arch=('i686' 'x86_64')
-url="http://www.ruby-lang.org/en/"
-license=('custom')
-makedepends=('gdbm' 'db' 'openssl' 'zlib' 'readline' 'tk' 'libffi'
-             'doxygen' 'graphviz')
-options=('!emptydirs')
-source=("ftp://ftp.ruby-lang.org/pub/ruby/1.9/${pkgname}-${_pkgver}.tar.bz2")
-md5sums=('d8a02cadf57d2571cd4250e248ea7e4b')
-sha256sums=('e9710990ed8c2e794123aba509010471915fb13c27dae0118831d2001a9c8d3b')
+url='http://www.ruby-lang.org/en/'
+license=('BSD' 'custom')
+backup=('etc/gemrc')
+provides=('rubygems' 'rake')
+conflicts=('rake')
+depends=('openssl' 'libffi' 'libyaml')
+makedepends=('tk')
+optdepends=('tk: for Ruby/TK'
+            'ruby-docs: Ruby documentation')
+options=('!emptydirs' '!makeflags')
+install='ruby.install'
+source=("ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/ruby-${pkgver//_/-}.tar.bz2"
+        'gemrc')
+md5sums=('2278eff4cfed3cbc0653bc73085caa34'
+         '6fb8e7a09955e0f64be3158fb4a27e7a')
 
 build() {
-  cd "${srcdir}/${pkgname}-${_pkgver}"
-  ./configure --prefix=/usr \
-      --enable-shared \
-      --enable-pthread \
-      --disable-rpath
+  cd ruby-${pkgver//_/-}
+
+  PKG_CONFIG=/usr/bin/pkg-config ./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --enable-shared \
+    --enable-pthread \
+    --disable-rpath \
+    --disable-install-doc
+
   make
 }
 
-package_ruby()
-{
-  depends=('gdbm' 'db' 'openssl' 'zlib' 'readline' 'libffi')
-  provides=('rubygems' 'rake')
-  conflicts=('rubygems' 'rake')
-  optdepends=('tk: for Ruby/TK')
+check() {
+  cd ruby-${pkgver//_/-}
 
-  cd "${srcdir}/${pkgname}-${_pkgver}"
-  make DESTDIR="${pkgdir}" install-nodoc
-  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
+  make test
 }
 
-package_ruby-docs()
-{
-  pkgdesc="Documentation files for ruby"
-  #arch=('any')
-  depends=('ruby')
+package() {
+  cd ruby-${pkgver//_/-}
+
+  make DESTDIR="${pkgdir}" install-nodoc
+
+  install -D -m644 ${srcdir}/gemrc "${pkgdir}/etc/gemrc"
 
-  cd "${srcdir}/${pkgname}-${_pkgver}"
-  make -j1 DESTDIR="${pkgdir}" install-doc install-capi
-  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/ruby-docs/COPYING"
+  install -D -m644 COPYING "${pkgdir}/usr/share/licenses/ruby/LICENSE"
+  install -D -m644 BSDL "${pkgdir}/usr/share/licenses/ruby/BSDL"
 }
diff --git a/abs/extra/ruby/gemrc b/abs/extra/ruby/gemrc
new file mode 100644
index 0000000..3d11de1
--- /dev/null
+++ b/abs/extra/ruby/gemrc
@@ -0,0 +1,5 @@
+# Read about the gemrc format at http://docs.rubygems.org/read/chapter/11
+
+# --user-install is used to install to $HOME/.gem/ by default since we want to separate
+#                pacman installed gems and gem installed gems
+gem: --user-install
diff --git a/abs/extra/ruby/ruby.install b/abs/extra/ruby/ruby.install
new file mode 100644
index 0000000..ce78e96
--- /dev/null
+++ b/abs/extra/ruby/ruby.install
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+print_gem_default_target() {
+  echo 'The default location of gem installs is $HOME/.gem/ruby'
+  echo 'Add the following line to your PATH if you plan to install using gem'
+  echo '$(ruby -rubygems -e "puts Gem.user_dir")/bin'
+  echo 'If you want to install to the system wide location, you must either:'
+  echo 'edit /etc/gemrc or run gem with the --no-user-install flag.'
+}
+
+# arg 1:  the new package version
+post_install() {
+  print_gem_default_target
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_upgrade() {
+  if [ "$(vercmp $2 1.9.3_p125-4)" -lt 0 ]; then
+    print_gem_default_target
+  fi
+}
-- 
cgit v0.12

