%define ruby		/usr/bin/ruby
%define rbindir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["bindir"]')
%define rlibdir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
%define rarchdir %(%{ruby} -r rbconfig -e 'print Config::CONFIG["archdir"]')

Summary: A Textile library for Ruby
Summary(ja): RubyのためのTextileライブラリ
Name: RedCloth
Version: 3.0.4
Release: 1%{?_dist_release}
License: BSD
Group: System Environment/Libraries
Source: http://rubyforge.org/frs/download.php/6064/RedCloth-3.0.4.tar.gz
Patch1: RedCloth-3.0.4-ri-data-install.patch
Patch2: RedCloth-3.0.4-fix-shebang.patch
URL: http://rubyforge.org/projects/redcloth/
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildPreReq: ruby ruby-devel rdoc
Requires: ruby

%description
RedCloth is a library for using Textile in Ruby.  Textile is a text
format.  A very simple text format.  Another stab at making readable
text that can be converted to HTML.

%description -l ja
RedClothはRubyでテキストフォーマットの一種であるTextileを使うためのラ
イブラリです。これはとてもシンプルなフォーマットであり、HTML形式に変換
することができます。

%prep

%setup -q

%patch1 -p1
%patch2 -p1

%build
%{ruby} setup.rb config --rbdir=\$stdruby
%{ruby} setup.rb setup

cd doc
%{ruby} make.rb README > ../README.html
%{ruby} make.rb QUICK-REFERENCE > ../QUICK-REFERENCE.html
%{ruby} make.rb REFERENCE > ../REFERENCE.html

cd ..

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{rbindir}
mkdir -p ${RPM_BUILD_ROOT}%{rlibdir}

%{ruby} setup.rb install --prefix=${RPM_BUILD_ROOT}

%clean
rm -rf ${RPM_BUILD_ROOT}
rm README.html QUICK-REFERENCE.html REFERENCE.html

%files
%defattr(-, root, root)
%doc doc/CHANGELOG
%doc doc/README
%doc doc/REFERENCE
%{_bindir}/*
%{rlibdir}/*
%{_datadir}/ri/*/*/RedCloth/*

%changelog
* Sun Oct 05 2008 Shu KONNO <owa@bg.wakwak.com> 3.0.4-1vl5
- applied new versioning policy, spec in utf-8

* Mon Mar 19 2007 akira yamada <akira@vinelinux.org> 3.0.4-0vl1
- initial packaging.

