views:

843

answers:

2

First some background. I am trying to run Community Engine on a fresh install of Ubuntu. CE is a open src social networking plugin running on Rails. I was able to get CE up and running on my windows box w/o issue. I have decided to use Ubuntu 8.10 as my development environment now, and am stuck on this issue. I have researched this for the last couple nights and am still stuck.

What happens is, when i get to this step of the instruction (found here):

  Generate the community engine migrations:

  $ script/generate plugin_migration

I get the following error:

myuser@compy:~/Projects/MyProject$ script/generate plugin_migration
/home/myuser/Projects/MyProject/config/../vendor/plugins/engines/boot.rb:4: This version of the engines plugin requires Rails 2.1.1 or later! (RuntimeError)
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/myuser/Projects/MyProject/config/environment.rb:12
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/myuser/Projects/MyProject/vendor/rails/railties/lib/commands/generate.rb:1
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/generate:3

Here's my version of ruby:

myuser@compy:~/Projects/MyProject$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

and my installed gems:

myuser@compy:~/Projects/MyProject$ gem list

*** LOCAL GEMS ***

actionmailer (2.2.0, 2.1.2, 2.1.1)
actionpack (2.2.0, 2.1.2, 2.1.1)
activerecord (2.2.0, 2.1.2, 2.1.1)
activeresource (2.2.0, 2.1.2, 2.1.1)
activesupport (2.2.0, 2.1.2, 2.1.1)
aws-s3 (0.5.1)
builder (2.1.2)
capistrano (2.5.0)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
fastthread (1.0.1)
gem_plugin (0.2.3)
haml (2.0.4)
highline (1.4.0)
hpricot (0.6.164)
htmlentities (4.0.0)
mime-types (1.15)
mongrel (1.1.5)
net-scp (1.0.1)
net-sftp (2.0.1)
net-ssh (2.0.4)
net-ssh-gateway (1.0.0)
rails (2.2.0, 2.1.2, 2.1.1)  <--- clearly I have rails 2.1.1 or greater
rake (0.8.3)
RedCloth (4.1.0)
rmagick (2.7.1)
sqlite3-ruby (1.2.4)
xml-simple (1.0.11)

I got this error when i only had rails 2.1.1 as well.

Yes, I have way more gems than i need for CE, but in trying to track this down, this is what i ended up with. I have a sneaking suspicion that whatever the issue is, it's dumb and i should of caught it. But at this point, I've grown very frustrated with what was a simple process on an XP box.

I have asked this question in the Community Engine google group, however, I have a feeling that this is more related to my setup of Ruby and Rails on my machine than to CE itself.

Help would be appreciated.

+3  A: 

The "problem" is not coming from CommunityEngine itself, but with the underlying 'engines' plugin (http://github.com/lazyatom/engines).

looking at the source code of boot.rb in the engines plugin we can see that it just checks the standard Rails::VERSION fields, so the problem isn't there either.

Now, when you create a rails app, it is tied to the specific version that you used when you first created the rails app. Just having the rails 2.1.1/2 gems sitting on your system doesn't mean that they'll automatically get used.

To check your actual rails app itself, look at the config/environment.rb file in your rails app. You will see something like this:

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION

If it is less than 2.1.1, then you'll need to upgrade your rails app.
This is pretty simply:

  1. Change the RAILS_GEM_VERSION string in config/environment.rb to 2.1.1 or greater
  2. run rake rails:upgrade

Hopefully this solves your problem :-)

Orion Edwards
+2  A: 

This issue ended up being due to not usind sudo to install rails. I ended up blowing away ruby completely and reinstalling it. I also paid closer attention to the output of the various gems i needed to install to make sure they downloaded and ran. I was surprised to see that many of them would fail to download and had to be run a second, or even third time before they would install.

regarding Orion's suggestion, I had checked the RAILS_GEM_VERSION and it was 2.1.1 or greater. That's what was causing the most confusion with this issue since it was saying what version was needed, and then gem -v would show me the right version.

levi rosol
How did you actually solve the problem? by reinstallig ruby?!
zengr
Well, kinda. Since i was on a fresh install, and the ubuntu install is rather painless, i paved my machine and started fresh. Big hammer for a little nail, but it was a lot simpler.
levi rosol
http://stackoverflow.com/questions/2762895/error-while-trying-to-install-community-engine-nameerror-undefined-local-vari/2796956#2796956
zengr