electronic.alchemy :: Getting Started
where the past meets the future
pike > Fins > Getting Started

Getting Started

Created by hww3. Last updated by hww3, 10 years ago. Version #12.


Make sure you have the prerequisites (these are mandatory):

The following components are optional, but you lose functionality if they're not present: Installing

You can either download a ready-to-go bundle, Fins-0.9.5, or get the latest code from HG. Fins-0.9.5 is easy because all of the prerequisites are taken care of, you just need to add Fins/lib to your module path and you're in business. The drawback is that the snapshot doesn't include new functionality. The following instructions describe the CVS approach. For details about Fins-0.9.5, see Windows.

Once you have the prerequisites installed, you can download a snapshot of Fins from the HG repository at http://hg.welliver.org/fins

Unzip this package, and you should have a Fins directory.

That's it! You've got everything in place to start working with Fins.

Do you have any examples? How do I get started?

Glad you asked! There are 2 example apps bundled with Fins: HelloWorld and SmugMug. You can install HelloWorld without any additional modules, though SmugMug requires Public.Image.SmugMug and a support module (Public.Parser.XML2). Additionally, you can check out the Internals page for information about what you need to have in order to create your own Fins app from scratch. Don't worry, it's not that hard, there are only 3 files in a minimum application!

There are a few sample apps, which you can find at [external]http://hww3.riverweb.com/dist/Fins/samples . You'll need the Fins framework in your Pike module path. Simply unpackage and then run a command like:

pike -Mlib -x fins start HelloWorld

From there, you can make a copy of the application directory and customize it till your heart's content! It's still helpful to read the Internals page so that you understand how things work internally.

Creating your own Application

Fins comes with a set of administrative tools that can be used to perform some of the more important tasks when working with Fins applications. Make sure that your PIKE_MODULE_PATH environment variable contains the lib directory from the Fins software.

pike -x fins command [args]

The most important commands are create, __model__ and start. They are used to create a new application, work with the database model and run the application, respectively. For example, we can create a new application:

bash-2.05$ pike -x fins create myapp
17:06:27 INFO - CreateApplication module loading
17:06:27 INFO - CreateApplication module running.
17:06:27 INFO - Creating application myapp in /opt/work.
17:06:27 INFO - Be sure to edit config/*.cfg to specify the application's datasource
bash-2.05$ ls myapp
bin        classes    config     logs       modules    static     templates

You will notice that there is a bin directory, and this contains a simple script that can be used to run the application, which is particularly useful for development purposes. This script is called start.sh on unix boxes and takes a number of optional arguments such as port or hilfe. You can relocate this directory later if you need to, assuming your application only uses relative paths in its code for files on the filesystem, as long as the Fins module directory (lib) is in your Pike's module path.

The first thing we should do is edit the configuration file. By default, the configuration file includes a section for the database model, which we've not defined yet. For this reason, we need to comment it out. If we don't the application will fail to load. Simply edit myapp/config/dev.cfg and comment out the entire [model] section by putting a pound sign (#) at the beginning of each line. Once that's done, save the file.

Now, we can start up the application. To do this, we'll use the start tool:

bash-2.05$ pike -Mlib -x fins start myapp
23:45:04 INFO - FinServe starting on port 8080
23:45:04 INFO - Starting Session Manager.
23:45:04 INFO - FinServe loading application myapp using configuration dev
23:45:04 INFO - Loading log configuration from /Users/test/Fins/myapp/config/log_dev.cfg, if present.
23:45:04 DEBUG - config file: /Users/test/Fins/myapp/config/dev.cfg
23:45:04 INFO - Preparing to load application myapp.
23:45:04 INFO - Starting Cache.
23:45:04 DEBUG - No model defined!
23:45:04 DEBUG - /Users/test/Fins/myapp/classes/application()->load_controller()
23:45:04 INFO - Application myapp loaded.
23:45:04 INFO - FinServe listening on port 8080
23:45:04 INFO - Application ready for business.

If you've followed these instructions correctly, you should be able to point your web browser at port 8080 and get the Fins welcome page.

Where to go from here

Not categorized | RSS Feed | BackLinks

comments powered by Disqus