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)
% Initialize output struct
info = struct();
info.repository=fileparts(filepath);
% Check if file exists
if exist(filepath, 'file') ~= 2
error('File does not exist: %s', filepath);
end
% Open file for reading
fid = fopen(filepath, 'r');
if fid == -1
error('Could not open file: %s', filepath);
end
% Read file line by line
while ~feof(fid)
line = fgetl(fid);
if ischar(line)
tokens = regexp(line, '^(\w+):\s(.+)$', 'tokens');
if ~isempty(tokens)
key = tokens{1}{1};
value = strtrim(tokens{1}{2});
% Store relevant fields in the struct
switch key
case 'DEPLOYMENT_DATE'
info.deployment_date = value;
case 'GIT_TAG'
info.git_tag = value;
case 'GIT_COMMIT'
info.git_commit = value;
case 'GIT_TAG_DATE'
info.git_tag_date = value;
case 'GITLAB_PROJECT_URL'
info.gitlab_project_url = value;
try
filepath=fullfile(fileparts(which(filepath)),'.this-deployment.info');
info.repository=fileparts(filepath);
% Check if file exists
if exist(filepath, 'file') ~= 2
error('File does not exist: %s', filepath);
end
% Open file for reading
fid = fopen(filepath, 'r');
if fid == -1
error('Could not open file: %s', filepath);
end
% Read file line by line
while ~feof(fid)
line = fgetl(fid);
if ischar(line)
tokens = regexp(line, '^(\w+):\s(.+)$', 'tokens');
if ~isempty(tokens)
key = tokens{1}{1};
value = strtrim(tokens{1}{2});
% Store relevant fields in the struct
switch key
case 'DEPLOYMENT_DATE'
info.deployment_date = value;
case 'GIT_TAG'
info.git_tag = value;
case 'GIT_COMMIT'
info.git_commit = value;
case 'GIT_TAG_DATE'
info.git_tag_date = value;
case 'GITLAB_PROJECT_URL'
info.gitlab_project_url = value;
end
end
end
end
% Close the file
fclose(fid);
catch
warning('Failed to read .deployment at filepath: %s',filepath);
end
% Close the file
fclose(fid);
end
......@@ -30,9 +30,7 @@ ids_bolometer_description = struct();
% Load the bolometer geometry
bolo_geom=bolou_load_geometry();
bolo_geom_gitinfo= ...
tcv_get_deploymentinfo(fullfile(fileparts(which('bolou_load_geometry')), ...
'.this-deployment.info'));
bolo_geom_gitinfo= tcv_get_deploymentinfo('bolou_load_geometry');
params_eff.data_request='\tcv_shot::top.results.bolo_u.intensity';
params_eff.trialindx=1;
......@@ -146,8 +144,7 @@ if status
%% Code legacy for rc_gti_prep
ids_bolometer.code.name = 'rc_gti_prep';
rc_gti_prep_gitinfo= ...
tcv_get_deploymentinfo(fullfile(fileparts(which(ids_bolometer.code.name)),'.this-deployment.info'));
rc_gti_prep_gitinfo= tcv_get_deploymentinfo(ids_bolometer.code.name);
ids_bolometer.code.description = ...
'rc_gti_prep, RADCAM gitlab repo, calls GTI to generate emissivity profiles with liuqe.';
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