File rubygem-rails-2_3.spec of Package rubygem-rails-2_3

# spec file for package rubygem-rails-2_3
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

# norootforbuild

Name:           rubygem-rails-2_3
Version:        2.3.14
Release:        0
%define mod_name rails
%define mod_full_name %{mod_name}-%{version}
%define mod_branch -2_3
%define mod_weight 23
Group:          Development/Languages/Ruby
License:        MIT
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  rubygems_with_buildroot_patch
Provides:       rubygem-%{mod_name} = %{version}-%{release}
# rake >= 0.8.3
BuildRequires:  rubygem-rake >= 0.8.3
Requires:       rubygem-rake >= 0.8.3
# activesupport = 2.3.14
BuildRequires:  rubygem-activesupport-2_3 = %{version}
Requires:       rubygem-activesupport-2_3 = %{version}
# activerecord = 2.3.14
BuildRequires:  rubygem-activerecord-2_3 = %{version}
Requires:       rubygem-activerecord-2_3 = %{version}
# actionpack = 2.3.14
BuildRequires:  rubygem-actionpack-2_3 = %{version}
Requires:       rubygem-actionpack-2_3 = %{version}
# actionmailer = 2.3.14
BuildRequires:  rubygem-actionmailer-2_3 = %{version}
Requires:       rubygem-actionmailer-2_3 = %{version}
# activeresource = 2.3.14
BuildRequires:  rubygem-activeresource-2_3 = %{version}
Requires:       rubygem-activeresource-2_3 = %{version}
# we need rubygem-rdoc because 2.3.12 got ported to the new API
# the requires is missing in the gem spec
Requires:       rubygem-rdoc > 2.4.2
PreReq:         update-alternatives
Source:         %{mod_full_name}.gem
Summary:        Web-application framework with template engine, control-flow layer, and ORM
Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or
WEBrick on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle
with eRuby- or Builder-based templates.

%package doc
Summary:        RDoc documentation for %{mod_name}
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}
%description doc
Documentation generated at gem installation time.
Usually in RDoc and RI formats.

%gem_install %{S:0}
mv %{buildroot}%{_bindir}/rails{,%{mod_branch}}
%{__ln_s} rails %{buildroot}%{_bindir}/rails
# make sure it installs the right version when using rails-1.1
ruby -p -i.bak -e '$_.gsub!(/>= 0/, "= %{version}")' %{buildroot}%{_bindir}/rails%{mod_branch}
diff -urN %{buildroot}%{_bindir}/rails%{mod_branch}{.bak,} || :
rm %{buildroot}%{_bindir}/rails%{mod_branch}.bak
find %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/ -name dispatch.\* -print0 | \
    xargs -r0 ruby -p -i -e 'gsub(%r{#!.*/bin/ruby}, "#!/usr/bin/ruby")'

%{__rm} -rf %{buildroot}

/usr/sbin/update-alternatives --install \
    %{_bindir}/rails rails %{_bindir}/rails%{mod_branch} %{mod_weight}

if [ "$1" = 0 ] ; then
    /usr/sbin/update-alternatives --remove rails %{_bindir}/rails%{mod_branch}

%ghost %config(noreplace) %{_bindir}/rails

%files doc
%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/