Module: OpenLaszlo
- Defined in:
- lib/openlaszlo/compiler.rb,
lib/openlaszlo/applet.rb
Overview
module OpenLaszlo
This module contains utility methods for compiling OpenLaszlo programs.
Example:
# Set up the environment to use the compile server. The OpenLaszlo server
# must be running in order at this location in order for this to work.
ENV['OPENLASZLO_HOME'] = '/Applications/OpenLaszlo Server 3.1'
ENV['OPENLASZLO_URL'] = 'http://localhost:8080/lps-3.1'
require 'openlaszlo'
# Create a file 'hello.swf' in the current directory:
OpenLaszlo::compile 'hello.lzx'
See OpenLaszlo.compile for additional documentation.
Defined Under Namespace
Classes: Applet, CommandLineCompiler, CompilationError, CompileServer, InvalidSourceLocation
Class Method Summary collapse
-
.compile(source_file, options = {}) ⇒ Object
Compile an OpenLaszlo source file.
-
.compiler ⇒ Object
Returns the default compiler.
-
.compiler=(compiler) ⇒ Object
Sets the default compiler for future invocations of OpenLaszlo.compile.
Class Method Details
.compile(source_file, options = {}) ⇒ Object
Compile an OpenLaszlo source file.
Examples:
require 'openlaszlo'
OpenLaszlo::compile 'hello.lzx'
OpenLaszlo::compile 'hello.lzx', :debug => true
OpenLaszlo::compile 'hello.lzx', :runtime => 'swf8'
OpenLaszlo::compile 'hello.lzx', :runtime => 'swf8', :debug => true
OpenLaszlo::compile 'hello.lzx', :output => 'hello-world.swf'
Options are:
-
:debug- debug mode (default false) -
:output- specify the name and location for the output file (default =input_file.sub(/\.lzx$/, '.swf')) -
:proxied- is application proxied (default true) -
:runtime- runtime (default swf8)
See CompileServer.compile and CommandLineCompiler.compile for additional options that are specific to the compilation methods in those classes.
271 272 273 274 275 276 277 |
# File 'lib/openlaszlo/compiler.rb', line 271 def self.compile(source_file, ={}) = .clone [:runtime] ||= 'swf8' compiler.compile(source_file, ) rescue InvalidSourceLocation CommandLineCompiler.new.compile(source_file, ) end |
.compiler ⇒ Object
Returns the default compiler. Use the server-based compiler if it’s available, since it’s so much faster.
234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/openlaszlo/compiler.rb', line 234 def self.compiler return @compiler if @compiler return @compiler = CompileServer.new if ENV['OPENLASZLO_URL'] and ENV['OPENLASZLO_HOME'] return @compiler = CommandLineCompiler.new if ENV['OPENLASZLO_HOME'] raise <<EOF Couldn\'t find an OpenLaszlo compiler. To use the compile server (recommended), set ENV['OPENLASZLO_URL'] and ENV['OPENLASZLO_HOME']. To use the command-line compiler, set ENV['OPENLASZLO_HOME']. EOF end |
.compiler=(compiler) ⇒ Object
Sets the default compiler for future invocations of OpenLaszlo.compile.
248 249 250 |
# File 'lib/openlaszlo/compiler.rb', line 248 def self.compiler=(compiler) @compiler = compiler end |