# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/gems.eclass,v 1.26 2009/05/23 12:22:06 flameeyes Exp $ # @ECLASS: gems.eclass # @MAINTAINER: # ruby@gentoo.org # # Original Author: Rob Cakebread # # @BLURB: Eclass helping with the installation of RubyGems # @DESCRIPTION: # See http://dev.gentoo.org/~pythonhead/ruby/gems.html for notes on using gems with Portage. # @ECLASS-VARIABLE: USE_RUBY # @DESCRIPTION: # Ruby versions the gem is compatible to. The eclass will install the gem for # versions that are compatible and installed on the system. Format: rubyDD where # DD is the two-digit version suffix (e.g.: USE_RUBY="ruby19" for Ruby 1.9.1) inherit eutils ruby SRC_URI="mirror://rubyforge/gems/${P}.gem" IUSE="doc" DEPEND=" || ( >=dev-ruby/rubygems-0.9.4 =dev-lang/ruby-1.9* ) !=1.3.0 needs a path fix local gte13=$(/usr/bin/${ruby_version} -rubygems -e 'puts Gem::RubyGemsVersion >= "1.3.0"') if [[ "${gte13}" == "true" ]] ; then /usr/bin/${ruby_version} /usr/bin/gem install ${GEM_SRC} \ --version ${PV} ${myconf} --local --install-dir "${D}/${GEMSDIR}" \ --sandbox-fix --no-user-install || die "gem (>=1.3.0) install failed" else /usr/bin/${ruby_version} /usr/bin/gem install ${GEM_SRC} \ --version ${PV} ${myconf} --local --install-dir "${D}/${GEMSDIR}" \ || die "gem (<1.3.0) install failed" fi if [[ -d "${D}/${GEMSDIR}/bin" ]] ; then exeinto /usr/bin for exe in "${D}"/${GEMSDIR}/bin/* ; do if [ "$num_ruby_slots" -ge 2 ] ; then # Ensures that the exe file gets run using the currently # selected version of ruby. sed -i -e 's@^#!/usr/bin/ruby.*$@#!/usr/bin/ruby@' "${exe}" fi doexe "${exe}" || die done fi done } EXPORT_FUNCTIONS src_unpack src_compile src_install