Commit 9fc2fdb8 authored by Andrew Cohen's avatar Andrew Cohen

license preamble

parent 480c0b20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2011-2016 Andrew Cohen, Eric Wait, Mark Winter, Walt
% Mankowski
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% http://n2t.net/ark:/87918/d9rp4t for details
%
% LEVer is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LEVer is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LEVer in file "gnu gpl v3.txt". If not, see
% <http://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dlist = dir('*');
for dd=1:length(dlist)
if ~dlist(dd).isdir || length(dlist(dd).name)<4
continue
end
if strcmp(dlist(dd).name,'+assign') | strcmp(dlist(dd).name,'+matlab_bgl')
continue
end
goHeader(['.\' dlist(dd).name '\']);
end
goHeader('.\');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2011-2016 Andrew Cohen, Eric Wait, Mark Winter, Walt
% Mankowski
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% http://n2t.net/ark:/87918/d9rp4t for details
%
% LEVer is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LEVer is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LEVer in file "gnu gpl v3.txt". If not, see
% <http://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fid = fopen(filename,'rt');
i=1;
txt= {};
nextLine = fgets(fid);
while ischar(nextLine)
txt{i} = nextLine;
nextLine=fgets(fid);
i=i+1;
end
fclose(fid);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2011-2016 Andrew Cohen, Eric Wait, Mark Winter, Walt
% Mankowski
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% http://n2t.net/ark:/87918/d9rp4t for details
%
% LEVer is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LEVer is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LEVer in file "gnu gpl v3.txt". If not, see
% <http://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
flist = dir(fullfile(folder, '*.m'));
for ff=1:length(flist)
txt = license.getFileText(fullfile(folder,flist(ff).name));
txtPreamble = license.getFileText('.\+license\LicenseHeader.m');
idxPreamble = find(cellfun(@(x) ~isempty(strfind(x,'%%%%%%%%%%')),txt));
if length(idxPreamble)~=2
fprintf(1,'found file with no license: %s\n',flist(ff).name);
% find the first non-comment line
idxPreamble = find(cellfun(@(x) x(1)~='%',txt),1);
if isempty(idxPreamble)
continue
end
txtPreamble={ char(10), txtPreamble{:}, char(10)};
else
txt(idxPreamble(1):idxPreamble(2))=[];
end
txtRedone={txt{1:idxPreamble(1)-1} txtPreamble{:} txt{idxPreamble(1)+1:end}};
license.writeFileText(fullfile(folder,flist(ff).name),txtRedone);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2011-2016 Andrew Cohen, Eric Wait, Mark Winter, Walt
% Mankowski
%
% This file is part of LEVer - the tool for stem cell lineaging. See
% http://n2t.net/ark:/87918/d9rp4t for details
%
% LEVer is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% LEVer is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with LEVer in file "gnu gpl v3.txt". If not, see
% <http://www.gnu.org/licenses/>.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fid = fopen(filename,'wt');
for i=1:length(txt)
fprintf(fid,'%s',txt{i});
end
fclose(fid)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment