diff options
author | elijah <elijah@riseup.net> | 2016-02-01 15:05:24 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2016-02-01 15:05:24 -0800 |
commit | 80db7cd55385a94802579c4a94d5ad8203b3ee3d (patch) | |
tree | 461c41bd7794a5a30a9622c7c842f112fe3287fb | |
parent | ceb6a0552097a2cc261cd4884a13cf53deabc337 (diff) |
added manager.template(), used when creating new nodes
-rw-r--r-- | lib/leap_cli/config/manager.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb index 2013217..ca739c3 100644 --- a/lib/leap_cli/config/manager.rb +++ b/lib/leap_cli/config/manager.rb @@ -331,6 +331,19 @@ module LeapCli @partials[partial_path] end + # + # Loads a json template file as a Hash (used only when creating a new node .json + # file for the first time). + # + def template(template) + path = Path.named_path([:template_config, template], Path.provider_base) + if File.exists?(path) + return load_json(path, Config::Object) + else + return nil + end + end + private def load_all_json(pattern, object_class, options={}) |