Class: OpenLaszlo::CompileServer
- Inherits:
-
Object
- Object
- OpenLaszlo::CompileServer
- Defined in:
- lib/openlaszlo/compiler.rb
Overview
This class implements a bridge to the compile server.
If you don’t need multiple compilers, you can use the methods in the OpenLaszlo module instead.
CompileServer is faster than CommandLineCompiler, but can only compile files in the same directory as the OpenLaszlo SDK.
Instance Method Summary collapse
-
#compile(source_file, options = {}) ⇒ Object
Invokes the OpenLaszlo server-based compiler on
source_file. -
#initialize(options = {}) ⇒ CompileServer
constructor
Options: *
:openlaszlo_home- filesystem location of the OpenLaszlo SDK.
Constructor Details
#initialize(options = {}) ⇒ CompileServer
Options:
-
:openlaszlo_home- filesystem location of the OpenLaszlo SDK. Defaults to ENV -
:server_uri- the URI of the server. Defaults to ENV if this is specified, otherwise to ‘localhost:8080/lps-dev’.
36 37 38 39 40 41 |
# File 'lib/openlaszlo/compiler.rb', line 36 def initialize(={}) @home = [:home] || ENV['OPENLASZLO_HOME'] dirs = Dir[File.join(@home, 'Server', 'lps-*', 'WEB-INF')] @home = File.dirname(dirs.first) if dirs.any? @base_url = [:server_uri] || ENV['OPENLASZLO_URL'] || 'http://localhost:8080/lps-dev' end |
Instance Method Details
#compile(source_file, options = {}) ⇒ Object
Invokes the OpenLaszlo server-based compiler on source_file. source_file must be inside the home directory of the server.
Options:
-
:format- request type (default ‘swf’)
See OpenLaszlo.compile for a description of options.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/openlaszlo/compiler.rb', line 50 def compile(source_file, ={}) mtime = File.mtime(source_file) runtime = [:runtime] || 'swf8' default_output = source_file.sub(/\.lzx/, '') + '.swf' output = [:output] || default_output compile_object(source_file, output, ) results = (source_file, ) raise "Race condition: #{source_file} was modified during compilation" if mtime != File.mtime(source_file) raise CompilationError.new(results[:error]) if results[:error] results[:output] = output return results end |