Class: Mxrb::Compiler::DeploymentBootstrapper
- Inherits:
-
Object
- Object
- Mxrb::Compiler::DeploymentBootstrapper
- Defined in:
- lib/mxrb/compiler/deployment_bootstrapper.rb
Overview
Creates a deployment workspace from versioned Studio Pro templates without invoking its builders.
Constant Summary collapse
- COMMON_TEMPLATE_ROOTS =
rubocop:disable Metrics/ClassLength
%w[data log model native run tmp].freeze
- REQUIRED_DIRECTORIES =
%w[ data/database data/files data/tmp log model/bundles model/lib/userlib model/resources run tmp web/img ].freeze
Instance Method Summary collapse
-
#initialize(mpr_path, deployment:, mendix_home: nil) ⇒ DeploymentBootstrapper
constructor
A new instance of DeploymentBootstrapper.
- #prepare ⇒ Object
- #prepare_existing ⇒ Object
- #prepare_fresh ⇒ Object
Constructor Details
#initialize(mpr_path, deployment:, mendix_home: nil) ⇒ DeploymentBootstrapper
Returns a new instance of DeploymentBootstrapper.
18 19 20 21 22 23 24 25 |
# File 'lib/mxrb/compiler/deployment_bootstrapper.rb', line 18 def initialize(mpr_path, deployment:, mendix_home: nil) @mpr_path = File.(mpr_path) @project_root = File.dirname(@mpr_path) @deployment = File.(deployment) @source = SourceModel.read(@mpr_path) @version_root = resolve_version_root(mendix_home) @template_root = File.join(@version_root, 'modeler', 'runtemplates', 'deployment') end |
Instance Method Details
#prepare ⇒ Object
27 28 29 30 31 32 |
# File 'lib/mxrb/compiler/deployment_bootstrapper.rb', line 27 def prepare return prepare_existing if ready? validate_templates! prepare_fresh end |
#prepare_existing ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/mxrb/compiler/deployment_bootstrapper.rb', line 34 def prepare_existing ensure_web_build_templates if modern_react_web? ensure_required_directories copy_project_assets finalize_web_shell DeploymentBootstrap.new(deployment: @deployment, created: false, template_root: @template_root) end |
#prepare_fresh ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/mxrb/compiler/deployment_bootstrapper.rb', line 42 def prepare_fresh FileUtils.mkdir_p(@deployment) copy_version_templates ensure_required_directories render_templates initialize_model copy_project_assets finalize_web_shell DeploymentBootstrap.new(deployment: @deployment, created: true, template_root: @template_root) end |