There’s some interesting piece of software that I want to experiment with. It includes an example Rails application. Nice:
# apt-get install rails $ cd interesting-example-rails-app $ ./script/server Missing the Rails 2.0.2 gem. Please `gem install -v=2.0.2 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
Uhm, well, why?
$ dpkg -s rails | grep Version Version: 2.0.2-1ubuntu1
Executing the app with the debugger:
$ ruby -rdebug script/server
actually tells me what’s wrong.
config/boot.rb checks whether it should run the Rails version that shipped with the Rails app, that is, by convention, put under
By default, Debian’s own
rails command (wrapper) will symlink everything needed, including
vendor/rails to it’s own, packaged Ruby libraries/applications:
ls -l vendor/ insgesamt 0 lrwxrwxrwx 1 joe joe 29 2008-09-16 20:50 actionmailer -> /usr/share/rails/actionmailer lrwxrwxrwx 1 joe joe 27 2008-09-16 20:50 actionpack -> /usr/share/rails/actionpack lrwxrwxrwx 1 joe joe 28 2008-09-16 20:50 active_ldap -> /usr/share/rails/active_ldap lrwxrwxrwx 1 joe joe 28 2008-09-16 20:50 activemodel -> /usr/share/rails/activemodel lrwxrwxrwx 1 joe joe 29 2008-09-16 20:50 activerecord -> /usr/share/rails/activerecord lrwxrwxrwx 1 joe joe 31 2008-09-16 20:50 activeresource -> /usr/share/rails/activeresource lrwxrwxrwx 1 joe joe 30 2008-09-16 20:50 activesupport -> /usr/share/rails/activesupport lrwxrwxrwx 1 joe joe 16 2008-09-16 20:50 rails -> /usr/share/rails lrwxrwxrwx 1 joe joe 25 2008-09-16 20:50 railties -> /usr/share/rails/railties
and thus, a Debian
rails generated application will allways use Debian’s own versions of Rails and the Active* libraries.
Thus, following Debian’s lead we can “debianize” any downloaded Rails app, by inserting the same set of links into
vendor/. Mission accomplished. You can use this script to do this automatically for you.
That however won’t answer the question, why the downloaded Rails app won’t find Debian’s own Rails installation. I’m guessing, the problem is, that
gem, here Debian’s gem, doesn’t know anything about Debian’s own Ruby libraries… feels a bit like two parties not wanting to speak to each other. Somewhat surprising, since software is suposed to be .. soft … and flexible…
Debian’s stance on the problem Inclusion of this explanation into Debian
(all of this of course also applies to Ubuntu and all the other derivatives AFAIK)