Class: ConfigStore

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

Constant Summary collapse

@@defaults_path =
File.join(File.dirname(__FILE__),'../config/defaults.json')
@@overrides_path =
File.expand_path('~/.config/api_deploy_overrides.json')

Class Method Summary collapse

Class Method Details

.artifactoryObject



30
# File 'lib/config_store.rb', line 30

def artifactory; @@ConfigStore.artifactory; end

.bitbucketObject



32
# File 'lib/config_store.rb', line 32

def bitbucket; @@ConfigStore.bitbucket; end

.defaults_pathObject



5
6
7
# File 'lib/config_store.rb', line 5

def self.defaults_path
  @@defaults_path
end

.defaults_path=(path) ⇒ Object



9
10
11
# File 'lib/config_store.rb', line 9

def self.defaults_path=(path)
  @@defaults_path = path
end

.load_configObject



21
22
23
24
25
26
# File 'lib/config_store.rb', line 21

def self.load_config
  warn "ConfigStoreuration overrides file not present at #{overrides_path}" unless File.exists?(overrides_path)
  defaults = Hashie::Mash.new(JSON.parse(File.read(defaults_path))) if File.exists?(defaults_path)
  overrides = JSON.parse(File.read(overrides_path)) if File.exists?(overrides_path)
  defaults.deep_merge(overrides || {})
end

.octopusObject



31
# File 'lib/config_store.rb', line 31

def octopus; @@ConfigStore.octopus; end

.overrides_pathObject



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

def self.overrides_path
  @@overrides_path
end

.overrides_path=(path) ⇒ Object



17
18
19
# File 'lib/config_store.rb', line 17

def self.overrides_path=(path)
  @@overrides_path = path
end

.set_configObject



35
36
37
# File 'lib/config_store.rb', line 35

def self.set_config
  @@ConfigStore = self.load_config
end

.teamcityObject



29
# File 'lib/config_store.rb', line 29

def teamcity; @@ConfigStore.teamcity; end