Class: Terradactyl::ConfigProject
Constant Summary
collapse
- CONFIG_PROJECT_FILE =
'terradactyl.yaml'
Terradactyl::ConfigApplication::CONFIG_DEFAULTS
Instance Attribute Summary
#terradactyl
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize, #reload, #to_h
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Terradactyl::ConfigApplication
Class Method Details
.instance ⇒ Object
119
120
121
|
# File 'lib/terradactyl/config.rb', line 119
def self.instance
@instance ||= new
end
|
Instance Method Details
#config_file ⇒ Object
133
134
135
|
# File 'lib/terradactyl/config.rb', line 133
def config_file
@config_file = CONFIG_PROJECT_FILE
end
|
#load_overlay(overload) ⇒ Object
125
126
127
128
129
130
131
|
# File 'lib/terradactyl/config.rb', line 125
def load_overlay(overload)
config_file_path = overload ? "./#{overload}/#{config_file}" : config_file
YAML.load_file(config_file_path)
rescue Errno::ENOENT => e
abort "FATAL: Could not load project file: `#{config_file}`, #{e.message}"
end
|
#merge_overlay(overlay_path) ⇒ Object
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/terradactyl/config.rb', line 137
def merge_overlay(overlay_path)
config_file_path = overlay_path ? "./#{overlay_path}/#{config_file}" : config_file
config_to_merge = YAML.load_file(config_file_path)
if config_to_merge['terradactyl']['base_folder'] == '.'
config_to_merge['terradactyl']['base_folder'] = overlay_path
end
load_config(overlay_override: config_to_merge)
rescue Errno::ENOENT => e
abort "FATAL: Could not load project file: `#{config_file}`, #{e.message}"
end
|