0

I am working on upgrading an old Rails app running Rails 2.3.2 on Ubuntu to the latest Rails 2.3.15. The app originally had a vendored version of rails in vendor/rails but I have removed that, installed the rails 2.3.15 gem, and changed the version number in config/environment.rb to:

RAILS_GEM_VERSION = '2.3.15' unless defined? RAILS_GEM_VERSION

Upon restarting the app, I get this error message in the mongrel log (which prevents the app from starting):

/usr/local/lib/site_ruby/1.8/rubygems/version.rb:53:in `initialize': Malformed version number string  (ArgumentError)
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:105:in `new'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:105:in `version_for_dir'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:47:in `refresh!'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:45:in `each'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:45:in `refresh!'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:29:in `initialize'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/gem_dependency.rb:21:in `new'
    from /usr/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
     ... 17 levels...
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
    from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
    from /usr/bin/mongrel_rails:19:in `load'
    from /usr/bin/mongrel_rails:19

What do I need to do to get past this error?

Charles
  • 50,943
  • 13
  • 104
  • 142
Andrew
  • 227,796
  • 193
  • 515
  • 708
  • 2
    Could you perhaps print the `RAILS_GEM_VERSION` so that we can see which version number is being used? – Phrogz Jan 15 '13 at 20:27
  • When/where do you want me to do that? – Andrew Jan 15 '13 at 21:03
  • Because of the source of the error (`rubygems/version.rb` - that is, the `version` module of `rubygems`), I'm guessing `rubygems` is saying either that its own version number is malformed, or that a gem it's trying to load has a malformed version number. Hmm. – Matchu Jan 15 '13 at 21:23
  • Also note the two spaces at the end of the error message. Most versions of this error on Google seem to be of the form `Malformed version number string SOMETHING`. Sounds like it's trying to report that it's seeing a blank version number string where it's expecting it to be, well, non-blank. – Matchu Jan 15 '13 at 21:24
  • Could it be that, since you've removed the vendored copy of Rails, it's still trying to read the vendored copy but not finding it? And therefore reporting a blank version number? Just a guess :/ – Matchu Jan 15 '13 at 21:26
  • I don't think so because I also ran `rake rails:unfreeze` which didn't do anything except remove the `vendor/rails` directory – Andrew Jan 15 '13 at 21:27
  • `add_frozen_gem_path` is in the error message. Does it have something to do with frozen gems in `config/environment.rb`? Check out the `config.gem` lines? – Casper Jan 15 '13 at 21:41

1 Answers1

1

I found the answer to my question...

Rails was expecting that only directories would be in vendor/gems, but there was an init.rb file in there which was trying to add the gems to the load path (which is already handled by Rails).

Andrew
  • 227,796
  • 193
  • 515
  • 708