Nitro 0.5.0

Nitro is an efficient, yet simple engine for developing professional Web Applications using the Ruby language. Nitro aims to provide a robust infrastructure for scalable web applications that can be distributed over a server cluster. However, Nitro can also power simple web applications for deployment on intranets or even personal computers. Nitro integrates the powerful Og Object-Relational mapping library.

Features

A short summary of the major features:

  • XML server pages (.xhtml)

Nitro uses standard, dully xml compliant xhtml pages with logic code, thus combining the power of embededed Ruby (like erb, eruby) with the xml compliance of Amrita. Even though it is a ‘Callback’ style templating system it is flexible enough to run as ‘Pipeline’ style system if the developer prefers this mode of operation. <?xml version=“1.0”?> <!– example page –> <html> <?r title = ‘Example’ version = params ?> <h1>#title</h1> <?r if version > 1 ?> Version: #version <?r end ?> </html>

  • Shaders, XSLT templates

Nitro promotes the usage of XSLT for web templates. The functional nature of XSL is ideal for the Web. Moreover, the engine efficiently precompiles the xsl transformation along with other transformations (for example localization) essentially providing a computationally free transformation step. A shader integrates many XSLT templates and or CSS stylesheets to encapsulate all styling/skinning requirements of a Web Application. Nitro features a fully programmable shader pipeline.

  • Multi phase evaluation

Experimental, facilitates efficient HTTP1.1 caching.

  • Fragment Synthesis

Nitro server pages can include fragments at ‘Compile’ time or at ‘RunTime’ time. <!– compile time include (static include) –> <?include xl:href=“myfile.si” /> <!– run time include (dynamic include) –> <include href=“myfile.si” />

  • Minimum configuration

Configuration files are kept to the absolute minimum. The target is to have no configuration files at all.

  • Object-Relational Mapping

Nitro integrates the Og (ObjectGraph) object-relational mapping library. Og provides transparent serialization of object graphs to a RDBMS backend. Unlike other similar libraries Og maps standard Ruby objects to SQL tables and not vice versa. Og provides a meta language to describe the relations between objects, a flexible and intuitive api for querieng the database, raw access to the SQL language if needed (for example to fine tune the automatically generated SQL tables, or for custom queries), suports deserialization to Ruby objects or tuples and provides a collection of usefull Mixins to synthesize common Entities. Og is a combination of the best features of Active Record and the former O-R mapping library included in Nitro (NDB). Adapters for PostgreSQL and MySQL are included.

  • Distributed State

Nitro provides a powerfull distributed state mechanism that utilizes the DRb library. A typicall use of this infrastructure is to provide distributed sessions when running your application over a server cluster. Distributed sessions are fully transparent to the developer.

  • Request Filters

The develpoper has full access to the request handling pipeline. Request filters are a powerfull mechanism for customized processing of special requests. Example filters are the autologin filter, a gzip filter etc.

  • Hierarchical Caching

Nitro provides a well designed and efficient caching mechanism. Caching will be provided at the following levels: * DB Cache * Object Cache (deserialized objects) * Fragment Caching (cache generated sub-parts of a page, or a page) * HTTP 1.1 Caching (downstream caching of whole pages)

The engine calculates intra-page dependencies automatically. A variety of invalidation strategies can be implemented.

  • Support for ‘nice’ urls.

Experimental.

  • Simple events manager.

Experimental.

  • Advanced debuging features

* When running in debug mode, all exceptions raise are logged to a special debug panel in the current page. Find out the offending file and line from the exception dump, fix the bug, refresh the page. * in-process console: inject an irb session to a running application server. You can use the irb console to investigate all variables and code in your running server process.

  • Parts

Parts are organized modules of web services. A Web Framework that integrates a large collection of parts (User management, Blog, Fora, CMS, Personalization, ..) will be released by Navel. Other libraries of parts are expected from the Ruby community when the Part API is finalized.

  • UI Components

Nitro is distributed with a collection of usefull UI components to make form based application development easier (for example an efficient, ndb-aware Pager component).

  • Path overloading

Experimental

  • Localization

Nitro supports efficient localization of web applications.

Download

The latest version of Nitro can be found at

Documentation for Nitro can be found at

Requirements

Nitro requires the following applications or libraries:

Version 1.8.2.preview2 is recomended

Will be optional in a future version.

The following applications or libraries are optional:

Used for Database driven web applications.

Used for Database driven web applications.

Ruby interface to the PostgreSQL RDBMS.

Ruby interface to the MySQL RDBMS.

Used for XSLT based templates.

Please install the required applications and libraries before continuing with the installation of Nitro.

Instalation

Nitro is distributed as a RubyGem. First of all make sure you have installed RubyGems on your system. Then run the following command:

gem install nitro

Then try to run the examples/tiny Example application.

A tar.gz distribution is also available on www.navel.gr/nitro

Running the example applications

  • examples/tiny

A simple application that requires no external applications

$ cd nitro/examples/tiny

$ vi conf/apache.conf

edit user, group,DocumentRoot root as needed.

$ ./ctl start

this script starts the distributed session cluster, apache and the application server.

browse 127.0.0.1:8080

to stop the application execute:

$ ./ctl stop

  • examples/simple

A simple application to demonstrate xsl skins, entities, postback.

$ cd nitro/examples/simple

$ vi conf/apache.conf

edit user, group,DocumentRoot root as needed.

$ vi conf/config.rb

edit the postgresql user and password

if you wan to run this application with MySQL edit the configuration file to include

{ … :backend => “mysql” … }

instead.

run the following script to initialize the postgresql database used by the example

$ ruby install.rb

$ ./ctl start

this script starts the distributed session cluster, apache and the application server.

browse 127.0.0.1:8080

to attach an irb console to the running server, execute from another shell:

$ cd /examples/simple

$ irb -r env.rb

to stop the application execute:

$ ./ctl stop

Debuging Nitro applications

Have “tail -f” commands running on logs/app.log in your application directory. Nitro will automatically display debugging and runtime information to these files. Debugging info will also be shown in the browser when running in debug mode.

Support

For any questions regarding Nitro, feel free to ask on the ruby-talk mailing list (which is mirrored to comp.lang.ruby) or contact [email protected].

Licence

Copyright © 2004 Navel Ltd (www.navel.gr)

Nitro (www.navel.gr/nitro) is copyrighted free software created and maintained by George Moschovitis ([email protected]) and released under the standard BSD Licence. For details consult the file LICENCE.