Class: ProjectFileLoader
Instance Attribute Summary collapse
-
#main_file ⇒ Object
readonly
Returns the value of attribute main_file.
-
#user_file ⇒ Object
readonly
Returns the value of attribute user_file.
Instance Method Summary collapse
Instance Attribute Details
#main_file ⇒ Object (readonly)
Returns the value of attribute main_file.
6 7 8 |
# File 'lib/ceedling/project_file_loader.rb', line 6 def main_file @main_file end |
#user_file ⇒ Object (readonly)
Returns the value of attribute user_file.
6 7 8 |
# File 'lib/ceedling/project_file_loader.rb', line 6 def user_file @user_file end |
Instance Method Details
#find_project_files ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ceedling/project_file_loader.rb', line 19 def find_project_files # first go hunting for optional user project file by looking for environment variable and then default location on disk user_filepath = @system_wrapper.env_get('CEEDLING_USER_PROJECT_FILE') if ( not user_filepath.nil? and @file_wrapper.exist?(user_filepath) ) @user_project_filepath = user_filepath elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_USER_PROJECT_FILE)) @user_project_filepath = DEFAULT_CEEDLING_USER_PROJECT_FILE end # next check for main project file by looking for environment variable and then default location on disk; # blow up if we don't find this guy -- like, he's so totally important main_filepath = @system_wrapper.env_get('CEEDLING_MAIN_PROJECT_FILE') if ( not main_filepath.nil? and @file_wrapper.exist?(main_filepath) ) @main_project_filepath = main_filepath elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_MAIN_PROJECT_FILE)) @main_project_filepath = DEFAULT_CEEDLING_MAIN_PROJECT_FILE else # no verbosity checking since this is lowest level reporting anyhow & # verbosity checking depends on configurator which in turns needs this class (circular dependency) @stream_wrapper.stderr_puts('Found no Ceedling project file (*.yml)') raise end @main_file = File.basename( @main_project_filepath ) @user_file = File.basename( @user_project_filepath ) if ( not @user_project_filepath.empty? ) end |
#load_project_config ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ceedling/project_file_loader.rb', line 49 def load_project_config config_hash = {} # if there's no user project file, then just provide hash from project file if (@user_project_filepath.empty?) config_hash = @yaml_wrapper.load(@main_project_filepath) # if there is a user project file, load it too and merge it on top of the project file, # superseding anything that's common between them else config_hash = (@yaml_wrapper.load(@main_project_filepath)).merge(@yaml_wrapper.load(@user_project_filepath)) end return config_hash end |
#setup ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/ceedling/project_file_loader.rb', line 10 def setup @main_file = nil @user_file = nil @main_project_filepath = '' @user_project_filepath = '' end |