Compilation is handled by the rake build:world PLATFORM=YOUR_PLATFORM FLOK_ENV=ENVIRONMENT and then end result of that compliation is put in ./products/
Compilation always results in a ./products/$PLATFORM/application.js file along with other files in ./products/$PLATFORM/drivers/ that
were deemed necessary by the platform driver build scripts. The environment can either be DEBUG or RELEASE.
Unless otherwise stated, all files execute in alpha-numerical order. (0foo.js would execute before 1foo.js). Please use this convention only
as necessary.
rake buildis run inside./app/drivers/$PLATFORMwith the environmental variables set to BUILD_PATH=./produts/$PLATFORM/driver(and folder- All js files in
./app/kern/config/*.jsare globbed togeather and sent to./products/$PLATFORM/glob/1kern_config.js - All js files in
./app/kern/*.jsare globbed togeather and sent to./products/$PLATFORM/glob/2kern.pre_macro.js - All js files in
./app/kern/pagers/*.jsare globbed togeather and sent to./products/$PLATFORM/glob/3kern.pre_macro.js - All js files in
./products/$PLATFORM/glob/{2,3}kern.pre_macro.jsare run through./lib/flok/macro.rb's macro_processand then sent to./products/$PLATFORM/glob/{2,3}kern.js - All js files are globbed from
./products/$PLATFORM/globand combined into./products/$PLATFORM/glob/application.js.erb - Auto-generated code is placed at the end (like PLATFORM global)
- The module specific code in
./kern/mod/.*jsare added when the name of the file (without the js part) is mentioned in the./app/drivers/$PLATFORM/config.ymlmodssection and appended toglob/application.js.erb - The compiled
glob/application.js.erbfile is run through the ERB compiler and formed intoapplication.js. This adds things like static debug variables, and hooks.
##Erb variables
All kernel source files support embedded ERB code like <% if DEBUG %>Code<% end %>. These files include:
./app/kern/*.js./app/kern/mod/*.js./app/kern/services/*.js- Services only support ERB in the javascript code sections
####Supported variables
@debug- Set totruewhen FLOK_ENV=DEBUG@release- Set totrueFLOK_ENV=RELEASE@mods- The set of modules supported by this platform and build configuration@defines- A hash that contains things under thedefinessection in aconfig.yml. Each item in the hash istrue
//Example JS code for debug / release mode
<% if @debug %>
//JS Code for debug
<% else %>
//JS code for not debug mode
<% end %>
<% if @defines['spec_test'] %>
//spec_helper_defines_spec_test
<% end %>####Spec Helpers
The file contained in the kernel ./app/kern/spec_helper.js is used to test things like variable setting from config.yml