class MStrap::Configuration

Included Modules

Defined in:

mstrap/configuration.cr

Constant Summary

DEFAULT_PROFILE_CONFIG_DEF = Defs::DefaultProfileConfigDef.new

Constructors

Instance Method Summary

Instance methods inherited from module MStrap::DSL::System

cmd(env : Hash | Nil, command : String, args : Array(String) | Nil, **kwargs) cmd, has_command?(command_name : String, **kwargs) : Bool has_command?

Instance methods inherited from module MStrap::DSL::Logging

log(msg) log, logc(msg) logc, logd(msg) logd, logn(msg) logn, logw(msg) logw, success(msg) success

Constructor Detail

def self.new(config : Defs::ConfigDef, config_path : String = Paths::CONFIG_HCL) #

[View source]

Instance Method Detail

def config_path : String #

Returns path to configuration file


[View source]
def default_runtime_manager : MStrap::RuntimeManager #

Returns the default runtime manager specified by the configuration


[View source]
def known_profile_configs : Array(MStrap::Defs::ProfileConfigDef) #

Returns known profile configurations


[View source]
def load_profiles!(force = false) #

Loads all profiles and resolves them into the resolved_profile

Raises ConfigurationNotFoundError if a profile cannot be found.


[View source]
def loaded_profile_configs : Array(MStrap::Defs::ProfileConfigDef) #

Returns loaded profile configurations


[View source]
def loaded_profiles : Array(MStrap::Defs::ProfileDef) #

Returns loaded profiles


[View source]
def loaded_profiles? #

Returns whether profiles have been loaded


[View source]
def profile_configs #

Returns profile configurations for active profiles


[View source]
def profiles #

Returns active profiles


[View source]
def reload!(force = false) #

Resets and reloads configuration and any managed profiles.

Raises ConfigurationNotFoundError if the mstrap configuration cannot be found or accessed, or any managed profiles cannot be found or accessed.


[View source]
def resolved_profile : MStrap::Defs::ProfileDef #

Returns resolved profile. This is the result of merging loaded managed profiles with the default profiles.


[View source]
def runtime_managers : Array(MStrap::RuntimeManager) #

Returns the runtime managers specified by the configuration


[View source]
def runtimes : Hash(String, MStrap::Runtime) #

Returns the language runtimes with their resolved runtime manager

Raises UnsupportedLanguageRuntimeManagerError if the configuration of a language runtime to a runtime manager is invalid Raises InvalidRuntimeManagerError if an invalid runtime manager is provided


[View source]
def save! #

Saves configuration back to disk


[View source]
def user : MStrap::User #

Returns the mstrap user


[View source]