On Wed, 9 Jan 2013 13:25:22 +0100
Ralf Haferkamp <rhafer(a)suse.de> wrote:
I currently try to package a rails app as RPM and ran into some
issues that don't know howto solve.
The current state of that package can be seen here:
The app ships with a Gemfile but does not include the Gemfile.lock
(upstream has some Good Reason(TM) for that). One of my problems is
now that in order to be able to use the app I need to call "bundle
install" at some point either during buildtime or after installing
package. (Ideally with --local so it will not talk to any remote
servers and just use the gem install locally).
I describe how webyast and SLMS ( both are rails servers ) do it.
if you have all packages available as RPMS, you do not need to call
bundle install. But for resolution you need to move away other kinds.
SLMS use groups and do
for i in
$RPM_BUILD_ROOT/usr/share/slms/*/Gemfile; do sed -i
'/^group/,/^end/s/^/#/' $i; done
That comment out all groups, of course you can adapt script to your
needs. I already complain about it, but it looks like bundler upstream
is not interested in such topic.
Webyast have some task, that allows to install specific gemfile for
given environment - see
part in spec
file. Also it is interesting that Gemfile can interpret ruby code, so
you can comment it out quite easy.
Also do not forget to remove Gemfile.lock after update of any gem. We
solve it with removing Gemfile.lock in init script and during everytime
is created new one with fresh versions.
That means however that all gems listed in Gemfile will become
BuildRequires of the rails-app. Even when calling "gem install local
--without developement test" the gems in the development and test
groups need to be present. Apart from the fact that this will add
quite a few useless build dependencies to the package I also ran some
other problems. E.g. the Gemfile contains this:
gem 'rcov', :platforms => :ruby_18, :group =>
[:development, :test] gem 'simplecov', :platforms => :ruby_19, :group
=> :test, :require => false
Even when "bundle install" runs on a :ruby_19 platform it needs the
gems for the :ruby_18 to be present (AFAIK is needs access to some
metadata of all gems mentioned in Gemfile). That means even when
building for Factory I would need to add rubygem-rcov as a
BuildRequires, which doesn't work as rubygem-rcov depends on ruby-1.8
which we don't have on Factory.
Options to solve this I can think of:
1. Patch the gemfile to not require rcov
2. Avoid all dependencies on rubygem-*rpms, by calling "bundle
install/package" on my local machine and vendor all dependencies into
the app's rpm package.
If possible I would like to avoid both of the above options. Does
anybody here have an idea if that is possible?
Sorry, I don't see it. I can point you to some internal discussion
about this topic and also to my patch for bundler, that is still
pending for easier excluding of groups.
What is the general approach to packaging rails apps?
(Avoid it? ;))
Is there a way to avoid bloating the BuildRequires and still create a
working RPM without the need to call bundler in the installed system?
you need to call bundler in installed system ( not directly, but
indirectly via starting rails server ) to properly load gems during
To unsubscribe, e-mail: opensuse-ruby+unsubscribe(a)opensuse.org
To contact the owner, e-mail: opensuse-ruby+owner(a)opensuse.org