Module: Inception::CliHelpers::Settings
Instance Method Summary collapse
- #migrate_old_settings ⇒ Object
-
#save_settings! ⇒ Object
Saves current nested Settingslogic into pure Hash-based YAML file Recreates accessors on Settingslogic object (since something has changed).
- #settings ⇒ Object
-
#settings_dir ⇒ Object
The base directory for holding the manifest settings file and private keys.
- #settings_path ⇒ Object
- #settings_ssh_dir ⇒ Object
Instance Method Details
#migrate_old_settings ⇒ Object
43 44 |
# File 'lib/inception/cli_helpers/settings.rb', line 43 def migrate_old_settings end |
#save_settings! ⇒ Object
Saves current nested Settingslogic into pure Hash-based YAML file Recreates accessors on Settingslogic object (since something has changed)
38 39 40 41 |
# File 'lib/inception/cli_helpers/settings.rb', line 38 def save_settings! File.open(settings_path, "w") { |f| f << settings.to_nested_hash.to_yaml } settings.create_accessors! end |
#settings ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/inception/cli_helpers/settings.rb', line 24 def settings @settings ||= begin unless File.exists?(settings_path) mkdir_p(settings_ssh_dir) File.open(settings_path, "w") { |file| file << "--- {}" } end chmod(0600, settings_path) chmod(0700, settings_ssh_dir) Settingslogic.new(settings_path) end end |
#settings_dir ⇒ Object
The base directory for holding the manifest settings file and private keys
Defaults to ~/.bosh_inception; and can be overridden with either:
-
$SETTINGS - to a folder (supported method)
12 13 14 |
# File 'lib/inception/cli_helpers/settings.rb', line 12 def settings_dir @settings_dir ||= File.(ENV["SETTINGS"] || "~/.bosh_inception") end |
#settings_path ⇒ Object
20 21 22 |
# File 'lib/inception/cli_helpers/settings.rb', line 20 def settings_path @settings_path ||= File.join(settings_dir, "settings.yml") end |
#settings_ssh_dir ⇒ Object
16 17 18 |
# File 'lib/inception/cli_helpers/settings.rb', line 16 def settings_ssh_dir File.join(settings_dir, "ssh") end |