App Creation

Once Sailor is installed, there are various ways to generate your app.

Sailor with luarocks in Unix system

An installation via luarocks will install a binary called sailor. You can use it to generate your apps by typing:

sailor create <app name> [<dir>]

The directory is optional, if not set, it will create your app in the same directory you are. Example:

sailor create 'Hey arnold' /var/www

This will create the directory /var/www/hey_arnold with the base of your app. I'll tell more about this later.

Sailor by direct download / git clone in Unix system

Sailor comes bundled with lua a file called sailor_create. To create your app, on terminal, you cd to where Sailor is and execute sailor_create using the app name and the installation dir as parameters. Example:

./sailor create 'Hey arnold' /var/www

This will create the directory /var/www/hey_arnold with the base of your app. I'll tell more about this later.

Other

Under src/sailor you will find a dir called blank-app. You can just copy paste this folder, rename it and use it as a blank base app.

App structure

Sailor values convention over configuration to make our tasks easier. That's why our base app has a default structure.

/conf - Contains configuration files, open and edit them to suit your needs.

/controllers - Contais a default controller and will contain other controllers you will make!

/themes - Contains themes. Themes are folders that contain regular HTML + CSS + Javascript. Except that pages are named .lp instead of .html and you will place one {{content}} where you want your app views to be rendered.

/models - Will contain models you will make!

/pub - Contains public files (js libraries, for example)

/runtime - Contains temporary files generated by sailor during runtime. You don't need to touch this.

/tests - Contains unit and functional tests for your app.

/views - This is where your view, Lua pages in .lp, will go.

index.lua - This is the file that will run your app. You don't need to touch this either (unless you want to).

index-magnet.lua - This is the file that will run your app in case you are using Lighttpd mod_magnet.

start-server.lua - This file will be used for those who want to run Sailor using Xavante server. If that's the case you only need to install Xavante using luarocks and execute this file to put your app up.

.htaccess - This files sets some stuff for those who use Apache2 as a webserver.