rstudio/rstudio — pull request #262 by kevinushey (2014-12-22 20:04:49+00:00)
Title: fix packrat initialization order

This one is subtle -- the 'deferred initialization' in SessionPackrat.cpp needs to occur _after_ Packrat's init script has run, as this does some work of e.g. setting environment variables and so on. If that isn't set, then the deferred init believes that Packrat mode is not on, and doesn't hook up any of the file monitors and so on.

In other words, previously, we would:

1. Call `SessionPackrat`'s `onDeferredInit`. Because `packrat/init.R` had not yet been run, the initialization believed Packrat was not available.
2. Call `packrat/init.R` -- the rest of the RStudio wiring turns on.

This PR ensures that package hooks are run before things registered on `afterDeferredInit` -- and I am somewhat confused as to why it ever worked before!