Skip to content
Snippets Groups Projects

Fix CI

Merged Lemmer, Jan requested to merge dev/config into master
24 files
+ 669
257
Compare changes
  • Side-by-side
  • Inline
Files
24
+ 78
0
classdef config < handle
%CONFIG class handles methoths and attributes related to the config
%file
% Detailed explanation goes here
% handle class used for dynamicy property updates
properties (SetAccess = private)
mandatoryFields = {'Author', 'ProjectID'}
optionFields
end
properties (SetAccess = protected)
configData
configFileName
end
methods
function obj = config(configFileName)
%CONFIG Construct an instance of this class
% Detailed explanation goes here
obj.configFileName = configFileName;
try
txt = fileread(obj.configFileName);
obj.configData = jsondecode(txt);
assert(checkConfig(obj));
catch
msg = ['no valid config File with the filename ',...
obj.configFileName, ' found.' newline,...
'Please enter the required information manually'];
disp(msg);
obj.configData = obj.wizard('initilise');
m = input('Do you want to save the config, Y/N [Y]:','s');
if ismember(m,{'Y','y'})
obj.writeConfig(fullfile(pwd));
end
end%try
end
function outputArg = checkConfig(obj)
%checkConfig validates the config file
% 1. Check if mandatory Fields are set
check = isfield(obj.configData,obj.mandatoryFields);
outputArg = all(check);
end
function writeConfig(obj,path)
%writeConfig writes the config file to path
% TODo;
fid = fopen(fullfile(path,obj.configFileName),'w');
txt = jsonencode(obj.configData,'PrettyPrint',true);
%fprintf does not write paths correctly !!!
fwrite(fid,txt);
fclose(fid);
end
function configData = addPublishOptions(obj,mode)
%writeConfig writes the config file to path
% TODo;
obj.configData.options = obj.plotID_options(mode);
end
function outputArg = method1(obj,inputArg)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
outputArg = obj.Property1 + inputArg;
end
end
methods (Static)
configStruct = wizard(mode)
optionStruct = plotID_options(input)
end
end
Loading