Class: Baboon::Util
- Inherits:
-
Object
- Object
- Baboon::Util
- Defined in:
- lib/baboon/util.rb
Class Method Summary collapse
-
.file_check!(file) ⇒ Object
file_check! @param: String file path @return: Boolean || String depending on if file is found.
-
.locate_baboon_configuration_file(specific_file_path = nil) ⇒ Object
locate_baboon_configuration_file Will try and locate the baboon.rb file it it does not exist.
Class Method Details
.file_check!(file) ⇒ Object
file_check! @param: String file path @return: Boolean || String depending on if file is found
7 8 9 |
# File 'lib/baboon/util.rb', line 7 def file_check! file file.nil? || !file ? false : true end |
.locate_baboon_configuration_file(specific_file_path = nil) ⇒ Object
locate_baboon_configuration_file Will try and locate the baboon.rb file it it does not exist. Great method used especially for testing Baboon. @param: @return: String[file path, used to locate and initialize the configuration file]
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/baboon/util.rb', line 16 def locate_baboon_configuration_file(specific_file_path=nil) config_file = nil default_baboon_file_path = 'config/baboon.yml' if specific_file_path.nil? if File.exists?(default_baboon_file_path) config_file = default_baboon_file_path else Find.find('.') do |path| if path.include?('baboon.yml') config_file = path break end end end else config_file = specific_file end config_file end |