Class OpenLaszlo::CompileServer
In: lib/openlaszlo/compiler.rb
Parent: Object

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.

Methods

compile   new  

Public Class methods

Options:

  • :openlaszlo_home - filesystem location of the OpenLaszlo SDK. Defaults to ENV[‘OPENLASZLO_HOME’]
  • :server_uri - the URI of the server. Defaults to ENV[‘OPENLASZLO_URL’] if this is specified, otherwise to ‘localhost:8080/lps-dev’.

[Source]

# File lib/openlaszlo/compiler.rb, line 36
    def initialize(options={})
      @home = options[:home] || ENV['OPENLASZLO_HOME']
      dirs = Dir[File.join(@home, 'Server', 'lps-*', 'WEB-INF')]
      @home = File.dirname(dirs.first) if dirs.any?
      @base_url = options[:server_uri] || ENV['OPENLASZLO_URL'] || 'http://localhost:8080/lps-dev'
    end

Public Instance methods

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.

[Source]

# File lib/openlaszlo/compiler.rb, line 50
    def compile(source_file, options={})
      mtime = File.mtime(source_file)
      runtime = options[:runtime] || 'swf8'
      default_output = source_file.sub(/\.lzx/, '') + '.swf'
      output = options[:output] || default_output
      compile_object(source_file, output, options)
      results = request_metadata_for(source_file, options)
      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

[Validate]