代码分发的良好解决方案

cla*_*ino 0 matlab software-distribution

我正在创建需要以纯文本形式分发的程序特定代码(针对几个不同的程序).截至目前和中期,代码仅由我编辑,但许多人使用,他们使用Windows并且是非开发人员.

我想保持一个"仓库",每个计算机自动acccess,所以我可以修改代码,他们可以用它直线上升(该解决方案将在当地,程序特定的文件夹显示(认为MATLAB或其他科学脚本软件).

毋庸置疑,像git这样的东西会被夸大其辞,而且对他们来说也是一团糟.但是,版本控制和有意识的更新是一个理想的功能.

我能想到的快速而肮脏的解决方案是共享一个Dropbox文件夹,并创建一个将该文件夹复制到其本地程序特定文件夹的Windows自动化任务.

这个解决方案有任何陷阱吗?你能推荐其他系统吗?

Sue*_*ver 5

Github(或任何git主机)并不像您想象的那样过度,因为您可以依赖Web API而不是要求所有用户在本地计算机上安装git.大多数语言都提供查询此Web API的功能,因为您只需要能够发出HTTP请求并处理JSON响应.

下面是MATLAB中一个非常简单的更新程序的例子,它依赖于Github的发布功能.(这可以很容易地修改以进行比较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
Run Code Online (Sandbox Code Playgroud)

此示例假定您只更新此单个文件.必须进行修改才能处理整个项目,但考虑到这个例子,它是相当简单的.