Class: Pronto::ConfigFile

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

Constant Summary collapse

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,
    'web_endpoint' => 'https://bitbucket.org/'
  },
  'runners' => [],
  'formatters' => [],
  'max_warnings' => nil,
  'verbose' => false
}.freeze

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ConfigFile.



31
32
33
# File 'lib/pronto/config_file.rb', line 31

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

Instance Method Details

#to_hObject



35
36
37
38
# File 'lib/pronto/config_file.rb', line 35

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