Upgrade rails now

| | Comments (3)

You need to upgrade rails now. Right now.

If you prefer to freeze your rails checkout. I recommend stealing this rule:

namespace :rails do
  namespace :freeze do
    desc "Lock to a specific rails version. Defaults to 1.1.5 or specify with RELEASE=x.y.z"
    task :version do
      rel = ENV['RELEASE'] || '1.1.5'
      tag = 'rel_' + rel.split(/[.-]/).join('-')
      rails_svn = "http://dev.rubyonrails.org/svn/rails/tags/#{tag}"

      puts "Freezing to #{tag} using #{rails_svn}"
      sh "type svn"
      
      dir = 'vendor/rails'
      rm_rf dir
      mkdir_p dir
      for framework in %w( railties actionpack activerecord actionmailer activesupport actionwebservice )
        checkout = "#{dir}/#{framework}"
        sh "svn export #{rails_svn}/#{framework} #{checkout}"
        unless test ?d, checkout then
          puts "ERROR: checkout missing: #{checkout}"
          exit 1
        end
      end
    end
  end
end

and running:

rake rails:freeze:version

It'll default to 1.1.5 or you can specify the tagged version you want using RELEASE=x.y.z.

3 Comments

Ummm... I believe that's exactly what this does: rake rails:freeze:edge TAG=rel_1-1-5. Am I missing something?

Nathaniel,

No, you're not missing anything... I personally don't want to have to remember the tag prefix or format. I don't want to look anything up, especially on days like today where I'm trying to flip as much as I can as fast as I can. I simply want to run as simple a rake command as I can and have the computer get it right. If the version needs to be something non-default, I just want to refer to it by version. 1.1.5 makes a lot more sense to me than rel_1-1-5.

I should also add, I screw up a lot more than my computer does. If I get the variable wrong on your command, would I even notice? Probably not. And then I'd be on edge, which is the worst thing I can think of for a deployment system.

Leave a comment