Extending Script Files
Besides the Configuration files Skipper also uses Javascript to define ORM-specific tasks. By using these scripts it is possible to configure or extend the set of actions Skipper is able to perform over the schema definition files.
Customizable functions
Scripting is supported for the following set of functions:
import-function
- called during import of the schema files.export-function
- called during export of the schema files.file-scanner-function
- function called to find files to import.get-module-info-function
- used to gather information about module.
Scripts are defined in .osc
files which are common text files. Scripts are bound to ORM/MVC framework in .cfg.xml
configuration files in <script-settings>
element. Each ORM/MVC framework has its own script files and methods.
<orm-configuration name="Doctrine2">
<script-settings>
<script-file name="Doctrine2.scripts.osc"/>
<function type="import-function" name="Doctrine2Import"/>
<function type="export-function" name="Doctrine2Export"/>
<function type="file-scanner-function" name="Doctrine2DirectoryScanner"/>
<function type="get-module-info-function" name="Doctrine2GetModuleInfoFromFile"/>
</script-settings>
</orm-configuration>
This XML snippet comes from Doctrine2 configuration file Doctrine2.skipper.cfg.xml
. The snippet includes one Doctrine2.scripts.osc
file and binds four methods to import/export Skipper functions.
Script-file structure
One or more script functions can be defined in .osc
script file. Scripts are stored in a standard text file format. Files have to be valid according to the ECMAScript/Javascript format. This is how the Doctrine2 import function looks:
function Doctrine2Import(objProject, arrayInputFiles)
{
//status
MessageCenter.ProgressSetMessage( "operation", "Importing Doctrine2 files...");
...
}
Supported commands
As mentioned earlier Skipper uses Javascript to define these additional functions. The foundation for this is the Qt ECMA script compatible across all of the supported platforms (Windows, Linux and OSX).
Apart from basic functions offered by Javascript, the scripting language is extended by a set of objects enhancing the work with ORM models and files. Complete list of the functions, their description and parameters is located in the reference manual.