Class: Papa::Helper::Config
- Inherits:
-
Object
- Object
- Papa::Helper::Config
- Defined in:
- lib/papa/helper/config.rb
Class Method Summary collapse
Class Method Details
.config_exists? ⇒ Boolean
17 18 19 |
# File 'lib/papa/helper/config.rb', line 17 def self.config_exists? File.exists?(config_path) end |
.config_path ⇒ Object
13 14 15 |
# File 'lib/papa/helper/config.rb', line 13 def self.config_path "#{Dir.home}/.papa.config.yml" end |
.exit_on_config_not_exists ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/papa/helper/config.rb', line 21 def self.exit_on_config_not_exists = 'Cannot find config file.' Helper::Output.failure info = <<-INFO Make sure you have a valid config file in #{config_path}. See README.md for more details. INFO Helper::Output.failure_info info exit 1 end |
.read ⇒ Object
7 8 9 10 11 |
# File 'lib/papa/helper/config.rb', line 7 def self.read return @config if defined?(@config) exit_on_config_not_exists unless config_exists? @config = YAML.load_file(config_path) end |