Class: TpCommandLine::Config
- Inherits:
-
Object
- Object
- TpCommandLine::Config
- Defined in:
- lib/config.rb
Instance Method Summary collapse
Instance Method Details
#file_set ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/config.rb', line 6 def file_set Valise::Set.define do ro "." ro "config/" ro "~/.timepulse" ro "~/" ro "/usr/share/timepulse" ro "/etc/timepulse" handle "*.yml", :yaml, :hash_merge handle "*.yaml", :yaml, :hash_merge end end |
#load_config ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/config.rb', line 20 def load_config @config_hash = file_set.contents("timepulse.yml") missing_fields = ['timepulse_url', 'project_id', 'login', 'authorization'].find_all {|k| !@config_hash.keys.include? k} unless missing_fields.empty? puts "Missing necessary parameter/s: #{missing_fields.join(", ")}" exit end return @config_hash end |