Class: ConventionalCommits::Configuration::MainConfigurationReader

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration/main_configuration_reader.rb

Instance Method Summary collapse

Instance Method Details

#get_configuration(path: Configuration::DEFAULT_CONFIGURATION_PATH) ⇒ Object

Raises:



7
8
9
10
11
12
13
14
# File 'lib/configuration/main_configuration_reader.rb', line 7

def get_configuration(path: Configuration::DEFAULT_CONFIGURATION_PATH)
  raise GenericError, "Path is empty" if path.empty?
  raise GenericError, "File not found at #{path}" unless File.exist?(path)

  file = File.open(path)
  config = YAML.load(file)
  MainConfiguration.new(config)
end