README

Path: README
Last Update: Tue Apr 01 15:09:53 -0400 2008

ROpenLaszlo: Interface to the OpenLaszlo compiler

ROpenLaszo is a Ruby interface to the OpenLaszlo compiler. It allows you to compile OpenLaszlo programs from within Ruby, in order to integrate OpenLaszlo development into Rake or Rails applications.

If you are using OpenLaszlo with Ruby on Rails, you probably want the OpenLaszlo Rails plugin as well.

OpenLaszlo programs are written in XML with embedded JavaScript, and compiled into Flash (swf) binary files, or DHTML. (As of this writing, the DHTML target is in pre-beta form.) The APIs in this library make it easy for Ruby code to invoke the OpenLaszlo compiler. For example, if hello.lzx contains the following text:

  <canvas>
    <window>
      <button>Hello, World!</button>
    </window>
  </canvas>

then the following Ruby code can be used to create a file ‘hello.swf’ which can be executed in a browser or placed on a web site:

  require 'rubygems'
  require 'openlaszlo'
  OpenLaszlo::compile 'hello.lzx' # creates hello.swf

You can turn this into a Rake task that will compile any OpenLaszlo source file:

  rule '.swf' => '.lzx' do |t|
    puts "Compiling #{t.source} => #{t.name}" if verbose
    OpenLaszlo::compile t.source, :output => t.name
  end

The following includes such a task:

  require 'openlaszlo'
  load 'tasks/openlaszlo.rake'
  # defines a pattern *.lzx -> *.swf

Requirements

Installation

0:Download and install the OpenLaszlo SDK

1: Install this gem

  > gem install ropenlaszlo
2:Set your OPENLASZLO_HOME environment variable to the directory that contains the OpenLaszlo SDK. If the following prints something, you‘ve got it right:
  > grep Laszlo "$OPENLASZLO_HOME/README.txt"
3:(Optional) Set your OPENLASZLO_URL environment variable to the web location of the OpenLaszlo server; for example, http://localhost:8080/lps-3.1. If you omit this step, the module will use the command line compiler, which is slower but is not limited to compiling files inside of OPENLASZLO_HOME.

Note: The command-line compiler is broken in the Windows version of OpenLaszlo 3.1.1. If you are running Windows, step (3) is required. (OpenLaszlo bug 1428)

Additional Resources

  • The OpenLaszlo web site is a rich source of information about the OpenLaszlo platform. It includes links to the wiki, mailing lists, and forums.
  • The Laszlo on Rails news group discusses the integration of OpenLaszlo with Ruby on Rails.
  • The OpenLaszlo Rails plugin provides generators and scaffolding for using OpenLaszlo with Ruby on Rails.
  • This OpenLaszlo Blog entry has additional information and some examples of using ROpenLaszlo in a Rakefile.
  • The RubyForge project page is here.

Author

Oliver Steele steele@osteele.com

License

ROpenLaszlo is copyright (c) 2006 Oliver Steele. It is open-source software, and may be redistributed under the terms of the MIT license. The text of this licence is included in the ROpenLaszlo distribution, under the doc subdirectory.

[Validate]