Class: GradesFirst::Config
- Inherits:
-
Object
- Object
- GradesFirst::Config
- Defined in:
- lib/gradesfirst/config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #code_talkers ⇒ Object
- #day_zero ⇒ Object
- #developers ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gradesfirst/config.rb', line 5 def initialize if GradesFirst::Config.load_paths.any?{ |f| File.exist?(f) } Dotenv.load(*GradesFirst::Config.load_paths) else puts <<-MESSAGE The configuration file is missing and should be found in one of the following locations: #{GradesFirst::Config.load_paths.join('\n')} See "gf help <command>" for details on configuration settings. MESSAGE end end |
Class Method Details
.load_paths ⇒ Object
20 21 22 |
# File 'lib/gradesfirst/config.rb', line 20 def self.load_paths @@load_paths ||= [".env.gf", "#{Dir.home}/.env.gf", ".env.gf.master"] end |
.load_paths=(paths) ⇒ Object
24 25 26 |
# File 'lib/gradesfirst/config.rb', line 24 def self.load_paths=(paths) @@load_paths = paths end |
Instance Method Details
#code_talkers ⇒ Object
28 29 30 |
# File 'lib/gradesfirst/config.rb', line 28 def code_talkers ENV["GF_CODE_TALKERS"].to_s.split("|") end |
#day_zero ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/gradesfirst/config.rb', line 32 def day_zero if ENV["GF_DAY_ZERO"].nil? Time.now else Time.parse(ENV["GF_DAY_ZERO"]) end end |
#developers ⇒ Object
40 41 42 |
# File 'lib/gradesfirst/config.rb', line 40 def developers ENV["GF_DEVELOPERS"].to_s.split("|") end |