lost password?

home
•  reviewramp
•  rails +
•  javascript
•  webdev
•  django
•  xaraya
•  xamp
•  musings

rss
Tag this page
   

» Blogs that link here
last modified: Jan 12, 2010
(first posted: Jan 12, 2010)
(329 Reads)
Permalink

Upgrading app from Rails 2.3.2 to 2.3.5

I ran into a few snags upgrading ReviewRamp from Rails 2.3.2 to 2.3.5

First Fail

Actually, we went to do this back on Dec 6 and ran into errors installing the Rails GEMs. I kept getting messages like 

...
Installing gem activerecord-2.3.5
Downloading gem activerecord-2.3.5.gem
GET 302 Found: http://gems.rubyforge.org/gems/activerecord-2.3.5.gem
Exception `EOFError' at /opt/local/lib/ruby/1.8/net/protocol.rb:135 - end of file reached
GET 200 OK: http://s3.amazonaws.com/gemcutter_production/gems/activerecord-2.3.5.gem
Exception `Gem::Package::FormatError' at /opt/local/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:110 - No metadata found!
Exception `Gem::InstallError' at /opt/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:121 - invalid gem format for /opt/local/lib/ruby/gems/1.8/cache/activerecord-2.3.5.gem
ERROR:  Error installing rails:
    invalid gem format for /opt/local/lib/ruby/gems/1.8/cache/activerecord-2.3.5.gem
Nothing to update

 

Googling revealed other people were running into similar issues. I tried a bunch of things, including removing the cache directory /opt/local/lib/ruby/gems/1.8/cache/activerecord-2.3.5.gem to no avail. After wasting an evening on this, I gave up and moved on to other work.

Update Gems

Last night I decided to revisit, and try again, and the activerecord (and other Rails gems) updates went perfectly fine! Yaaah, no problems.

$ sudo gem update rails

Then edit the config/environment.rb (changing 2.3.2 to 2.3.5)

RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

 Next I tried rake gems and got an error with the rack gem, saying

 RubyGem version error: rack(1.0.0 not ~> 1.0.1) 

so I tried

 $ sudo gem update rack

 That actually installed version 1.1.0, and rails still wouldn't run. After some googling and fiddling around I realized it really does require 1.0.1, so did this:

 sudo gem install rack -v=1.0.1

 Hmm, so while I was at it I decided to upgrade everything.

Ooops, some of the gems required XCode. I replaced my Mac's hard drive a number of months ago and hadnt installed the XCode stuff, so fishing out the Leopard CD's, poped in the install disk, and found the Xcode folder and installed it.

Then,

 sudo gem update

It had been a while since I upgraded Cucumber and Rspec, so these needed some additional love. First, the new cucumber-rails and database_cleaner gems,

sudo gem install cucumber-rails
sudo gem install database_cleaner 

Then, I made copies of config/environments/cucumber.rb and features/support/env.rb and ran

script/generate cucumber 

And then merged my custom changes the those files back into the generated ones.

Similarly for rspec, I made copy of spec/spec_helper.rb, ran

script/generate rspec

and merged back my changes.

Run Tests

Next I run through my test suites.

rake spec

Woot! ran fine. With a few exceptions. Mostly legitimate things that hadn't errored out before, some in my code, others in the test code itself. Fixed'em.

 

cucumber

Oops. More problems. Mostly related to a patch I'd made to webrat early last year so "within" can support xpath not just css selectors. I thought that had been fixed and would be in my upgrade, but no. And the patch to the current webrat is different from what we figured out last March. See https://webrat.lighthouseapp.com/projects/10503/tickets/153-within-should-support-xpath Thanks tomtt :)

The easiest way it to add the following code to into features/support

module Webrat
  class Scope
    protected
    def xpath_scoped_dom
      @scope.dom.xpath(@selector).first
    end
    def scoped_dom
      begin
        @scope.dom.css(@selector).first
      rescue Nokogiri::CSS::SyntaxError, Nokogiri::XML::XPath::SyntaxError => e
        begin
          # That was not a css selector, mayby it's an xpath selector?
          xpath_scoped_dom
        rescue
          # Raise original css syntax error if selector is not xpath either
          raise
        end
      end
    end

  end
end

 A couple of other tweeks were needed (like click_button doesnt find hidden buttons now; my app used onclick javascript to submit and had a hidden button for webrat to find ?!, I fixed it to correctly be unobtrusive-- starts out visible then js hides it when enabled.).

OK, all good. On the development version, that is.

Now I just need to find a "convenient" midnight hour to upgrade the production server too.

 

 

There are no comments attached to this item.

Post a new comment

How many days in a week?

Name :