PackagingDrafts/Gem expand stage change

= Propoposal to change the stage to expand RubyGem file =

Current guidelines
Current guidelines for packaging RubyGem files here says: gem install --local --install-dir %{buildroot}%{gemdir} --force %{SOURCE0}
 * The  and   sections of the specfile should be empty.
 * The install should be performed with the command

This means that
 * usually RubyGem files should be expanded under  directly without using   or   stage.

Issues with current guidelines
Some of the issues with current guidelines are already discussed on the thread beginning at here and continues to this.
 * When we want to apply some needed patches after expanding Gem files, with current guidelines  macro canot be used because   macro can be used only at %prep
 * When we want to execute some check programs to verify if the Gems to be installed really work, we usually create  stage and execute them at the stage. With current guidelines we must execute these check programs under.
 * This is troublesome if executing such programs create additional files (under )
 * Note that when Gem file creates C extension libraries, we have already moved the stage to expand Gem file from  to   (not , however) to create   rpm correctly.

Proposal
All RubyGem files should be expanded at  first. i.e. %prep %setup -q -c -T
 * RubyGem files should be expanded under  at prep first. This can usually be performed by the folloing lines:

mkdir -p .%{gemdir} (If RubyGem creates C extension modules, adding the following line is recommend: export CONFIGURE_ARGS="--with-cflags='%{optflags}'" ) gem install -V --local \ --install-dir $(pwd)/%{gemdir} \ --force --rdoc \ %{SOURCE0} %install rm -rf %{buildroot}
 * stage can be empty.
 * Then at  stage the whole tree under the directory created at   should be copied (not moved) to under   by the following for example.

mkdir -p %{buildroot}%{gemdir} cp -a .%{gemdir}/* %{buildroot}%{gemdir}/ %global geminstdir %{gemdir}/gems/%{gemname}-%{version} BuildRequires: rubygem(rake)
 * Executing some test program at  stage is recommended if there exists. This can performed by the following for example:

%check export GEM_PATH=.%{gemdir} pushd .%{geminstdir} rake test popd

Some notes

 * There is an annoying discussion about whether expanding RubyGems should be at %prep or %build when Gem creates C extension modules. However as current Gem mechanism cannot allow for us to "expand" Gems and "build" them separately, I came to think that moving expansion stage from  to   does not matter.