Custom actions on syberia project startup

When a syberia project is first loaded, it is "bootstrapped" by performing several startup procedures: registering the config/application file, registering the controllers, registering the routes, and setting up the tests so that test_project works correctly. The user can specify additional actions to perform using custom_bootstrap if and only if a config/boot resource is present (i.e., either config/boot.R file or config/boot/boot.R file).

Note that due to the dynamic and interactive nature of R, bootstrapping can occur non-deterministically. Unlike, for example, a Ruby on Rails application, which has one entrance point, a syberia project will be bootstrapped whenever it is referenced from R code the first time. This includes when any resources are loaded, tests are ran, configuration is accessed, etc. You should think of the bootstrapping process as "lazy loading" all that a syberia project needs to get to work.

Example

Place the following config/boot.R in your syberia project.

cat("Bootstrapped!")

Whenever you perform any action that uses your syberia project for the first time in a fresh console, you should see "Bootstrapped!"



robertzk/syberia documentation built on May 27, 2019, 11:37 a.m.