Class: DevMetrics::Config
- Inherits:
-
Object
- Object
- DevMetrics::Config
- Defined in:
- lib/dev_metrics.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#excluded_accounts ⇒ Object
Returns the value of attribute excluded_accounts.
-
#repo_name ⇒ Object
Returns the value of attribute repo_name.
-
#rollback_branch_prefixes ⇒ Object
Returns the value of attribute rollback_branch_prefixes.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load_from_yaml(path = "dev_metrics_config.yml") ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 |
# File 'lib/dev_metrics.rb', line 15 def initialize @access_token = nil @repo_name = nil @excluded_accounts = [] @rollback_branch_prefixes = [] end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
13 14 15 |
# File 'lib/dev_metrics.rb', line 13 def access_token @access_token end |
#excluded_accounts ⇒ Object
Returns the value of attribute excluded_accounts.
13 14 15 |
# File 'lib/dev_metrics.rb', line 13 def excluded_accounts @excluded_accounts end |
#repo_name ⇒ Object
Returns the value of attribute repo_name.
13 14 15 |
# File 'lib/dev_metrics.rb', line 13 def repo_name @repo_name end |
#rollback_branch_prefixes ⇒ Object
Returns the value of attribute rollback_branch_prefixes.
13 14 15 |
# File 'lib/dev_metrics.rb', line 13 def rollback_branch_prefixes @rollback_branch_prefixes end |
Instance Method Details
#load_from_yaml(path = "dev_metrics_config.yml") ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dev_metrics.rb', line 22 def load_from_yaml(path = "dev_metrics_config.yml") unless File.exist?(path) warn "Config file '#{path}' not found. Please create it before running this tool." exit 1 end config = YAML.load_file(path) if config["access_token"].nil? || config["repo_name"].nil? warn "Config file must include 'access_token' and 'repo_name'." exit 1 end @access_token = config["access_token"] @repo_name = config["repo_name"] @excluded_accounts = config["excluded_accounts"] || [] @rollback_branch_prefixes = config["rollback_branch_prefixes"] || [] end |