2009/3/7 Phlip <[email protected]> > > >>>>> I did it to several programs like this: > >>>>> - edit environment.rb and upgrade the version > >>>>> - rake rails:update > >>>>> - run all the tests > >>>>> - fix one warning or error > >>>>> - revert everything in config (leave the new JS) > > >>>> I don't understand what is meant here. Do you mean go back to previous > >>>> version of Rails? > > Yes: > > I always always use "revert" to mean "bump files back to where Subversion > (or > Git or Zip or whatever) saw them last." > > Sorry I forgot that some folks have not yet learned that reverting, early > and > often, is a Best Practice in software development! > > The point is that code on your bench is invisible to your version > controller > until you "gate" it in, and the only reasonable gate is passing unit tests. > So > to keep mistakes and experiments invisible, you revert them. Then the > version > controller thinks you are awesome, because it only sees good code, and it > never > learns the awful truth about you! (Or about the Rails maintainers ;) > > From the top: > > I have upgraded several Rails 1.2.x programs to 2.x, following this working > cycle: > > edit environment.rb and tweak the RAILS_GEM_VERSION to '2.2.2' > > rake rails:update > > (commit your new *js files, ALONE, into your version controller) > > run all the unit tests > > (if you don't have unit tests, don't start the upgrade until > you spend a very long time adding them - one for each branch > in all of your logic. "functional" and "integration" tests > are also "unit" tests here - the name is just a hint they should > be higher level...) > > if any test fails, or if the code emits a warning... > > fix the problem > > revert your config & scripts folders, so your version is now 1.2.x > again > (svn revert -R config scripts) > > pass all your tests (and observe your problem remains fixed!)
Do you mean you require that the code runs on the old and new versions of rails? Is this always possible? In a recent upgrade I had to change the base class for my unit tests from Test::Unit::TestCase to ActionController::TestCase which I imagine would not have worked had I reverted. Are there not other cases of code that cannot be made to work in old and new version of rails? Why does it matter whether the code runs in the old version of rails anyway? Colin > > integrate to your version controller > > now repeat those steps. Bump the version up again, run the tests, find > one problem, fix it, revert the version, pass all the tests, and > integrate. > > >>> @Colin Law - Philip is saying that you do the upgrade and part of the > >>> upgrade process is to > >>> change RAILS_GEM_VERSION in your environment.rb to the > >>> version that you're > >>> upgrading to (i.e. 2.2.2). Also, you'll have to run > >>> the 'rake rails:update' to update both > >>> configs, scripts and public/javascripts for your Rails application. > > Yet I _suspect_ that newer prototype.js versions are generally compatible > with > older rails versions, so I let them slide. rake rails:update will attempt > to > update them, but reverting them every danged time you fix a bug in a Ruby > file > is a PITA. > > >>> Now, you'll be at the > >>> point where you'll simply execute 'rake test' which > >>> runs all unit, functional and integration > >>> tests. > > Note that, during my cycle, you could deploy your app to live users. (If > the new > JS works - if not; revert it to the older version!) > > >>>>> - pass all the tests > >>>>> - integrate > > >>>> I don't understand 'integrate' in this context either I am afraid. > > Update your code from the version controller, to get all your colleague's > patches. Then pass all the tests, commit the code to the version > controller, and > "outegrate" the code into your colleague's workstations. Continuous > integration > as also an industry Best Practice (which Rails supports admirably), so we > use > one word for it around here. > > >>>>> -- > >>>>> Phlip > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

