forked from korbinian90/ASPIRE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_aspire_package.m
37 lines (34 loc) · 1.52 KB
/
make_aspire_package.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function make_aspire_package
zip_type='zip'; %'tar.gz'/'zip';
% tar preserves directory structure, zip option maybe easier for
% Windows users?
% directories, source and destination
ProgramDir = '/home/keckstein/matlab/korbinian/aspire/';
ProgramName = 'aspire_custom.m';
ArchiveDir = '/home/keckstein/matlab/korbinian/aspire';
% derive archive name from version
fullProgramName = fullfile(ProgramDir, ProgramName);
version_number = strrep(strrep(search_all_header_func(fullProgramName, 'current_version_number'),'''',''),';','');
% get all dependent m files
file_list = getFileDependencies(ProgramName);
numfiles=size(file_list,1);
for i=1:numfiles
file_list(i)=strrep(file_list(i), '/bilbo/home/', '/home/');
%file_list(i)=regexprep(file_list(i), '(/bilbo)?/home/(keckstein|srobi)/', '');
end
switch zip_type
case 'zip'
ArchiveName = strrep(strrep(ProgramName, '.m', ['_' version_number '.m.zip']),'_main','');
fullArchiveName = fullfile(ArchiveDir,ArchiveName);
zip(fullArchiveName, file_list);
case 'tar'
ArchiveName = strrep(strrep(ProgramName, '.m', ['_' version_number '.m.tar.gz']),'_main','');
fullArchiveName = fullfile(ArchiveDir,ArchiveName);
tar_command=sprintf('tar cvfz %s ', fullArchiveName);
numfiles=size(file_list,1);
for i=1:numfiles
tar_command=sprintf('%s %s', tar_command, char(file_list(i)));
end
unix(tar_command);
end
disp(['Written archive to ' fullArchiveName]);