Class: Pronto::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/config_file.rb

Constant Summary collapse

DEFAULT_MESSAGE_FORMAT =
'%{msg}'.freeze
EMPTY =
{
  'all' => {
    'exclude' => [],
    'include' => []
  },
  'github' => {
    'slug' => nil,
    'access_token' => nil,
    'api_endpoint' => 'https://api.github.com/',
    'web_endpoint' => 'https://github.com/'
  },
  'gitlab' => {
    'slug' => nil,
    'api_private_token' => nil,
    'api_endpoint' => 'https://gitlab.com/api/v3'
  },
  'bitbucket' => {
    'slug' => nil,
    'username' => nil,
    'password' => nil,
    'api_endpoint' => nil,
    'web_endpoint' => 'https://bitbucket.org/'
  },
  'text' => {
    'format' => '%{color_location} %{color_level}: %{msg}'
  },
  'runners' => [],
  'formatters' => [],
  'max_warnings' => nil,
  'verbose' => false,
  'format' => DEFAULT_MESSAGE_FORMAT
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(path = '.pronto.yml') ⇒ ConfigFile

Returns a new instance of ConfigFile.



38
39
40
# File 'lib/pronto/config_file.rb', line 38

def initialize(path = '.pronto.yml')
  @path = path
end

Instance Method Details

#to_hObject



42
43
44
45
# File 'lib/pronto/config_file.rb', line 42

def to_h
  hash = File.exist?(@path) ? YAML.load_file(@path) : {}
  deep_merge(hash)
end