Trellis

Trellis is a component-based Web Application Framework written in Ruby. Its main goal is to bring component-driven development to the micro-framework world. The framework aims to be a zero-configuration framework.

Inspiration

Trellis original inspiration came primarily from working with Tapestry; a highly-productive (in spite of being Java-based) framework. Like Tapestry, Trellis is based on the concept of components and events.

I’ve also drawn inspiration from many other places, including:

Ruby Web Frameworks

  • Rails
  • Camping
  • Sinatra
  • Wee
  • Iowa

Other Java Web Frameworks

  • Wicket
  • The good parts of JSF (components)

Others

  • Seaside

Goals

  • Pure HTML templates or in-line template creation with Markaby or HAML
  • To abstract away the request-response nature of web development and replace it with events and listeners
  • Reusable, extensible components including invisible components (behavior providers), tags (stateless components) or stateful components
  • Easy component composition and markup inheritance
  • Multi-threading support
  • Heavy CoC (Convention Over Configuration) ala Rails
  • No static code generation, no generators, just a Ruby file!
  • Component Libraries as Gems
  • Ajax support at the component-level
  • Skinnable components a la DotNet. That is the ability to apply a theme to a page and cascade that to the contained components
  • Support for continuations in a componentized fashion
  • CRUD behaviours for Pages/Components
  • Web-based debugging and administration of the application similar to what Seaside provides

Classes

  • Trellis::Application:: Base case for all Trellis applications
  • Trellis::Page:: Base class for all application Pages
  • Trellis::Renderer:: Renders XML/XHTML tags in the markup using Radius
  • Trellis::Component:: Base class for all Trellis components (work in progress)
  • Trellis::DefaultRouter:: Encapsulates the default routing logic

Installation

  • gem install trellis

A Trellis application consists of the Application class; a descendant of Trellis::Application and one or more pages; descendants of Trellis::Page. The Application at a minimum needs to declare the starting or home page:

  module Hello
    class HelloWorld < Trellis::Application
      home :home
    end

    class Home < Trellis::Page 
      template do html { body { h1 "Hello World!" }} end
    end
  end

To run the above application simply add the line:

  Hello::HelloWorld.new.start

That will start the application on Mongrel running on port 3000 by default. To run on any other port pass the port number to the start method like:

  Hello::HelloWorld.new.start 8282

Required Gems

  • rack => http://rack.rubyforge.org
  • mongrel => http://mongrel.rubyforge.org
  • radius => http://radius.rubyforge.org
  • builder => http://builder.rubyforge.org
  • paginator => http://paginator.rubyforge.org
  • hpricot => http://code.whytheluckystiff.net/hpricot
  • extensions => http://extensions.rubyforge.org
  • haml => http://haml.hamptoncatlin.com
  • markaby => http://code.whytheluckystiff.net/markaby

LICENSE:

(The MIT License)

Copyright ©2001-2008 Integrallis Software, LLC.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contact

  • Author:: Brian Sam-Bodden
  • Email:: bsbodden@integrallis.com
  • Home Page:: http://trellisframework.org
  • License:: MIT Licence (http://www.opensource.org/licenses/mit-license.html)