Class: Mxrb::RubyApp::Exporter
- Inherits:
-
Object
- Object
- Mxrb::RubyApp::Exporter
- Defined in:
- lib/mxrb/ruby_app/exporter.rb
Overview
Projects a Mendix model into conventional executable Ruby source while retaining the complete Mendix-mode tree as the reversible sidecar. rubocop:disable Metrics
Constant Summary collapse
- REST_STATUS_CODES =
{ 'ok' => 200, 'created' => 201, 'accepted' => 202, 'nocontent' => 204, 'movedpermanently' => 301, 'found' => 302, 'badrequest' => 400, 'unauthorized' => 401, 'forbidden' => 403, 'notfound' => 404, 'conflict' => 409, 'internalservererror' => 500 }.freeze
- RUBY_KEYWORDS =
%w[ alias and begin break case class def defined do else elsif end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield ].freeze
- RECORD_RESERVED =
%w[attributes id initialize mendix_id mendix_name to_h type].freeze
Instance Method Summary collapse
- #export! ⇒ Object
-
#initialize(mpr_path, output_dir, mendix_sidecar:) ⇒ Exporter
constructor
A new instance of Exporter.
Constructor Details
#initialize(mpr_path, output_dir, mendix_sidecar:) ⇒ Exporter
Returns a new instance of Exporter.
27 28 29 30 31 |
# File 'lib/mxrb/ruby_app/exporter.rb', line 27 def initialize(mpr_path, output_dir, mendix_sidecar:) @mpr_path = File.(mpr_path) @output_dir = File.(output_dir) @mendix_sidecar = File.(mendix_sidecar) end |
Instance Method Details
#export! ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mxrb/ruby_app/exporter.rb', line 33 def export! FileUtils.mkdir_p(@output_dir) runtime_mpr = copy_runtime_mpr = Mxrb.open(@mpr_path) do |project| @project = project @coverage = [] @nanoflow_entries = [] @page_entries = [] modules = project.modules.map { export_module(_1) } @module_manifests = modules write_support_files copy_frontend_theme () write_manifest(project, modules, runtime_mpr) end @output_dir ensure @project = nil @module_manifests = nil end |