Class: Gitmine::Config
- Inherits:
-
Object
- Object
- Gitmine::Config
- Defined in:
- lib/gitmine/config.rb
Constant Summary collapse
- HOME_CONFIG_FILE =
"#{ENV['HOME']}/.gitmine.yml"
- CONFIG_FILE =
'./.gitmine.yml'
Class Method Summary collapse
- .config ⇒ Object
- .github ⇒ Object
- .redmine_api_key ⇒ Object
- .redmine_host ⇒ Object
- .status_reviewed ⇒ Object
- .statuses ⇒ Object
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
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
.config ⇒ Object
7 8 9 |
# File 'lib/gitmine/config.rb', line 7 def config @@config ||= new end |
.github ⇒ Object
19 20 21 |
# File 'lib/gitmine/config.rb', line 19 def github config['github'] end |
.redmine_api_key ⇒ Object
15 16 17 |
# File 'lib/gitmine/config.rb', line 15 def redmine_api_key config['api_key'] end |
.redmine_host ⇒ Object
11 12 13 |
# File 'lib/gitmine/config.rb', line 11 def redmine_host config['host'] end |
.status_reviewed ⇒ Object
27 28 29 |
# File 'lib/gitmine/config.rb', line 27 def status_reviewed config['statuses']['reviewed'] end |
.statuses ⇒ Object
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 |