| Module | OpenLaszlo |
| In: |
lib/openlaszlo/applet.rb
lib/openlaszlo/compiler.rb |
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.
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:
See CompileServer.compile and CommandLineCompiler.compile for additional options that are specific to the compilation methods in those classes.
# File lib/openlaszlo/compiler.rb, line 258
258: def self.compile(source_file, options={})
259: options = options.clone
260: options[:runtime] ||= 'swf8'
261: compiler.compile(source_file, options)
262: rescue InvalidSourceLocation
263: CommandLineCompiler.new.compile(source_file, options)
264: end
Returns the default compiler. Use the server-based compiler if it‘s available, since it‘s so much faster.
# File lib/openlaszlo/compiler.rb, line 220
220: def self.compiler
221: return @compiler if @compiler
222: return @compiler = CompileServer.new if ENV['OPENLASZLO_URL'] and ENV['OPENLASZLO_HOME']
223: return @compiler = CommandLineCompiler.new if ENV['OPENLASZLO_HOME']
224: raise "Couldn\\'t find an OpenLaszlo compiler.\n\nTo use the compile server (recommended), set ENV['OPENLASZLO_URL'] and ENV['OPENLASZLO_HOME'].\n\nTo use the command-line compiler, set ENV['OPENLASZLO_HOME'].\n"
225: end
Sets the default compiler for future invocations of OpenLaszlo.compile.
# File lib/openlaszlo/compiler.rb, line 235
235: def self.compiler= compiler
236: @compiler = compiler
237: end