Class: SugarJar::RepoConfig

Inherits:
Object
  • Object
show all
Extended by:
Util
Defined in:
lib/sugarjar/repoconfig.rb

Overview

This parses SugarJar repoconfigs (not to be confused with configs). This is lint/unit/on_push configs.

Constant Summary collapse

CONFIG_NAME =
'.sugarjar.yaml'.freeze

Class Method Summary collapse

Methods included from Util

hub, hub_nofail, in_repo, repo_root, which, which_nofail

Class Method Details

.configObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sugarjar/repoconfig.rb', line 17

def self.config
  unless in_repo
    SugarJar::Log.debug('Not in repo, skipping repoconfig load')
    return {}
  end
  config = repo_config
  if File.exist?(config)
    SugarJar::Log.debug("Loading repo config: #{config}")
    YAML.safe_load(File.read(repo_config))
  else
    SugarJar::Log.debug("No repo config (#{config}), returning empty hash")
    {}
  end
end

.repo_configObject



13
14
15
# File 'lib/sugarjar/repoconfig.rb', line 13

def self.repo_config
  ::File.join(repo_root, CONFIG_NAME)
end