Skip to content
Snippets Groups Projects
Commit 1d974e88 authored by Luke Simons's avatar Luke Simons
Browse files

Moved functionality of getting deployment info into tcv_get_deployment_info

parent 2069eca7
No related branches found
No related tags found
1 merge request!171Resolve "Add tcv_get_ids_bolometer to TCV_IMAS functions"
...@@ -11,45 +11,50 @@ function info = tcv_get_deploymentinfo(filepath) ...@@ -11,45 +11,50 @@ function info = tcv_get_deploymentinfo(filepath)
% Initialize output struct % Initialize output struct
info = struct(); info = struct();
info.repository=fileparts(filepath); try
filepath=fullfile(fileparts(which(filepath)),'.this-deployment.info');
% Check if file exists info.repository=fileparts(filepath);
if exist(filepath, 'file') ~= 2
error('File does not exist: %s', filepath); % Check if file exists
end if exist(filepath, 'file') ~= 2
error('File does not exist: %s', filepath);
% Open file for reading end
fid = fopen(filepath, 'r');
if fid == -1 % Open file for reading
error('Could not open file: %s', filepath); fid = fopen(filepath, 'r');
end if fid == -1
error('Could not open file: %s', filepath);
% Read file line by line end
while ~feof(fid)
line = fgetl(fid); % Read file line by line
if ischar(line) while ~feof(fid)
tokens = regexp(line, '^(\w+):\s(.+)$', 'tokens'); line = fgetl(fid);
if ~isempty(tokens) if ischar(line)
key = tokens{1}{1}; tokens = regexp(line, '^(\w+):\s(.+)$', 'tokens');
value = strtrim(tokens{1}{2}); if ~isempty(tokens)
key = tokens{1}{1};
% Store relevant fields in the struct value = strtrim(tokens{1}{2});
switch key
case 'DEPLOYMENT_DATE' % Store relevant fields in the struct
info.deployment_date = value; switch key
case 'GIT_TAG' case 'DEPLOYMENT_DATE'
info.git_tag = value; info.deployment_date = value;
case 'GIT_COMMIT' case 'GIT_TAG'
info.git_commit = value; info.git_tag = value;
case 'GIT_TAG_DATE' case 'GIT_COMMIT'
info.git_tag_date = value; info.git_commit = value;
case 'GITLAB_PROJECT_URL' case 'GIT_TAG_DATE'
info.gitlab_project_url = value; info.git_tag_date = value;
case 'GITLAB_PROJECT_URL'
info.gitlab_project_url = value;
end
end end
end end
end end
% Close the file
fclose(fid);
catch
warning('Failed to read .deployment at filepath: %s',filepath);
end end
% Close the file
fclose(fid);
end end
...@@ -30,9 +30,7 @@ ids_bolometer_description = struct(); ...@@ -30,9 +30,7 @@ ids_bolometer_description = struct();
% Load the bolometer geometry % Load the bolometer geometry
bolo_geom=bolou_load_geometry(); bolo_geom=bolou_load_geometry();
bolo_geom_gitinfo= ... bolo_geom_gitinfo= tcv_get_deploymentinfo('bolou_load_geometry');
tcv_get_deploymentinfo(fullfile(fileparts(which('bolou_load_geometry')), ...
'.this-deployment.info'));
params_eff.data_request='\tcv_shot::top.results.bolo_u.intensity'; params_eff.data_request='\tcv_shot::top.results.bolo_u.intensity';
params_eff.trialindx=1; params_eff.trialindx=1;
...@@ -146,8 +144,7 @@ if status ...@@ -146,8 +144,7 @@ if status
%% Code legacy for rc_gti_prep %% Code legacy for rc_gti_prep
ids_bolometer.code.name = 'rc_gti_prep'; ids_bolometer.code.name = 'rc_gti_prep';
rc_gti_prep_gitinfo= ... rc_gti_prep_gitinfo= tcv_get_deploymentinfo(ids_bolometer.code.name);
tcv_get_deploymentinfo(fullfile(fileparts(which(ids_bolometer.code.name)),'.this-deployment.info'));
ids_bolometer.code.description = ... ids_bolometer.code.description = ...
'rc_gti_prep, RADCAM gitlab repo, calls GTI to generate emissivity profiles with liuqe.'; 'rc_gti_prep, RADCAM gitlab repo, calls GTI to generate emissivity profiles with liuqe.';
ids_bolometer.code.commit=rc_gti_prep_gitinfo.git_commit; ids_bolometer.code.commit=rc_gti_prep_gitinfo.git_commit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment