Class: Puppet::Environments::Directories
- Inherits:
-
Object
- Object
- Puppet::Environments::Directories
- Defined in:
- lib/puppet-languageserver-sidecar/puppet_environment_monkey_patches.rb
Instance Method Summary collapse
- #get(name) ⇒ Object
- #get_conf(name) ⇒ Object
-
#original_get ⇒ Object
Monkey patch the environment loader.
-
#original_get_conf ⇒ Object
Monkey patch the environment loader.
Instance Method Details
#get(name) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/puppet-languageserver-sidecar/puppet_environment_monkey_patches.rb', line 8 def get(name) if name.intern == PuppetLanguageServerSidecar::PuppetHelper::SIDECAR_PUPPET_ENVIRONMENT.intern env_symbol = name.intern setting_values = Puppet.settings.values(env_symbol, Puppet.settings.preferred_run_mode) env = Puppet::Node::Environment.create( env_symbol, Puppet::Node::Environment.split_path(setting_values.interpolate(:modulepath)), setting_values.interpolate(:manifest), setting_values.interpolate(:config_version) ) return env end original_get(name) end |
#get_conf(name) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/puppet-languageserver-sidecar/puppet_environment_monkey_patches.rb', line 28 def get_conf(name) if name.intern == PuppetLanguageServerSidecar::PuppetHelper::SIDECAR_PUPPET_ENVIRONMENT.intern conf = Puppet::Settings::EnvironmentConf.load_from(PuppetLanguageServerSidecar::Workspace.root_path, @global_module_path) # Unfortunately the environment.conf expects OS style delimiters which means # it fails if written for windows and read on Unix and vice versa. So we just # inline munge the modulepath modpath = conf.get_raw_setting(:modulepath).value modpath.gsub!(':', File::PATH_SEPARATOR) if File::PATH_SEPARATOR != ':' modpath.gsub!(';', File::PATH_SEPARATOR) if File::PATH_SEPARATOR != ';' return conf end original_get_conf(name) end |
#original_get ⇒ Object
Monkey patch the environment loader. When it attempts to load the special sidecar environment, create a new Puppet::Node::Environment object for the workspace
7 |
# File 'lib/puppet-languageserver-sidecar/puppet_environment_monkey_patches.rb', line 7 alias original_get get |
#original_get_conf ⇒ Object
Monkey patch the environment loader. When it attempts to load the special sidecar environment.conf file, create a new Puppet::Settings::EnvironmentConf object from the workspace.
27 |
# File 'lib/puppet-languageserver-sidecar/puppet_environment_monkey_patches.rb', line 27 alias original_get_conf get_conf |