Class: Percheron::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/percheron/config.rb

Constant Summary collapse

DEFAULT_CONFIG_FILE =
'.percheron.yml'
@@file =

rubocop:disable Style/ClassVars

Pathname.new(DEFAULT_CONFIG_FILE).expand_path

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dockerObject



58
59
60
# File 'lib/percheron/config.rb', line 58

def self.docker
  instance.docker
end

.file_base_pathObject



34
35
36
# File 'lib/percheron/config.rb', line 34

def self.file_base_path
  instance.file_base_path
end

.load!(file) ⇒ Object

rubocop:enable Style/ClassVars



14
15
16
# File 'lib/percheron/config.rb', line 14

def self.load!(file)
  instance.load!(file)
end

.secretsObject



42
43
44
# File 'lib/percheron/config.rb', line 42

def self.secrets
  instance.secrets
end

.stacksObject

rubocop:enable Style/ClassVars



26
27
28
# File 'lib/percheron/config.rb', line 26

def self.stacks
  instance.stacks
end

.userdataObject



50
51
52
# File 'lib/percheron/config.rb', line 50

def self.userdata
  instance.userdata
end

Instance Method Details

#dockerObject



62
63
64
# File 'lib/percheron/config.rb', line 62

def docker
  contents.docker
end

#file_base_pathObject



38
39
40
# File 'lib/percheron/config.rb', line 38

def file_base_path
  file.dirname
end

#load!(file) ⇒ Object

rubocop:disable Style/ClassVars



19
20
21
22
23
# File 'lib/percheron/config.rb', line 19

def load!(file)
  @@file = Pathname.new(file).expand_path
  invalidate_memoised_values!
  self
end

#secretsObject



46
47
48
# File 'lib/percheron/config.rb', line 46

def secrets
  secrets_file ? Hashie::Mash.new(YAML.load_file(secrets_file)) : {}
end

#stacksObject



30
31
32
# File 'lib/percheron/config.rb', line 30

def stacks
  @stacks ||= process_stacks!
end

#userdataObject



54
55
56
# File 'lib/percheron/config.rb', line 54

def userdata
  contents.userdata || {}
end