class DockerSync::GlobalConfig

Constants

DEFAULTS

noinspection RubyStringKeysInHashInspection

Attributes

config[R]

Public Class Methods

load() click to toggle source
# File lib/docker-sync/config/global_config.rb, line 26
def self.load; instance end
new() click to toggle source
# File lib/docker-sync/config/global_config.rb, line 28
def initialize
  load_global_config
end

Public Instance Methods

first_run?() click to toggle source
# File lib/docker-sync/config/global_config.rb, line 44
def first_run?
  @first_run
end
load_global_config() click to toggle source
# File lib/docker-sync/config/global_config.rb, line 32
def load_global_config
  @config_path = DockerSync::ConfigLocator.current_global_config_path
  if File.exist?(@config_path)
    @config = DockerSync::ConfigSerializer.default_deserializer_file(@config_path)
  end

  unless @config
    @config = DEFAULTS.dup
    @first_run = true
  end
end
update!(updates) click to toggle source

@param [Object] updates Updates and saves the configuration back to the file

# File lib/docker-sync/config/global_config.rb, line 50
def update!(updates)
  @config.merge!(updates)

  File.open(@config_path, 'w') {|f| f.write @config.to_yaml }
end