Creating a jifty application
In a shell, you can invoke the following commands (assuming you live on a unix system):
/usr/bin/jifty app --name Name_of_your_app
This command creates a folder skeleton that later holds all files necessary to drive the application. As the name of your app is used as a class name, the app name should start with a CAPITAL letter to conform to usual coding styles.
From now on, you may use the jifty executable inside the bin/ directory of your project tree.
What the directory tree looks alike
A typical application directory consists of the following directories and files:
MyApp/ Your application's directory
|
+--- bin/
| |
| +--- jifty dispatcher utility
|
+--- doc/ place your documentation inside
|
+--- etc/
| |
| +--- config.yml configuration file
|
+--- lib/
| |
| +--- MyApp/ Your classes
| |
| +--- Action/ Action classes inside
| |
| +--- Model/ Model classes inside
|
+--- log/ log files
|
+--- share/
| |
| +--- po/ localisation stuff
| |
| +--- web/
| |
| +--- static/ static web pages
| |
| +--- templates/ dynamic web pages and templates
|
+--- t/ test code should go here
|
+--- var/
|
+--- mason/ Mason specific data
Quasi parallel to this directory, there will exist a directory tree holding things under share in the structure above. In this location whose point in the file system is defined at Jifty install-time, all templates, mason components, css and Javascript default files reside. You can think of this directory tree existing as a shadow of your freshly created share directory as a secondary search-path location. In case you override any file on your application's share directory, the default files with the same relative path will get considered no more.
Modifying your application's behaviour
Inside Jifty's machinery, a magical class Jifty::ClassLoader creates an empty class with your application's name. This class does not have any methods. You may create a perl module with your application's name (in the libdirectory of your application directory-tree) in order to modify some things generally. You could implement the following method:
startThis method is called as the last step during the instantiation of theJiftyclass which happens at your server's startup. Every setup (database, configuration, etc) is already made at this moment.