I'm in the situation of creating program specific code (for several -different- programs) that needs to be distributed in plain text. As of now and the middle-future, code is only edited by me, but used by many people, who use Windows and are non-developers.
I would like to keep a "repository" that each of the computers automatically acccess, so I can make modifications to the code and they can use it straight up (the solutions would show up in their local, program specific folder (think MatLab or other scientific scriptable software).
Needless to say something like git would be totally overblown and a mess to use for them. Version control and conscious update is a desired feature, though.
Quick and dirty solution that I can think of is to share a dropbox folder, and make a windows automation task that copies that folder to their local program specific folder.
Are there any pitfalls in this solution ? Is there any other system you can recommend ?
Github (or any git host) is not as overkill as you'd think since you can rely on the web API rather than requiring all of your users to install git on their local machine. The ability to query this web API is available in most languages as you only need the ability to make an HTTP request and process a JSON response.
Below is an example of a very simple updater in MATLAB that relies upon Github's release feature. (This could be easily modified to compare against master
)
function yourProgram(doUpdate)
if exist('doUpdate', 'var') && doUpdate
update();
end
% Do the actual work
end
function update()
disp('Checking for update')
% Information about this project
thisVersion = 'v1.0';
gitproject = 'cladelpino/project';
root = ['https://api.github.com/repos/', gitproject];
% Get the latest release from github
release = webread([root, '/releases/latest']);
if ~strcmp(release.tag_name, thisVersion)
disp('New Version Found')
% Get the current filename
thisfile = [mfilename, '.m'];
url = [root, '/contents/', thisfile];
fileinfo = webread(url, 'ref', release.tag_name);
% Download the new version to the current file
websave(mfilename('fullpath'), fileinfo.download_url);
disp('New Version downloaded')
else
disp('Everything is up to date!');
end
end
This example assumes that you're only updating this single file. Modifications would have to be made to handle an entire project, but it's fairly straightforward given the example.