Class: Gitmine::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/gitmine/config.rb

Constant Summary collapse

HOME_CONFIG_FILE =
"#{ENV['HOME']}/.gitmine.yml"
CONFIG_FILE =
'./.gitmine.yml'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



32
33
34
35
36
# File 'lib/gitmine/config.rb', line 32

def initialize
  # Read from the home .gitmine.yml file first, then merge the local file on top of it to provide proper overrides
  home_config = File.exists?(HOME_CONFIG_FILE) ? YAML.load_file(HOME_CONFIG_FILE) : {}
  @config = home_config.merge(YAML.load_file(CONFIG_FILE))
end

Class Method Details

.configObject



7
8
9
# File 'lib/gitmine/config.rb', line 7

def config
  @@config ||= new
end

.githubObject



19
20
21
# File 'lib/gitmine/config.rb', line 19

def github
  config['github']
end

.redmine_api_keyObject



15
16
17
# File 'lib/gitmine/config.rb', line 15

def redmine_api_key
  config['api_key']
end

.redmine_hostObject



11
12
13
# File 'lib/gitmine/config.rb', line 11

def redmine_host
  config['host']
end

.status_reviewedObject



27
28
29
# File 'lib/gitmine/config.rb', line 27

def status_reviewed
  config['statuses']['reviewed']
end

.statusesObject



23
24
25
# File 'lib/gitmine/config.rb', line 23

def statuses
  config['statuses']
end

Instance Method Details

#[](key) ⇒ Object



38
39
40
# File 'lib/gitmine/config.rb', line 38

def [](key)
  @config[key]
end