Class: Mxrb::Compiler::PortablePackager

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/compiler/portable_packager.rb

Overview

Creates an executable portable application from materialized app files and an installed Mendix Runtime distribution. It never invokes mxbuild.

Constant Summary collapse

REQUIRED_RUNTIME_FILES =
%w[launcher/runtimelauncher.jar].freeze

Instance Method Summary collapse

Constructor Details

#initialize(mpr_path, deployment: nil, mendix_home: nil) ⇒ PortablePackager

Returns a new instance of PortablePackager.



305
306
307
308
309
310
# File 'lib/mxrb/compiler/portable_packager.rb', line 305

def initialize(mpr_path, deployment: nil, mendix_home: nil)
  @mpr_path = File.expand_path(mpr_path)
  @project_root = File.dirname(@mpr_path)
  @deployment = File.expand_path(deployment || File.join(@project_root, 'deployment'))
  @mendix_home = mendix_home && File.expand_path(mendix_home)
end

Instance Method Details

#pack(output:, force: false) ⇒ Object



312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/mxrb/compiler/portable_packager.rb', line 312

def pack(output:, force: false)
  output_path = File.expand_path(output)
  validate_output!(output_path, force:)
  version = Mxrb.open(@mpr_path, &:mendix_version)
  adapter = Adapter.for(version)
   = adapter.validate_deployment!(@deployment)
  adapter.validate_freshness!(@mpr_path, @deployment)
  runtime = runtime_root(version)
  validate_runtime!(runtime)
  PortableArchiveWriter.new(@deployment, runtime, ).write(output_path)
  result(output_path, version, )
end