Home > marsbar > release > pre_release.m

pre_release

PURPOSE ^

Runs pre-release export, cleanup

SYNOPSIS ^

function pre_release(rname, outdir, proj, proj_descrip, proj_url)

DESCRIPTION ^

 Runs pre-release export, cleanup
 FORMAT pre_release(rname, outdir, proj, proj_descrip)

 Inputs [defaults]
 rname        - string to define release version ['-%s']
 outdir       - directory to output release to [pwd]
 proj         - project name (and name of main project file) ['marsbar']
 proj_descrip - short description of project ['MarsBaR ROI toolbox']
 proj_url     - URL from which to clone project
                ['git://github.com/marsbar-toolbox/marsbar.git']

 e.g.  pre_release('-devel-%s', '/tmp')
 would output a release called marsbar-devel-0.34.tar.gz (if the marsbar
 version string is '0.34') to the /tmp directory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pre_release(rname, outdir, proj, proj_descrip, proj_url)
0002 % Runs pre-release export, cleanup
0003 % FORMAT pre_release(rname, outdir, proj, proj_descrip)
0004 %
0005 % Inputs [defaults]
0006 % rname        - string to define release version ['-%s']
0007 % outdir       - directory to output release to [pwd]
0008 % proj         - project name (and name of main project file) ['marsbar']
0009 % proj_descrip - short description of project ['MarsBaR ROI toolbox']
0010 % proj_url     - URL from which to clone project
0011 %                ['git://github.com/marsbar-toolbox/marsbar.git']
0012 %
0013 % e.g.  pre_release('-devel-%s', '/tmp')
0014 % would output a release called marsbar-devel-0.34.tar.gz (if the marsbar
0015 % version string is '0.34') to the /tmp directory
0016 
0017 if nargin < 1
0018   rname = '';
0019 end
0020 if isempty(rname)
0021   rname = '-%s';
0022 end
0023 if nargin < 2
0024   outdir = '';
0025 end
0026 if isempty(outdir)
0027   outdir = pwd;
0028 end
0029 if nargin < 3
0030   proj = 'marsbar';
0031 end
0032 if nargin < 4
0033   proj_descrip = 'MarsBaR ROI toolbox';
0034 end
0035 if nargin < 5
0036     proj_url = 'git://github.com/marsbar-toolbox/marsbar.git';
0037 end
0038 
0039 % project version
0040 V = eval([proj '(''ver'')']);
0041 rname = sprintf(rname, V);
0042 
0043 % Clone from git
0044 cmd = sprintf('git clone %s %s', proj_url, proj);
0045 unix(cmd);
0046 
0047 % make contents file
0048 contents_str = sprintf('Contents of %s version %s', proj_descrip, V);
0049 make_contents(contents_str, 'fncrd', fullfile(pwd, proj, proj));
0050 
0051 % move directory
0052 full_name = sprintf('%s%s', proj, rname);
0053 unix(sprintf('mv %s/%s %s', proj, proj, full_name));
0054 % Make archives
0055 unix(sprintf('tar zcvf %s.tar.gz %s', full_name, full_name));
0056 unix(sprintf('zip -r %s.zip %s', full_name, full_name));
0057 % Remove traces of checkout
0058 unix(sprintf('rm -rf %s', full_name));
0059 unix(sprintf('rm -rf %s', proj));
0060 
0061 fprintf('Created %s release %s\n', proj, full_name);
0062 fprintf('Consider Changelog, e.g git log --pretty=%%s --first-parent\n');

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019